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:

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

