anova.glm
Analysis of Deviance for Generalized Linear Model Fits

Description

Compute the analysis of deviance table for a generalized linear model (object of class glm) or a list of glm objects (for objects that inherit from the glmlist class.).

Usage

anova.glm(object, ..., dispersion = NULL, test = NULL) 
anova.glmlist(object, ..., dispersion = NULL, test = NULL) 

Arguments

object a glm or glmlist object.
... additional glm objects for anova.glm. If multiple glm objects are supplied, the objects should be made from the same data, response variable, and family (that is, distribution, link, and so on.), only the predictor variables should be different. Each model's set of predictors should include all the predictors in the previous model. This argument is not used for anova.glmlist.

dispersion the dispersion parameter for the fitting family. If NULL, dispersion is obtained from the objects through summary.glm().
test a character string or NULL that specifies the test to perform. Can be one of the following:
  • "Rao": used for the Rao efficient score test
  • "LRT": currently similar to "Chisq" test.
  • "F"
  • "Chisq"
  • "Cp"
NULL means to not compute any test statistics. For details, see stat.anova.
Value
returns an object of class c("anova", "data.frame"), which is a data.frame with an attribute called "heading" containing text added to the printout by print.anova.
If anova.glm is called with a single object, anova produces a table with rows that corresponds to each of the terms in the object, plus an additional row at the top for the null model (the model including nothing but a possible intercept, if an intercept was requested). The first four columns are labelled as follows: If a test statistic is specified there will be a column labelled for the test statistic and, for "Chisq" and "F" only, a column for its upper tail probability.
When two or more objects are used in the call to anova.glm or a list of objects in the call to anova.glmlist, a similar table is produced that shows the effects of the pairwise differences between the models, considered sequentially from first to last. The columns will be like those in the single model output, but in a different order. The first four will be as follows: and there is an if test statistic and a p-value column, if appropriate.
References
Hastie, T. J. and Pregibon, D. 1992. Generalized linear models. Statistical Models in S. Chambers, J. M. and Hastie, T .J. (Eds.) Pacific Grove, CA.: Wadsworth & Brooks/Cole. Chapter 6
See Also
glm, stat.anova, anova, print.anova.
Examples
smallModel <- glm(breaks ~ wool + tension, data=warpbreaks, family=poisson)
bigModel <- glm(breaks ~ wool * tension, data=warpbreaks, family=poisson)
anova(bigModel, test="Chisq")
anova(bigModel, test="Rao")
ret1 <- anova(smallModel, bigModel, test="Chisq")
ret1
ret2 <- anova(structure(list(smallModel, bigModel), class = "glmlist"), test="Chisq")  
ret2
identical(ret1, ret2) # TRUE 
Package stats version 6.0.0-69
Package Index