--- On Tue, 7/22/08, Peter Dalgaard <p.dalgaard@biostat.ku.dk> wrote:
From: Peter Dalgaard <p.dalgaard@biostat.ku.dk>
Subject: Re: [R] F test
To: vycshmily@yahoo.com
Cc: r-help@r-project.org
Date: Tuesday, July 22, 2008, 11:51 PM
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)
I don't want to push my luck, but could anybody explain the above codes for
me a little more?In the above experiment, X are draws obtained from a bivariate
normal distribution with the means set to (3,4), but how to read the anova table
to see if the means of X are (3,4)?The F-statistic obtained from
'anova(m1,m2)' is 0.73 in one case, and 4.7 in another case. I don't
understand how to interpret them.Thank you!Vicki.
--
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@biostat.ku.dk) FAX: (+45) 35327907
[[alternative HTML version deleted]]