The X
and M
basically specify the two models you want to compare, but only in terms of the within-subject effects; it then shows results for the interaction of all between-subject effects (including the intercept) with the within-subject effects that changed between X
and M
.
Your examples on fitB
are easier to understand if we add the defaults for X
and M
:
anova(fitB, idata=idB, M=~1, X=~0, test="Spherical") # IVb
anova(fitB, idata=idB, M=diag(3), X=~1, test="Spherical") # IVw1, IVw1:IVb
The first model is the change from no within subject effects (all have the same mean) to a different mean for each, so we've added the id
random effect, which is the right thing to test the overall intercept and the overall between subject effect on.
The second model ads the id:IVw1
interaction, which is the right thing to test IVw1
and the IVw1:IVb
terms against. Since there is only one within-subject effect (with three levels) the default of diag(3)
in the second model will account for it; it would be equivalent to run
anova(fitB, idata=idB, M=~IVw1, X=~1, test="Spherical") # IVw1, IVw1:IVb
For your fitC
, I believe these commands will recreate the Anova
summary.
anova(fitC, idata=id, M=~1, X=~0, test="Spherical") #IVb
anova(fitC, idata=id, M=~IVw1 + IVw2, X=~IVw2, test="Spherical") # IVw1
anova(fitC, idata=id, M=~IVw1 + IVw2, X=~IVw1, test="Spherical") # IVw2
anova(fitC, idata=id, M=~IVw1 + IVw2 + IVw1:IVw2,
X=~IVw1 + IVw2, test="Spherical") # IVw1:IVw2
Now, as you discovered, these commands are really tricky. Thankfully, there's not much reason to use them anymore. If you're willing to assume sphericity, you should just use aov
, or for even easier syntax, just use lm
and compute the right F-tests yourself. If you're not willing to assume sphericity, using lme
is really the way to go as you get a lot more flexibility than you do with the GG and HF corrections.
For example, here's the aov
and lm
code for your fitA
. You do need to have the data in long format first; here's one way to do that:
library(reshape)
d0 <- data.frame(id=1:nrow(DV), DV)
d0$IVb <- IVb
d0 <- melt(d0, id.vars=c(1,11), measure.vars=2:10)
id0 <- id
id0$variable <- factor(levels(d0$variable), levels=levels(d0$variable))
d <- merge(d0, id0)
d$id <- factor(d$id)
And here's lm and
aov` code:
anova(lm(value ~ IVw1*IVw2*id, data=d))
summary(aov(value ~ IVw1*IVw2 + Error(id/(IVw1*IVw2)), data=d))
In my opinion your design more strongly resembles a nested design. Individuals
are nested within the sites
. Hence, I would advise to either treat site
simply as a fixed effect covariate (due to the small number of levels) or use some sort of hierarchical modeling (could be difficult, again due to the low number of site
levels).
The question of whether or not you have a split plot design is dependent on the smallest experimental unit. If this would indeed be site
you would have a split-plot (or repeated-measures) design, as your experimental units would undergo different treatments. However, from your description it sounds like you sample experimental units within each site
making those the smallest experimental unit. As long as experimental units are not assigned to more than one condition, it is not a split-plot design. Rather, you seem to have a two-level multilevel model (e.g., sampling students within classes).
Best Answer
I'm sure terminology varies, but I think it's fair to say that a split-plot design (where there are two or more treatments imposed at different hierarchical levels) is a specific example of a mixed design. Mixed effect models (also called multilevel or hierarchical models; repeated measures are another special case) are so-called because they include both random and fixed effect terms.
I would say that split-plot designs are "both" between- and within-subject designs, because (at least) one treatment is between- and (at least) one treatment is within-subject.
In order to answer the other question one would need a more specific example.