aov object can be split into separate terms for specified contrasts. The intercept can be included in the anova table.
summary.aov(object, intercept=F, split=NULL, expand.split=T, ssType=1) summary.aovlist(object, split=NULL, expand.split=T)
"aov" or class
"aovlist".
intercept=FALSE.
split must have a name matching the treatment terms in the model (as used to label the lines of the ANOVA table).
Each element of
split is itself a list specifying the grouping of contrasts for the named term: i.e., each term has
k degrees of freedom, and each of the
k degrees of freedom has a corresponding contrast that is used in the model fitting.
The grouping of contrasts is specified by a list from the integers
1:k. Contrasts corresponding to integers in the same element of the list are summed.
expand.split=FALSE, the split is restricted to the terms specified in the
split argument. This option is ignored if
split is not given. By default,
expand.split=TRUE.
1 for sequential sum of squares and
3 for Type III sum of squares. By default,
ssType=1. If the
split argument is specified, then
ssType must be 1.
summary.aov function returns an object of class
"anova", which inherits from
"data.frame". This object contains an ANOVA table. The
summary.aovlist function returns an object of class
"listof", which contains a list of
anova objects.
This is a method for the function
summary for objects inheriting from class
"aov".
The
split argument is particularly useful for testing significance of polynomial terms.
For instance, suppose the 4-level ordered factor
Sulphur is fitted using the default contrasts
contr.poly.
Specifying
split=list(Sulphur=list(L=1,Q=2,C=3)) in the call to
summary gives a summary table with 4 lines summarizing the
Sulphur main effect: a 3 degrees of freedom line for the overall effect of
Sulphur, followed by three 1 degree of freedom lines, one each for the linear, quadratic and cubic contrasts of
Sulphur.
The sums of squares in the three 1 degree of freedom lines add up to the 3 degrees of freedom term.
Any higher order terms for which
Sulphur is marginal are similarly split.
Alternatively, specifying
split=list(Sulphur=list(L=1,rem=2:3)) gives a summary table with 3 lines summarizing the
Sulphur main effect: a 3 degrees of freedom line for the overall effect of
Sulphur, followed by a 1 degree of freedom line for the linear effect and a 2 degrees of freedom line for the remainder.
If
ssType=1, the sequential sums of squares are computed. Here, the model sum of squares is partitioned into its term components, where the sum of squares for each term listed in the ANOVA table is adjusted for the terms listed in the previous rows. For unbalanced data, the sequential sums of squares (and the hypotheses that they test) are dependent on the order that the terms are specified in the formula.
If
ssType=3, the Type III sums of squares are computed. Here, the sum of squares for each term listed in the ANOVA table is adjusted for all other terms in the model.
These sums of squares are independent of the order that the terms are specified in the formula.
If the data is balanced, the sequential sum of squares equals the Type III sum of squares.
If the data is unbalanced but complete (at least one observation for each treatment combination), then the Type III sums of squares are those obtained from Yates' weighted squares-of-means technique.
In this case, the hypotheses tested by the Type III sum of squares for the main effects is that the levels of the adjusted means are equal.
For general observational studies, the sequential sum of squares may be of more interest to an analyst. For a designed experiment, an analyst may find the Type III sum of squares of more use.
Cochran, W. and Cox, G. (1957). Experimental Designs. New York: Wiley.
SAS Institute, Inc. (1990). SAS/Stat User's Guide (4th Edition). SAS Institute, Inc.: Cary, NC.
# Reference Cochran and Cox, pg 164
# 3x3 factorial split into linear and quadratic components
P <- ordered(rep(1:3, rep(3,3)))
N <- ordered(rep(1:3,3))
Plants <- c(449, 413, 326, 409, 358, 291, 341, 278, 312)
# Convert treatment totals over 12 replicates to treatment means
Plants <- Plants/12
cox164.df <- data.frame(Plants, P, N)
cox164.aov <- aov(Plants ~ N * P, data = cox164.df,
weights = rep(12,9), qr = T)
summary(cox164.aov)
# Produces the following output:
Df Sum of Sq Mean Sq
N 2 1016.667 508.3333
P 2 917.389 458.6944
N:P 4 399.278 99.8194
# Dividing both P and N terms into their linear and quadratic part.
# Both main terms and interaction are split
summary(cox164.aov, split = list(P = list(lin = 1, quad = 2),
N = list(lin = 1, quad = 2)))
# Produces the following output:
Df Sum of Sq Mean Sq
N 2 1016.667 508.333
N: lin 1 1012.500 1012.500
N: quad 1 4.167 4.167
P 2 917.389 458.694
P: lin 1 917.347 917.347
P: quad 1 0.042 0.042
N:P 4 399.278 99.819
N:P: lin.lin 1 184.083 184.083
N:P: quad.lin 1 152.111 152.111
N:P: lin.quad 1 49.000 49.000
N:P: quad.quad 1 14.083 14.083
# Dividing only higher order terms.
# Note the protection of the : in the list name, and that
# the name 'P:N' will not work
summary(cox164.aov, split = list('N:P' = list(lin.lin = 1,
quad.terms = 2:4)))
# Produces the following output:
Df Sum of Sq Mean Sq
N 2 1016.667 508.3333
P 2 917.389 458.6944
N:P 4 399.278 99.8194
N:P: lin.lin 1 184.083 184.0833
N:P: quad.terms 3 215.194 71.7315