How can I test effects in a Split-Plot ANOVA using suitable model comparisons for use with the X
and M
arguments of anova.mlm()
in R? I'm familiar with ?anova.mlm
and Dalgaard (2007)[1]. Unfortunately it only brushes Split-Plot Designs. Doing this in a fully randomized design with two within-subjects factors:
N <- 20 # 20 subjects total
P <- 3 # levels within-factor 1
Q <- 3 # levels within-factor 2
DV <- matrix(rnorm(N* P*Q), ncol=P*Q) # random data in wide format
id <- expand.grid(IVw1=gl(P, 1), IVw2=gl(Q, 1)) # intra-subjects layout of data matrix
library(car) # for Anova()
fitA <- lm(DV ~ 1) # between-subjects design: here no between factor
resA <- Anova(fitA, idata=id, idesign=~IVw1*IVw2)
summary(resA, multivariate=FALSE, univariate=TRUE) # all tests ...
The following model comparisons lead to the same results. The restricted model doesn't include the effect in question but all other effects of the same order or lower, the full model adds the effect in question.
anova(fitA, idata=id, M=~IVw1 + IVw2, X=~IVw2, test="Spherical") # IVw1
anova(fitA, idata=id, M=~IVw1 + IVw2, X=~IVw1, test="Spherical") # IVw2
anova(fitA, idata=id, M=~IVw1 + IVw2 + IVw1:IVw2,
X=~IVw1 + IVw2, test="Spherical") # IVw1:IVw2
A Split-Splot design with one within and one between-subjects factor:
idB <- subset(id, IVw2==1, select="IVw1") # use only first within factor
IVb <- gl(2, 10, labels=c("A", "B")) # between-subjects factor
fitB <- lm(DV[ , 1:P] ~ IVb) # between-subjects design
resB <- Anova(fitB, idata=idB, idesign=~IVw1)
summary(resB, multivariate=FALSE, univariate=TRUE) # all tests ...
These are the anova()
commands to replicate the tests, but I don't know why they work. Why do the tests of the following model comparisons lead to the same results?
anova(fitB, idata=idB, X=~1, test="Spherical") # IVw1, IVw1:IVb
anova(fitB, idata=idB, M=~1, test="Spherical") # IVb
Two within-subjects factors and one between-subjects factor:
fitC <- lm(DV ~ IVb) # between-subjects design
resC <- Anova(fitC, idata=id, idesign=~IVw1*IVw2)
summary(resC, multivariate=FALSE, univariate=TRUE) # all tests ...
How do I replicate the results given above with the corresponding model comparisons for use with the X
and M
arguments of anova.mlm()
? What is the logic behind these model comparisons?
EDIT: suncoolsu pointed out that for all practical purposes, data from these designs should be analyzed using mixed models. However, I'd still like to understand how to replicate the results of summary(Anova())
with anova.mlm(..., X=?, M=?)
.
[1]: Dalgaard, P. 2007. New Functions for Multivariate Analysis. R News, 7(2), 2-7.