ems {afex} | R Documentation |
Expected values of mean squares for factorial designs
Implements the Cornfield-Tukey algorithm for deriving the expected values of the mean squares for factorial designs.
ems(design, nested = NULL, random = "")
design |
A |
nested |
A |
random |
A |
The returned value is a formatted table where the rows represent the mean squares, the columns represent the variance components that comprise the various mean squares, and the entries in each cell represent the terms that are multiplied and summed to form the expectation of the mean square for that row. Each term is either the lower-case version of one of the experimental factors, which indicates the number of levels for that factor, or a "1", which means the variance component for that column is contributes to the mean square but is not multiplied by anything else.
Names for factors or parameters should only be of length 1 as they are simply concatenated in the returned table.
Jake Westfall
A detailed description with explanation of the example can be found elsewhere (note that the design
argument of the function described at the link behaves slightly different).
Example applications of this function can be found here: https://stats.stackexchange.com/a/122662/442.
# 2x2 mixed anova
# A varies between-subjects, B varies within-subjects
ems(r ~ A*B*S, nested="A/S", random="S")
# Clark (1973) example
# random Subjects, random Words, fixed Treatments
ems(r ~ S*W*T, nested="T/W", random="SW")
# EMSs for Clark design if Words are fixed
ems(r ~ S*W*T, nested="T/W", random="S")