[R] pvalue calculate

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jul 22 23:01:48 CEST 2012


On 12-07-22 3:37 PM, Mary Kindall wrote:
> 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
>

This question doesn't really make sense.  sample(1:50) gives you the 
same sample as 1:50 does, just in a different order.  So the mean is 
guaranteed to be 25.5, which is obviously different from 300.

If you really did have a random sample from some unknown distribution 
and you wanted to test whether the mean of that distribution is 
different from 300, then Henrik's suggestion is reasonable for most 
distributions.

Duncan Murdoch



More information about the R-help mailing list