AIC                  package:stats                  R Documentation

_A_k_a_i_k_e'_s _A_n _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:

     Generic function calculating 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).

_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'.

     ...: optionally more fitted model objects.

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

_D_e_t_a_i_l_s:

     The default method for 'AIC', 'AIC.default()' entirely relies on
     the existence of a 'logLik' method computing the log-likelihood
     for the given class.

     When comparing fitted objects, the smaller the AIC, the better the
     fit.

_V_a_l_u_e:

     If just one object is provided, returns a numeric value with the
     corresponding AIC (or BIC, or ..., depending on 'k'); 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:

     'extractAIC', 'logLik'.

_E_x_a_m_p_l_e_s:

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

