# S3 method for glm
anova(object, …, dispersion = NULL, test = NULL)
glm
, typically
the result of a call to glm
, or a list of
objects
for the "glmlist"
method."Chisq"
,
"LRT"
, "Rao"
,
"F"
or "Cp"
. See stat.anova
."anova"
inheriting from class "data.frame"
.na.action = na.omit
is used,
and anova
will detect this with an error.gaussian
,
quasibinomial
and quasipoisson
fits) the F test is
most appropriate. Mallows' \(C_p\) statistic is the residual
deviance plus twice the estimate of \(\sigma^2\) times
the residual degrees of freedom, which is closely related to AIC (and
a multiple of it if the dispersion is known).
You can also choose "LRT"
and
"Rao"
for likelihood ratio tests and Rao's efficient score test.
The former is synonymous with "Chisq"
(although both have
an asymptotic chi-square distribution). The dispersion estimate will be taken from the largest model, using
the value returned by summary.glm
. As this will in most
cases use a Chisquared-based estimate, the F tests are not based on
the residual deviance in the analysis of deviance table shown.glm
, anova
. drop1
for
so-called ‘type II’ anova where each term is dropped one at a
time respecting their hierarchy.## --- Continuing the Example from '?glm':
anova(glm.D93)
anova(glm.D93, test = "Cp")
anova(glm.D93, test = "Chisq")
glm.D93a <-
update(glm.D93, ~treatment*outcome) # equivalent to Pearson Chi-square
anova(glm.D93, glm.D93a, test = "Rao")
Run the code above in your browser using DataLab