Re: [R] F test

From: Vicki Meng <vycshmily_at_yahoo.com>
Date: Tue, 22 Jul 2008 20:00:23 -0700 (PDT)

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk> Subject: Re: [R] F test
To: vycshmily_at_yahoo.com
Cc: r-help_at_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_at_biostat.ku.dk)              FAX: (+45) 35327907


      
	[[alternative HTML version deleted]]


______________________________________________ R-help_at_r-project.org 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.

Received on Wed 23 Jul 2008 - 04:45:27 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 - 10:32:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive