Hello everybody
thanks for your advice here. I think I'm getting tangled up. If I use Thierry's test on iid Gaussian data, the returned p-value should be uniform(0,1), right? OK, R> f <- function(x){t.test(x=x[-1],mu=x[1])$p.value} R> hist(replicate(1000,f(rnorm(5)))) This is very skewed towards zero. Why isn't the histogram showing a uniform distribution? On 23 Nov 2006, at 13:32, ONKELINX, Thierry wrote: > There is no such thing as an unpaired t-test. A t-test can be a > paired, > one sample or two sample t-test. Since you want to compare the sample > against a given mean, you need a one sample t-test. You tried to do a > two sample test. That didn't work because you need at least two > observations in each group. > > x <- c(23,25,29,27,30,30) > t.test(x[-1], mu = x[1]) > > One Sample t-test > > data: x[-1] > t = 5.3634, df = 4, p-value = 0.005833 > alternative hypothesis: true mean is not equal to 23 > 95 percent confidence interval: > 25.50814 30.89186 > sample estimates: > mean of x > 28.2 > > > Cheers, > > Thierry > > ---------------------------------------------------------------------- > -- > ---- > > ir. Thierry Onkelinx > > Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature > and Forest > > Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, > methodology and quality assurance > > Gaverstraat 4 > > 9500 Geraardsbergen > > Belgium > > tel. + 32 54/436 185 > > [EMAIL PROTECTED] > > www.inbo.be > > > > Do not put your faith in what statistics say until you have carefully > considered what they do not say. ~William W. Watt > > A statistical analysis, properly conducted, is a delicate > dissection of > uncertainties, a surgery of suppositions. ~M.J.Moroney > > -----Oorspronkelijk bericht----- > Van: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Namens Robin Hankin > Verzonden: donderdag 23 november 2006 14:12 > Aan: [EMAIL PROTECTED] > Onderwerp: [R] t.test() > > Hi > > I have a vector x of length n. I am interested in x[1] > being different from the other observations (ie x[-1]). > > My null hypothesis is that x[1] > is drawn from a Gaussian distribution of the same > mean as observations x[-1], which are assumed > to be iid Gaussian. The (unknown) variance > of x[1] is assumed to be the same as the > variance of x[-1]. > > > This should be an unpaired t-test. > > But > > >> x <- c(23,25,29,27,30,30) >> t.test(x=x[1] , y=x[-1]) > Error in t.test.default(x = x[1], y = x[-1]) : > not enough 'x' observations >> > > > > What arguments do I need to send to t.test() to test my null? > > > > > > > > -- > Robin Hankin > Uncertainty Analyst > National Oceanography Centre, Southampton > European Way, Southampton SO14 3ZH, UK > tel 023-8059-7743 > > ______________________________________________ > R-help@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 > and provide commented, minimal, self-contained, reproducible code. -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 ______________________________________________ R-help@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 and provide commented, minimal, self-contained, reproducible code.