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

______________________________________________
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.

Reply via email to