Re: [R] F test

From: Peter Dalgaard <>
Date: Wed, 23 Jul 2008 01:51:52 +0200

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
~~~~~~~~~~ - (              FAX: (+45) 35327907

______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue 22 Jul 2008 - 23:55:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jul 2008 - 00:32:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive