[R] problem with extractAIC()
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Sun Mar 7 04:31:14 CET 2010
Yes, you are missing something vital.
The log-likelihood is only defined up to an additive constant. extractAIC and logLik use log-likelihoods with different additive constants, in general. (AIC my look uniquely defined, but since log-likelihood itself is not uniquely defined, nor is AIC.)
Try fitting two models and check if the difference in AIC values is the same whether you use extractAIC or if you do it by hand with logLik. This is the only real test.
Bill Venables.
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Jordi Moya [jordi at eeza.csic.es]
Sent: 07 March 2010 00:58
To: r-help at R-project.org
Subject: [R] problem with extractAIC()
Dear friends,
If I use:
model<-lm(y ~ x)
and then extractAIC(model), the value that I obtain does not match (not even
close):
AIC=2*k-2*logLik(model)
However, using AIC from the AICcmodavg(), the value matches exactly the
above value.
I read the help of extractAIC() and could not figure out what was wrong,
other than what I call k (number of parameters) is edf in the help and k
they use for the value 2 that multiplies my k, their edf, and which is
implemeted as the default, thus not possibly being the cause of the
missmatch.
Does anybody know whether am I missing something or whether there may be a
bug in extractAIC()?
Best wishes,
Jordi Moya-Laraño
Cantabrian Institute of Biodiversity (ICAB)
Dpto. BiologÃa de Organismos y Sistemas
Universidad de Oviedo
Catedrático Rodrigo UrÃa s/n
33006-Oviedo
Asturias
Spain
[1]http://www.uniovi.es/icab/jordi.html
References
1. http://www.uniovi.es/icab/jordi.html
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list