AIC                   package:base                   R Documentation

_A_k_a_i_k_e _I_n_f_o_r_m_a_t_i_o_n _C_r_i_t_e_r_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     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*log-likelihood
     + k*npar, where npar 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.

_U_s_a_g_e:

     AIC(object, ..., k = 2)

_A_r_g_u_m_e_n_t_s:

  object: a fitted model object, for which there exists a `logLik'
          method to extract the corresponding log-likelihood, or an
          object inheriting from class `logLik'.

     ...: optional fitted model objects.

       k: numeric, the ``penalty'' per parameter to be used; the
          default `k = 2' is the classical AIC.

_V_a_l_u_e:

     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.

_A_u_t_h_o_r(_s):

     Jose Pinheiro and Douglas Bates

_R_e_f_e_r_e_n_c_e_s:

     Sakamoto, Y., Ishiguro, M., and Kitagawa G. (1986). Akaike
     Information Criterion Statistics. D. Reidel Publishing Company.

_S_e_e _A_l_s_o:

     `logLik', `AIC.logLik'.

_E_x_a_m_p_l_e_s:

     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)))

