extractAIC {stats}R Documentation

Extract AIC from a Fitted Model

Description

Computes the (generalized) Akaike An Information Criterion for a fitted parametric model.

Usage

extractAIC(fit, scale, k = 2, ...)  

Arguments

fit fitted model, usually the result of a fitter like lm.
scale optional numeric specifying the scale parameter of the model, see scale in step.
k numeric specifying the “weight” of the equivalent degrees of freedom (=: edf) part in the AIC formula.
... further arguments (currently unused in base R).

Details

This is a generic function, with methods in base R for "aov", "coxph", "glm", "lm", "negbin" and "survreg" classes.

The criterion used is

AIC = - 2*log L + k * edf,

where L is the likelihood and edf the equivalent degrees of freedom (i.e., the number of parameters for usual parametric models) of fit.

For linear models with unknown scale (i.e., for lm and aov), -2log L is computed from the deviance and uses a different additive constant to AIC.

k = 2 corresponds to the traditional AIC, using k = log(n) provides the BIC (Bayes IC) instead.

For further information, particularly about scale, see step.

Value

A numeric vector of length 2, giving

edf the “equivalent degrees of freedom” of the fitted model fit.
AIC the (generalized) Akaike Information Criterion for fit.

Note

These functions are used in add1, drop1 and step and that may be their main use.

Author(s)

B. D. Ripley

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer (4th ed).

See Also

AIC, deviance, add1, step

Examples

example(glm)
extractAIC(glm.D93)#>>  5  15.129

[Package stats version 2.2.1 Index]