[R] F test
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed Jul 23 01:51:52 CEST 2008
Vicki Meng wrote:
> Dear R users,
>
> I need to do a F test on the hypothesis that a 2 by 1 vector (X_1, X_2)' has the mean vector (M_1, M_2)'. Specifically, I would like to assume the X vector comes from a bivariate Normal distribution (M, Sigma). Then, given 1000 observations on X, I wanted to test if the means of X agree with the means of the target Normal distribution. Any function or package in R could do such a test? Thanks!
>
library(MASS) # for multivariate normal RNG
X <- mvrnorm(1000, Sigma=matrix(c(2,1,1,3),2), mu=c(3,4))
Y <- sweep(X,2,c(3,4))
m1 <- lm(Y~1)
m2 <- lm(Y~0)
anova(m1, m2)
--
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
mailing list