[R] Split-plot and within-subjects
Niccolò Bassani
biostatistica at gmail.com
Wed May 29 10:08:37 CEST 2013
Dear all,
I have a probably silly question on how to specify model for a
split-plot design and for a within-subject design (1way). I have two
factors: factor A with 5 levels and factor B with 2 levels, for each
level of factor A I have 4 subjects that experiment both levels of
factor B, so this should be a split-plot design without blocking. I've
read tons of vignettes, old emails and whatsoever, but I've found
somehow diffrent informations concerning the most appropriate way to
code this using aov and lme/lmer. My guesses are as follows:
aov(y ~ A * B + Error(Subject), data = mydata)
lme(y ~ A * B, random = ~1 | Subject, data = mydata)
lmer(y ~ A * B + (1 | Subject), data = mydata)
This should provide results for a split-plot design without blocks
where F statistics are computed according to the correct error strata
am I right? I'm a little bit confused because most examples on help
pages and vignettes involve blocking which is not present here.
Additionally, suppose that instead of analyzing all the data as a
whole I split them according to levels of factor A, thus having 5
different within-subjects models to run, how am I supposed to code the
Error terms appropriately? This is what I figured out, yet I'm not
sure it's what I want:
aov(y ~ B + Error(Subject/B), data = mydata2)
lme(y ~ B, random = ~1 | Subject/B, data = mydata2)
lmer(y ~ B + (1 | Subject/B), data = mydata2)
Thanks
Niccolò
More information about the R-help
mailing list