| AIC {base} | R Documentation |
Akaike Information Criterion
Description
This generic function calculates the Akaike information criterion for
one or several fitted model objects for which a log-likelihood value
can be obtained, according to the formula
-2 \mbox{log-likelihood} + k n_{par},
where n_{par} represents the number of parameters in the
fitted model, and k = 2 for the usual AIC, or k = \log(n)
(n the number of observations) for the so-called BIC or SBC
(Schwarz's Bayesian criterion). When comparing fitted objects, the
smaller the AIC, the better the fit.
Usage
AIC(object, ..., k = 2)
Arguments
object |
a fitted model object, for which there exists a
|
... |
optional fitted model objects. |
k |
numeric, the “penalty” per parameter to be used; the
default |
Value
if just one object is provided, returns a numeric value
with the corresponding AIC; if more than one object are provided,
returns a data.frame with rows corresponding to the objects and
columns representing the number of parameters in the model
(df) and the AIC.
Author(s)
Jose Pinheiro and Douglas Bates
References
Sakamoto, Y., Ishiguro, M., and Kitagawa G. (1986). Akaike Information Criterion Statistics. D. Reidel Publishing Company.
See Also
logLik,
AIC.logLik.
Examples
data(swiss)
lm1 <- lm(Fertility ~ . , data = swiss)
AIC(lm1)
stopifnot(all.equal(AIC(lm1),
AIC(logLik(lm1))))
## a version of BIC or Schwarz' BC :
AIC(lm1, k = log(nrow(swiss)))