anova
on an
lm
object
anova
for objects inheriting from class
"lm"
. See
anova
for the general behavior of this function.
anova.lm(object, ..., test, ssType=1)
lm
or
aov
object.
"none"
,
"F"
,
"Chi"
, and
"Cp"
. By default,
test="F"
.
1
for sequential sum of squares and
3
for Type III sum of squares. By default,
ssType=1
.
anova
object.
The
test
argument determines the type of statistical test to perform when multiple
lm
objects are supplied to
anova.lm
.
When
test="Chisq"
, Chi-squared tests are used to compare nested model objects.
If model
M0
is contained in model
M1
, the Chi-squared test statistic is defined as
X2 = RSS(M0) - RSS(M1)
, where
RSS(m)
is the residual sum of squares for model
m
.
Assuming that
M0
is the true model, then
X2
follows a Chi-squared distribution with
df(M0)-df(M1)
degrees of freedom, where
df(m)
is the degrees of freedom for model
m
.
When
test="F"
, standard F-tests are used to compare nested model objects.
When
test="Cp"
, Mallows' Cp statistic is calculated for the models; Mallows' Cp statistic can be used to compare non-nested models.
When
test="none"
, the models are not compared and only the degress of freedom, residual sums of squares, and differences of those quantities are calculated.
If
anova.lm
is called with a single object,
anova
produces a table with rows corresponding to each of the terms in the object, plus an additional row for the residuals.
When two or more objects are used in the call, a similar table is produced showing the effects of the pairwise differences between the models, considered sequentially from first to last.
The method for
aov
objects is similar to
summary
.
The argument
ssType
is ignored if more than one object is used in the call or the
test
argument is given.
Otherwise, for
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.
SAS Institute, Inc. (1990). SAS/Stat User's Guide (4th Edition). SAS Institute, Inc.: Cary, NC.