Karine Gagnon
2009-Nov-20 20:52 UTC
[R] Help with multiple comparisons on a 2-way repeated measures ANOVA
Hi everyone,
I'm trying to do a 2-way repeated measures ANOVA with data that looks like
this:
subject block rep day light response
1 1 1 one L1 5.5
2 1 2 one L1 4.5
3 1 1 one L2 4
4 1 2 one L2 5.1
5 2 1 one L1 5.3
6 2 2 one L1 4.8
7 2 1 one L2 4.6
8 2 2 one L2 4.9
1 1 1 two L1 5.2
2 1 2 two L1 5.0
3 1 1 two L2 3.2
4 1 2 two L2 3.4
5 2 1 two L1 4.6
6 2 2 two L1 4.9
7 2 1 two L2 3.3
8 2 2 two L2 2.9
I'm using lme():
m1<-light(buoy~light*day, random=~1|subject/day)
summary(m1)
and get this output:
Linear mixed-effects model fit by REML
Data: NULL
AIC BIC logLik
24.94574 28.34008 -5.472868
Random effects:
Formula: ~1 | subject
(Intercept)
StdDev: 0.05400619
Formula: ~1 | day %in% subject
(Intercept) Residual
StdDev: 0.2912773 0.06415494
Fixed effects: response ~ light * day
Value Std.Error DF t-value p-value
(Intercept) 5.025 0.1515545 6 33.15640 0.0000
lightL2 -0.200 0.2143304 6 -0.93314 0.3868
daytwo -0.100 0.2109008 6 -0.47416 0.6522
lightL2:daytwo -1.525 0.2982588 6 -5.11301 0.0022
Correlation:
(Intr) lghtL2 daytwo
lightL2 -0.707
daytwo -0.696 0.492
lightL2:daytwo 0.492 -0.696 -0.707
Standardized Within-Group Residuals:
Min Q1 Med Q3
Max
-0.36863373 -0.15741132 0.03092751 0.14569214 0.32591770
Number of Observations: 16
Number of Groups:
subject day %in% subject
8 16
My FIRST problem is that I'm not quite sure how to analyse the above output.
My SECOND problem is when I try to use glht(), to get multiple comparisons:
summary(glht(m1,linfct=mcp(day="Tukey")))
I get an error message:
Error in as.vector(x, mode) : invalid 'mode' argument
I"m not sure where this comes from. I've tried everything I (and my
labmates, we are a bunch of field biologists, not statisticians) can think
of, but this keeps coming back. Is it because glht() isn't appropriate for
2-way ANOVAs? If that's the problem, what is the correct way to do this?
Or am I going about this completely wrong from the get-go?
Thanks for all the help you can provide!
K
[[alternative HTML version deleted]]
Richard M. Heiberger
2009-Nov-20 22:14 UTC
[R] Help with multiple comparisons on a 2-way repeated measures ANOVA
install.packages("HH")
library(HH)
?MMC
Go to the bottom of the page and read the maiz example.
Read through the example that shows aovlist objects don't work
and how to construct the equivalent aov object.