[R] (no subject)
Kevin Wright
kw.stat at gmail.com
Fri Oct 30 20:12:44 CET 2015
Maybe you want
summary(aov(Y ~ A + Error(A:B)))
Kevin
On Fri, Oct 30, 2015 at 9:32 AM, Wagenaar, Daniel (wagenadl) <
wagenadl at ucmail.uc.edu> wrote:
> 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
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
--
Kevin Wright
[[alternative HTML version deleted]]
More information about the R-help
mailing list