# [R-sig-ME] specifying two error terms in random effects ANOVA

Joshua Wiley jwiley.psych at gmail.com
Tue Jan 18 20:53:23 CET 2011

```Dear List,

Is there a way to specify more than one error term in the formula for
a mixed/random effects ANOVA?  For example, given this data and that
both 'order' and 'admin' are random factors, my understanding based on
the construction of expected mean squares is that the 'order:admin'
interaction is the appropriate error term for the main effects of
'order' and 'admin', but that the usual residuals are the appropriate
error term for the 'order:admin' interaction.  Although it is possible
to do this using two separate models, I am hoping they can be combined
somehow.

Josh

dat <- structure(list(nresponse = c(26, 15, 26, 24, 33, 27, 36, 28,
30, 33, 25, 33, 26, 32, 37, 42, 25, 23, 27, 17, 30, 24, 37, 33,
28, 30, 27, 26, 31, 26, 39, 25), admin = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("1",
"2", "3", "4"), class = "factor"), order = structure(c(1L, 1L,
2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L,
2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L), .Label = c("I",
"II", "III", "IV"), class = "factor")), .Names = c("nresponse",
"admin", "order"), row.names = c(NA, -32L), class = "data.frame")

summary(aov(nresponse ~ order * admin, dat))

--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

```