[R] P values

level lev_lambert at hotmail.co.uk
Wed May 5 22:40:57 CEST 2010

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 at r-project.org mailing list

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list