Anova

0th

Percentile

Anova Tables for Linear and Generalized Linear Models

Calculates type-II or type-III analysis-of-variance tables for model objects produced by lm and glm. For linear models, F-tests are calculated; for generalized linear models, likelihood-ratio chisquare, Wald chisquare, or F-tests are calculated.

Keywords
models, regression, htest
Usage
Anova(mod, ...)

Anova.lm(mod, error, type=c("II", "III"), ...)

Anova.glm(mod, type=c("II", "III"), test.statistic=c("LR", "Wald", "F"),
error, error.estimate=c("pearson", "dispersion", "deviance"))
Arguments
mod
lm or glm model object.
error
for a linear model, an lm model object from which the error sum of squares and degrees of freedom are to be calculated. For F-tests for a generalized linear model, a glm object from which the dispersion is to be e
type
type of test, "II" or "III".
test.statistic
for a generalized linear model, whether to calculate "LR" (likelihood-ratio), "Wald", or "F" tests.
error.estimate
for F-tests for a generalized linear model, base the dispersion estimate on the Pearson residuals (pearson, the default); use the dispersion estimate in the model object (dispersion), which, e.g., is fixed to 1 for
...
arguments to be passed to linear.hypothesis; only use white.adjust for a linear model.
Details

So-called type-II tests are calculated according to the principle of marginality, testing each term after all others, except ignoring the term's higher-order relatives; so-called type-III tests violate marginality, testing each term in the model after all of the others. Be very careful in formulating the model for type-III tests, or the hypotheses tested will not make sense. As implemented here, type-II Wald tests for generalized linear models are actually differences of Wald statistics. For all but type-II likelihood-ratio and F tests for generalized linear models, Anova finds the test statistics without refitting the model. The standard R anova function calculates sequential (type-I) tests. These rarely test meaningful hypotheses.

Value

• An object of class anova, usually printed.

Warning

Be careful of type-III tests.

References

Fox, J. (1997) Applied Regression, Linear Models, and Related Methods. Sage.

linear.hypothesis, anova

Aliases
• Anova
• Anova.lm
• Anova.II.lm
• Anova.III.lm
• Anova.glm
• Anova.II.F.glm
• Anova.II.LR.glm
• Anova.II.Wald.glm
• Anova.III.F.glm
• Anova.III.LR.glm
• Anova.III.Wald.glm
Examples
data(Moore)
mod<-lm(conformity~fcategory*partner.status, data=Moore,
contrasts=list(fcategory=contr.sum, partner.status=contr.sum))
Anova(mod)
## Anova Table (Type II tests)
##
## Response: conformity
##                         Sum Sq Df F value   Pr(>F)
## fcategory                 11.61  2  0.2770 0.759564
## partner.status           212.21  1 10.1207 0.002874
## fcategory:partner.status 175.49  2  4.1846 0.022572
## Residuals                817.76 39
Anova(mod, type="III")
## Anova Table (Type III tests)
##
## Response: conformity
##                          Sum Sq Df  F value    Pr(>F)
## (Intercept)              5752.8  1 274.3592 < 2.2e-16
## fcategory                  36.0  2   0.8589  0.431492
## partner.status            239.6  1  11.4250  0.001657
## fcategory:partner.status  175.5  2   4.1846  0.022572
## Residuals                 817.8 39
Documentation reproduced from package car, version 0.8-3, License: GPL version 2 or newer

Community examples

Looks like there are no examples yet.