@doc_sub(_data_doc, _model_doc)<EOL>def AIC(data, model, params=None, corrected=True):
n = len(data)  <EOL>L = nll(data, model)<EOL>if not params:<EOL><INDENT>k = len(model.kwds) + len(model.args)<EOL><DEDENT>else:<EOL><INDENT>k = params<EOL><DEDENT>if corrected:<EOL><INDENT>aic_value = <NUM_LIT:2> * k + <NUM_LIT:2> * L + (<NUM_LIT:2> * k * (k + <NUM_LIT:1>)) / (n - k - <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>aic_value = <NUM_LIT:2> * k + <NUM_LIT:2> * L<EOL><DEDENT>return aic_value<EOL>
Akaike Information Criteria given data and a model

Parameters
----------
{0}
{1}
params : int
    Number of parameters in the model. If None, calculated from model
    object.
corrected : bool
    If True, calculates the small-sample size correct AICC. Default True.

Returns
-------
float
    AIC(C) value

Notes
-----
AICC should be used when the number of observations is < 40.

Examples
--------

>>> import macroeco.models as md
>>> import macroeco.compare as comp

>>> # Generate random data
>>> rand_samp = md.nbinom_ztrunc.rvs(20, 0.5, size=100)

>>> # Fit Zero-truncated NBD (Full model)
>>> mle_nbd = md.nbinom_ztrunc.fit_mle(rand_samp)

>>> # Fit a logseries (limiting case of Zero-truncated NBD, reduced model)
>>> mle_logser = md.logser.fit_mle(rand_samp)

>>> # Get AIC for ztrunc_nbinom
>>> comp.AIC(rand_samp, md.nbinom_ztrunc(*mle_nbd))
765.51518598676421

>>> # Get AIC for logser
>>> comp.AIC(rand_samp, md.logser(*mle_logser))
777.05165086534805

>>> # Support for for zero-truncated NBD over logseries because AIC is
>>> # smaller

>>> # Call AIC with params given as 2 (should be the same as above)
>>> comp.AIC(rand_samp, md.nbinom_ztrunc(*mle_nbd), params=2)
765.51518598676421

>>> # Call AIC without sample size correction
>>> comp.AIC(rand_samp, md.nbinom_ztrunc(*mle_nbd), params=2, corrected=False)
765.39147464655798

References
----------
.. [#]
   Burnham, K and Anderson, D. (2002) Model Selection and Multimodel
   Inference: A Practical and Information-Theoretic Approach (p. 66). New
   York City, USA: Springer.