extractAIC               package:stats               R Documentation

_E_x_t_r_a_c_t _A_I_C _f_r_o_m _a _F_i_t_t_e_d _M_o_d_e_l

_D_e_s_c_r_i_p_t_i_o_n:

     Computes the (generalized) Akaike *A*n *I*nformation *C*riterion
     for a fitted parametric model.

_U_s_a_g_e:

     extractAIC(fit, scale, k = 2, ...)

_A_r_g_u_m_e_n_t_s:

     fit: fitted model, usually the result of a fitter like 'lm'.

   scale: optional numeric specifying the scale parameter of the model,
          see 'scale' in 'step'.  Currently only used in the '"lm"'
          method, where 'scale' specifies the estimate of the error
          variance, and 'scale = 0' indicates that it is to be
          estimated by maximum likelihood. 

       k: numeric specifying the 'weight' of the _equivalent degrees of
          freedom_ (=: 'edf') part in the AIC formula.

     ...: further arguments (currently unused in base R).

_D_e_t_a_i_l_s:

     This is a generic function, with methods in base R for '"aov"',
     '"coxph"', '"glm"', '"lm"', '"negbin"' and '"survreg"' classes.

     The criterion used is

                     AIC = - 2*log L +  k * edf,

     where L is the likelihood and 'edf' the equivalent degrees of
     freedom (i.e., the number of free parameters for usual parametric
     models) of 'fit'.

     For linear models with unknown scale (i.e., for 'lm' and 'aov'),
     -2log L is computed from the _deviance_ and uses a different
     additive constant to 'logLik' and hence 'AIC'.  If RSS denotes the
     (weighted) residual sum of squares then 'extractAIC' uses for -
     2log L the formulae RSS/s - n (corresponding to Mallows' Cp) in
     the case of known scale s and n log (RSS/n) for unknown scale.
     'AIC' only handles unknown scale and uses the formula n log
     (RSS/n) - n + n log 2pi - sum log w where w are the weights.

     For 'glm' fits the family's 'aic()' function to compute the AIC:
     see the note under 'logLik' about the assumptions this makes.

     'k = 2' corresponds to the traditional AIC, using 'k = log(n)'
     provides the BIC (Bayesian IC) instead.

_V_a_l_u_e:

     A numeric vector of length 2, giving

     edf: the '*e*quivalent *d*egrees of *f*reedom' for the fitted
          model 'fit'.

     AIC: the (generalized) Akaike Information Criterion for 'fit'.

_N_o_t_e:

     This function is used in 'add1', 'drop1' and 'step' and similar
     functions in package 'MASS' from which it was adopted.

_A_u_t_h_o_r(_s):

     B. D. Ripley

_R_e_f_e_r_e_n_c_e_s:

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S._ New York: Springer (4th ed).

_S_e_e _A_l_s_o:

     'AIC', 'deviance', 'add1', 'step'

_E_x_a_m_p_l_e_s:

     utils::example(glm)
     extractAIC(glm.D93)#>>  5  15.129

