[R] pvalue calculate

Henrik Singmann henrik.singmann at psychologie.uni-freiburg.de
Sun Jul 22 22:09:58 CEST 2012


Hi Mary,

I think the good old t-test is what you want:

x <- sample(1:50)
  
t.test(x, mu = 300)

gives:
         One Sample t-test

data:  x
t = -133.2, df = 49, p-value < 0.00000000000000022
alternative hypothesis: true mean is not equal to 300
95 percent confidence interval:
  21.36 29.64
sample estimates:
mean of x
      25.5

Best,
Henrik


Am 22.07.2012 21:37, schrieb Mary Kindall:
> I have a value
> a=300
>
> observation (x) = sample(1:50)
>
> How to find a p-value from this. I need to show that "a" is different fom
> mean(x).
> Thanks
>

-- 
Dipl. Psych. Henrik Singmann
PhD Student
Albert-Ludwigs-Universität Freiburg
http://www.psychologie.uni-freiburg.de/Members/singmann



More information about the R-help mailing list