[R] (no subject)

Wagenaar, Daniel (wagenadl) wagenadl at ucmail.uc.edu
Fri Oct 30 15:32:22 CET 2015


Dear R users:

All textbook references that I consult say that in a nested ANOVA (e.g., A/B), the F statistic for factor A should be calculated as F_A = MS_A / MS_(B within A). But when I run this simple example:

set.seed(1)
A = factor(rep(1:3, each=4))
B = factor(rep(1:2, 3, each=2))
Y = rnorm(12)
anova(lm(Y ~ A/B))

I get this result:

Analysis of Variance Table

Response: Y
          Df Sum Sq Mean Sq F value Pr(>F)
A          2 0.4735 0.23675  0.2845 0.7620
A:B        3 1.7635 0.58783  0.7064 0.5823
Residuals  6 4.9931 0.83218               

Evidently, R calculates the F value for A as MS_A / MS_Residuals. While it is straightforward enough to calculate what I think is the correct result from the table, I am surprised that R doesn't give me that answer directly. Does anybody know if R's behavior is intentional, and if so, why? And, perhaps most importantly, how to get the "textbook" result in the most straightforward way? (I'd like to be able to give me students a simple procedure...)

Thanks,

Daniel Wagenaar

-- 
Daniel A. Wagenaar, PhD
Assistant Professor
Department of Biological Sciences
McMicken College of Arts and Sciences
University of Cincinnati
Cincinnati, OH 45221
Phone: +1 (513) 556-9757
Email: daniel.wagenaar at uc.edu
Web: http://www.danielwagenaar.net


More information about the R-help mailing list