Rev 51300 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/stats/man/AIC.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2010 R Core Development Team% Distributed under GPL 2 or later\name{AIC}\encoding{UTF-8}\alias{AIC}\title{Akaike's An Information Criterion}\description{Generic function calculating the Akaike information criterion forone or several fitted model objects for which a log-likelihood valuecan be obtained, according to the formula\eqn{-2 \mbox{log-likelihood} + k n_{par}}{-2*log-likelihood + k*npar},where \eqn{n_{par}}{npar} represents the number of parameters in thefitted model, and \eqn{k = 2} for the usual AIC, or\eqn{k = \log(n)}{k = log(n)}(\eqn{n} the number of observations) for the so-called BIC or SBC(Schwarz's Bayesian criterion).}\usage{AIC(object, \dots, k = 2)}\arguments{\item{object}{a fitted model object, for which there exists a\code{logLik} method to extract the corresponding log-likelihood, oran object inheriting from class \code{logLik}.}\item{\dots}{optionally more fitted model objects.}\item{k}{numeric, the \emph{penalty} per parameter to be used; thedefault \code{k = 2} is the classical AIC.}}\details{The default method for \code{AIC}, \code{AIC.default()} entirelyrelies on the existence of a \code{\link{logLik}} methodcomputing the log-likelihood for the given class.When comparing fitted objects, the smaller the AIC, the better the fit.The log-likelihood and hence the AIC is only defined up to an additiveconstant. Different constants have conventionally be used fordifferent purposes and so \code{\link{extractAIC}} and \code{AIC} maygive different values (and do for models of class \code{"lm"}: see thehelp for \code{\link{extractAIC}}).}\value{If just one object is provided, returns a numeric valuewith the corresponding AIC (or BIC, or \dots, depending on \code{k});if multiple objects are provided, returns a \code{data.frame} withrows corresponding to the objects and columns representing the numberof parameters in the model (\code{df}) and the AIC.}\references{Sakamoto, Y., Ishiguro, M., and Kitagawa G. (1986).\emph{Akaike Information Criterion Statistics}.D. Reidel Publishing Company.}\author{\enc{José}{Jose} Pinheiro and Douglas Bates}\seealso{\code{\link{extractAIC}}, \code{\link{logLik}}.}\examples{lm1 <- lm(Fertility ~ . , data = swiss)AIC(lm1)stopifnot(all.equal(AIC(lm1),AIC(logLik(lm1))))## a version of BIC or Schwarz's BC :AIC(lm1, k = log(nrow(swiss)))}\keyword{models}