[R] Stats Question: Single data item versus Sample from Norma l Distribution

Liaw, Andy
2005-04-05T10:35:30Z

Here's one possibility, assuming muhat and sigmahat are estimtes of mu and
sigma from N iid draws of N(mu, sigma^2):

tStat <- abs(x - muhat) / sigmahat
pValue <- pt(tStat, df=N, lower=TRUE)

I'm not quite sure what df tStat should have (exercise for math stat), but
given fairly large N, that should make little difference.

Andy

> From: Ross Clement
>
> Hi. I have a question that I have asked in other stat forums
> but do not
> yet have an answer for. I would like to know if there is some way in R
> or otherwise of performing the following hypothesis test.
>
> I have a single data item x. The null hypothesis is that x
> was selected
> from a normal distribution N(mu,sigma). The alternate
> hypothesis is that
> x does not come from this distribution.
>
> However, I do not know the values of mu and sigma. I have a sample of
> size N from which I can estimate mu and sigma. So, say that I have
> N(m,s,N), and x. I would like to say with some certainty
> (e.g. 95%) that
> I can, or can't reject the hypothesis that x came from N(mu,sigma). I
> would also like a power test to say how large N should be given the
> degree of accuracy I need when accepting or rejecting individual x
> values.
>
> What is the name of the hypothesis test I need for this? Is it built
> into R, or are there packages I could use?
>
> Thanks in anticipation,
>
> Ross Clement.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>
>