From: <Bill.Venables_at_csiro.au>

Date: Wed, 6 Feb 2008 14:58:52 +1000

*>
*

http://www.cmis.csiro.au/bill.venables/

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.

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 06 Feb 2008 - 05:04:47 GMT

Date: Wed, 6 Feb 2008 14:58:52 +1000

Here is a short example:

> dat <- data.frame(x = rnorm(20),

a = rep(letters[1:4], 5), b = rep(letters[1:5], each = 4))

> summary(aov(x ~ a*b, dat))

Df Sum Sq Mean Sq a 3 0.8021 0.2674 b 4 3.7175 0.9294 a:b 12 10.5416 0.8785

> summary(aov(x ~ a/b, dat))

Df Sum Sq Mean Sq a 3 0.8021 0.2674 a:b 16 14.2590 0.8912

So in your nested case you should not get a mean square for 'Female' at all. The interaction sum of squares in the nested case is the sum of the main effect and interaction in the crossed model case, (as are the degrees of freedom).

Although you think of them as different models, in a mathematical sense they are equivalent - you just parcel the degrees of freedom and SSQ a bit differently in the sequential anova.

Bill Venables

CSIRO Laboratories

PO Box 120, Cleveland, 4163

**AUSTRALIA
**

Office Phone (email preferred): +61 7 3826 7251 Fax (if absolutely necessary): +61 7 3826 7304 Mobile: +61 4 8819 4402 Home Phone: +61 7 3286 7700mailto:Bill.Venables_at_csiro.au

http://www.cmis.csiro.au/bill.venables/

-----Original Message-----

From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org]
On Behalf Of Daniel Bolnick

Sent: Wednesday, 6 February 2008 2:28 PM
To: r-help_at_r-project.org

Subject: [R] Nested ANOVA models in R

I used the following two commands:

summary(aov(Spinelength ~ Male*Female))

and

summary(aov(Spinelength ~ Male/Female))

I get the same mean squares either way, which doesn't seem right to me. In the former case, the mean square for females should be calculated around the overall mean across all females, whereas the mean square in the latter case should be calculated using deviations from the set of 4 females nested within a given male, right?

Of course, it is more appropriate for me to treat each of these as random effects. I know Bates has objections to the SAS-style partitioning variances to obtain F statistics and p-values, and I have read relevant parts of Pinhero and Bates, but how can a specify a nested random effects model that yields p-values for both the males (tested against MS for females) and females nested within males?

Thanks,

Dan Bolnick

Section of Integrative Biology

University of Texas at Austin

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.

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 06 Feb 2008 - 05:04:47 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 06 Feb 2008 - 07:30: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.
*