[R] How would you calculate this type of p-value using R?
Patrick Breheny
patrick.breheny at uky.edu
Thu Aug 18 13:55:10 CEST 2011
On 08/17/2011 12:32 AM, RQuestion wrote:
> Let's say you want to compare "one observation" with a sample, how would you
> use R to get a p-value for that single observation itself?
This is a rather vague question, but you seem to be describing the
calculation of tail probabilities. If, for example, you expected the
distribution to be normal with mean 10 and SD 5, and then observed 23,
the (one-sided) 'p-value' would be
> 1-pnorm(23,mean=10,sd=5)
[1] 0.004661188
If you did not wish to assume a distribution (i.e., use the empirical
distribution), the 'p-value' would simply be the fraction of cases in
your sample as large or larger than the observation in question.
--
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky
More information about the R-help
mailing list