p.dalgaard at biostat.ku.dk
Thu Nov 23 14:46:00 CET 2006
Robin Hankin <r.hankin at noc.soton.ac.uk> writes:
> I have a vector x of length n. I am interested in x
> being different from the other observations (ie x[-1]).
> My null hypothesis is that x
> 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 is assumed to be the same as the
> variance of x[-1].
> This should be an unpaired t-test.
> > x <- c(23,25,29,27,30,30)
> > t.test(x=x , y=x[-1])
> Error in t.test.default(x = x, y = x[-1]) :
> not enough 'x' observations
> What arguments do I need to send to t.test() to test my null?
You can't. Shouldn't be too much of a problem to modify t.test.default
to stop it complaining. (It's not quite enough to remove the check for
nx < 2, though. You also need to deal with var(x) being NA if x has
Alternatively, just write up the formula for the t statistic:
> x <- c(23,25,29,27,30,30)
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help