R calculates AIC = -2*loglik + 2*(#param) but you probably missed the variance parameter when counting the parameters. Jens Schumacher -- -------------------------------------------- Dr. Jens Schumacher Max-Planck-Institut f. Biogeochemie Winzerlaer Str. 10 D-07745 Jena Germany Tel: +49 (0)3641/576181 Fax: +49 (0)3641/577100 email: jens.schumacher at bgc-jena.mpg.de
hello, could somebody refer me to the reason R uses -2*loglik + 2*(#param)+2 to calculate AIC? thank you -- Stoyan Iliev
AIC is calculated in many places in R, but I do not believe any use that formula. Here is a guess as to your confusion: in linear models there are p coefficients plus sigma^2 to be estimated and hence there is often an extra 2 associated with the scale parameter. For example, in> gaussian()$aicfunction (y, n, mu, wt, dev) sum(wt) * (log(dev/sum(wt) * 2 * pi) + 1) + 2 Beyond that, additive constants do not matter in comparing AIC between models and the defn of log-likelihood is only up to an additive constant. So sometimes calculations omit constants common to all models: extractAIC.lm does, for example. On Tue, 9 Mar 2004, Stephen Dicey wrote:> could somebody refer me to the reason R uses > > -2*loglik + 2*(#param)+2 > > to calculate AIC?-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
It doesn't, as far as I know. The function AIC.logLik is defined as > AIC.logLik function (object, ..., k = 2) -2 * c(object) + k * attr(object, "df") <environment: namespace:base> -roger Stephen Dicey wrote:> hello, > could somebody refer me to the reason R uses > > -2*loglik + 2*(#param)+2 > > to calculate AIC? > thank you > > -- > Stoyan Iliev > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
That quantity is called the "Akaike Information Criterion." It dates back to original work of Akaike. For more recent discussions and citations to earlier literature see, e.g.: Brian Ripley (1996) Pattern Recognition and Neural Networks (Cambridge U. Pr.) Burnham and Anderson (2002) Model Selection and Multimodel Inference (Springer). The latter contains errors, as Prof. Ripley indicated in earlier posts to this listserve. However, it seems for me to still be useful. hope this helps. spencer graves Stephen Dicey wrote:>hello, >could somebody refer me to the reason R uses > >-2*loglik + 2*(#param)+2 > >to calculate AIC? >thank you > >-- >Stoyan Iliev > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > >