Because if you use the sample standard deviation then it is a t test not a z test.
-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Thomas Roth > Sent: Thursday, May 06, 2010 1:58 AM > To: 'level'; r-help@r-project.org > Subject: Re: [R] P values > > Why > > s = 1 > > ## > > s = sd(A) #? > > > -----Ursprüngliche Nachricht----- > Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > Im > Auftrag von level > Gesendet: Mittwoch, 5. Mai 2010 22:41 > An: r-help@r-project.org > Betreff: [R] P values > > > How do u calculated p values for a z test.. > > so far i ve done this > > A = read.table("cw3_data.txt") > > xbar = mean(A) > s = 1 > n = 20 > mu = 0 > > z.test = (xbar-mu)/(s/sqrt(n)) > > p.value = pnorm(abs(z.test)) > > error = qnorm(0.99)*s/sqrt(n) > left = xbar - error > right = xbar + error > > and have got values off of it...but the values for p dont match up with > other sites that i have used to check it agaisnt..such as wolfram alpha > value i got was 0.7335039 when wolfram got 0.533.. any ideas where i > ve > gone wrong? cheers > -- > View this message in context: > http://r.789695.n4.nabble.com/P-values-tp2131646p2131646.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.