Hi All,
I am frustrated by mixed-effects model! I have searched the web for
hours, and found lots on the nested anova, but nothing useful on my
specific case, which is: a random factor (C) is nested within one of the
fixed-factors (A), and a second fixed factor (B) is crossed with the
first fixed factor:
C/A
A
B
A x B
My question: I have a functioning model using the aov command (see
below), and I would now would like to recode it, using a more flexible
command such as lme or lmer. Once I have the equivalent syntax down, I
would ideally like to re-run my analysis using "family = poisson", as CO
is actually count data.
I have a dataset including a response variable CO, measured once per
Week (for 11 weeks) at 13 Locations. The 13 Locations are divided into 2
habitat types (Control and Treatment).
Thus:
CO is a continuous response variable,
Week is a fixed categorical factor,
Habitat is a fixed categorical factor, and
Location is a random categorical factor nested within Habitat.
Here is my model in R:
mCO = aov(CO ~ Week * Habitat + Error(Location/Week))
summary(mCO)
And the output:
Error: Location
Df Sum Sq Mean Sq F value Pr(>F)
Habitat 1 182566 182566 8.6519 0.01341 *
Residuals 11 232115 21101
Error: Location:Week
Df Sum Sq Mean Sq F value Pr(>F)
Week 10 596431 59643 11.0534 7.5e-13 ***
Week:Habitat 10 196349 19635 3.6389 0.0003251 ***
Residuals 110 593551 5396
Given that this is a mixed model, I believe the appropriate error terms
are as follows:
For the F test of Habitat, the denominator MS is that for location/habitat;
For the F test of Week, the denominator MS is the residual; and
For the F test of Habitat x Week, the denominator MS is the residual.
My tinkering with lmer and lme have not produced results similar to the
above
For example,
m. = lmer(CO ~ Week * Habitat + (1|Habitat/Location))
anova(m.)
produces:
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Week 10 596431 59643 11.0534
Habitat 1 28652 28652 5.3100
Week:Habitat 10 196349 19635 3.6389
Any coding advice would be greatly appreciated!
Thanks for your consideration,
Dave Robichaud
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.