aov(formula, data = <<see below>>, projections = F, qr = F, contrasts = NULL, ...)
if there is no Error term in the model, the object is of class "aov" (or "maov" for multiple response models). This class inherits from the class of linear models, class "lm" ("mlm") and has the following components:
if there is an Error term in the model, then the object returned by aov has class "aovlist" and is a list of aov objects of the form above (without call or terms components), one for each stratum. This list has attributes call and terms as described above.
Use the summary function on the output of aov to see the anova table for the model.
FORMULAS. A plus sign (+) separates terms in the formula. Specify an interaction with a colon; for example, A:B is the interaction between factor A and factor B. The * operator gives the interaction plus the main effects, so A*B*C expands to three main effects, three two-factor interactions and one three-factor interaction. The term B %in% A means that B is nested within A; and A/B expands to A + B %in% A. Terms may be subtracted from the model if they are specified elsewhere in the formula, e.g., A*B*C - B:C contains only two two-factor interactions. The precedence of these operators follows the usual S Language precedence.
UNBALANCED MODELS. If effects are not orthogonal, then the order in the model is significant. For example, A*B will give different sums of squares than B*A if there is imbalance in the data. The aov function produces sequential sums of squares (Type I in the notation of SAS GLM).
MULTIPLE STRATA. The formula may optionally specify special blocking or error structure if it includes a term that calls the special function Error. For example, response ~ time * concentration + Error(blocks) specifies that factor blocks defines an error stratum. The resulting model will include two error strata, blocks and Within. In the case of multiple error strata, aov fits a separate model for each stratum. The response is projected onto each term in the error model, and these projections are then used to fit separate models. There must only be one Error term in a formula; however, there may be more than one term inside the error function.
For example, the Error term for a split-plot design would be: Error(plots) while the Error term for a split-split-plot would be: Error(plots + subplots) The order of the terms inside of Error is important. See Heiberger (1989) for more on error strata.
REPEATED MEASURES. Using an error stratum is also the way to produce a univariate analysis of a repeated measures design. The appropriate Error term for a design in which "subject" is the repeated measure would be: Error(subject)
Box, G. E. P., Hunter, W. G. and Hunter, J. S. (1978). Statistics for Experimenters. New York: Wiley.
Daniel, C. (1976). Applications of Statistics to Industrial Experimentation. New York: Wiley.
Heiberger, R. M. (1989). Computation for the Analysis of Designed Experiments. New York: Wiley.
Hicks, C. R. (1982). Fundamental Concepts in the Design of Experiments. Third Edition. New York: Holt, Rinehart and Winston.
Scheff', H. (1959). The Analysis of Variance. New York: Wiley.
# fit main effects and 2 factor interactions cat.aov2 <- aov(Yield ~ .^2, catalyst) summary(cat.aov2) # look at anova tablegun.aov <- aov(Rounds ~ Method + Physique/Team, gun)
aov(Yield ~ Temp * Pressure + Method) # uses an attached data frame aov(Yield ~ Temp * Pressure + Method, exp1, na.action=na.omit)
attach(guayule) # split plot design aov(plants ~ variety * treatment + Error(flats))
tgaov <- aov(plants ~ variety * treatment + Error(flats), guayule, contrasts = list(treatment = contr.treatment))