EVOLUTION-MANAGER
Edit File: AIC.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Akaike's An Information Criterion</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for AIC {stats}"><tr><td>AIC {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Akaike's An Information Criterion</h2> <h3>Description</h3> <p>Generic function calculating Akaike's ‘An Information Criterion’ for one or several fitted model objects for which a log-likelihood value can be obtained, according to the formula <i>-2*log-likelihood + k*npar</i>, where <i>npar</i> represents the number of parameters in the fitted model, and <i>k = 2</i> for the usual AIC, or <i>k = log(n)</i> (<i>n</i> being the number of observations) for the so-called BIC or SBC (Schwarz's Bayesian criterion). </p> <h3>Usage</h3> <pre> AIC(object, ..., k = 2) BIC(object, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>a fitted model object for which there exists a <code>logLik</code> method to extract the corresponding log-likelihood, or an object inheriting from class <code>logLik</code>.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>optionally more fitted model objects.</p> </td></tr> <tr valign="top"><td><code>k</code></td> <td> <p>numeric, the <em>penalty</em> per parameter to be used; the default <code>k = 2</code> is the classical AIC.</p> </td></tr> </table> <h3>Details</h3> <p>When comparing models fitted by maximum likelihood to the same data, the smaller the AIC or BIC, the better the fit. </p> <p>The theory of AIC requires that the log-likelihood has been maximized: whereas AIC can be computed for models not fitted by maximum likelihood, their AIC values should not be compared. </p> <p>Examples of models not ‘fitted to the same data’ are where the response is transformed (accelerated-life models are fitted to log-times) and where contingency tables have been used to summarize data. </p> <p>These are generic functions (with S4 generics defined in package <span class="pkg">stats4</span>): however methods should be defined for the log-likelihood function <code><a href="logLik.html">logLik</a></code> rather than these functions: the action of their default methods is to call <code>logLik</code> on all the supplied objects and assemble the results. Note that in several common cases <code><a href="logLik.html">logLik</a></code> does not return the value at the MLE: see its help page. </p> <p>The log-likelihood and hence the AIC/BIC is only defined up to an additive constant. Different constants have conventionally been used for different purposes and so <code><a href="extractAIC.html">extractAIC</a></code> and <code>AIC</code> may give different values (and do for models of class <code>"lm"</code>: see the help for <code><a href="extractAIC.html">extractAIC</a></code>). Particular care is needed when comparing fits of different classes (with, for example, a comparison of a Poisson and gamma GLM being meaningless since one has a discrete response, the other continuous). </p> <p><code>BIC</code> is defined as <code>AIC(object, ..., k = log(nobs(object)))</code>. This needs the number of observations to be known: the default method looks first for a <code>"nobs"</code> attribute on the return value from the <code><a href="logLik.html">logLik</a></code> method, then tries the <code><a href="nobs.html">nobs</a></code> generic, and if neither succeed returns BIC as <code>NA</code>. </p> <h3>Value</h3> <p>If just one object is provided, a numeric value with the corresponding AIC (or BIC, or ..., depending on <code>k</code>). </p> <p>If multiple objects are provided, a <code>data.frame</code> with rows corresponding to the objects and columns representing the number of parameters in the model (<code>df</code>) and the AIC or BIC. </p> <h3>Author(s)</h3> <p>Originally by José Pinheiro and Douglas Bates, more recent revisions by R-core. </p> <h3>References</h3> <p>Sakamoto, Y., Ishiguro, M., and Kitagawa G. (1986). <em>Akaike Information Criterion Statistics</em>. D. Reidel Publishing Company. </p> <h3>See Also</h3> <p><code><a href="extractAIC.html">extractAIC</a></code>, <code><a href="logLik.html">logLik</a></code>, <code><a href="nobs.html">nobs</a></code>. </p> <h3>Examples</h3> <pre> lm1 <- lm(Fertility ~ . , data = swiss) AIC(lm1) stopifnot(all.equal(AIC(lm1), AIC(logLik(lm1)))) BIC(lm1) lm2 <- update(lm1, . ~ . -Examination) AIC(lm1, lm2) BIC(lm1, lm2) </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>