Computes the (generalized) Akaike An Information Criterion for a fitted parametric model.
fitted model, usually the result of a fitter like
optional numeric specifying the scale parameter of the
numeric specifying the ‘weight’ of the
equivalent degrees of freedom (=:
further arguments (currently unused in base R).
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 free parameters for usual parametric
For linear models with unknown scale (i.e., for
aov), -2 log L is computed from the
deviance and uses a different additive constant to
logLik and hence
AIC. If RSS
denotes the (weighted) residual sum of squares then
uses for -2 log L the formulae RSS/s - n (corresponding
to Mallows' Cp) in the case of known scale s and
n log (RSS/n) for unknown scale.
AIC only handles unknown scale and uses the formula
n*log(RSS/n) + n + n*log 2pi - sum(log w)
where w are the weights. Further
AIC counts the scale
estimation as a parameter in the
extractAIC does not.
glm fits the family's
aic() function is used to
compute the AIC: see the note under
logLik about the
assumptions this makes.
k = 2 corresponds to the traditional AIC, using
log(n) provides the BIC (Bayesian IC) instead.
Note that the methods for this function may differ in their
assumptions from those of methods for
via a method for
logLik). We have already
mentioned the case of
"lm" models with estimated scale, and
there are similar issues in the
methods where the dispersion parameter may or may not be taken as
‘free’. This is immaterial as
extractAIC is only used
to compare models of the same class (where only differences in AIC
values are considered).
A numeric vector of length 2, with first and second elements giving
the ‘equivalent degrees of freedom’
for the fitted model
the (generalized) Akaike Information Criterion for
This function is used in
step and the similar functions in package
MASS from which it was adopted.
B. D. Ripley
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. New York: Springer (4th ed).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.