[R-sig-eco] nested anova and multiple comparisons

Stephen Cole swbcole at gmail.com
Sat Apr 26 19:46:41 CEST 2008

I am not sure if this is the rigth place to post this but i am working
in ecology and my project is ecological so here goes.  Thanks in

My problem is with a nested anova.  I have read the r-help and it has
answered some of my questions but i still need some help on this one.
I have also posted for help on this data set before, so i apologize in
advance for any repetition.

My design is as follows:

response: Quadrat Counts (individuals per quadrat)

Region (3 regions)
Locations (4 locations nested within each regionfor a total of 1
Site (4 sites nested within each location withineach region for a total of 48)

I want to analyse this data set as an observational study where i am
interested if

1) There is significant variation at each scale in thestudy
2) partition the variancecomponents for each scale.
3) Conduct multiplecomparisons at the highest level in the study (region)

I have managed to accomplish my first two goals by analyzing the data
as a 3 level nested Anova with the following code

mod1 <- aov(Count~Region/Location/Site, data=data)

This allows me to get the MS for a Anova table.   However R does not
compute the correct F-statistics (because it uses the residual MS for
the denominator in all calculations which it shouldnt) so i manually
computed the F-stats and variance components by hand.

>From reading the help guide i learned about and tried using the
Error(Region/Location/Site) command but then i can only get MS and no
F-statistics and still hand to compute the rest by hand.

My problem now is that i would liek to use TukeyHSD for multiple
comparisons.  Howeber since R is unable to compute the correct F
statistics in this nested design i also think it is using the wrong MS
and df in calculating tukeys q. for example when i use

TukeyHSD(mod1, "Region")  i will get values however i do not think
they have been calculated correctly.

Furthermore when i use the Error(Region/Location/Site) term i can then
no longer use TukeyHSD as i get the error message that there is no
applicable use of tukey on this object.

i am just wondering if there is any way to use Multiple comparisons
with R in a nested design like mine.

I have thought about using lme or lmer but if i understand them right
with a balanced design i should be able to get the same result using


More information about the R-sig-ecology mailing list