[R] AIC in glm.nb and glm(...family=negative.binomial(.))

Ken Knoblauch knoblauch at lyon.inserm.fr
Tue Jun 15 14:01:38 CEST 2004


Can anyone explain to me why the AIC values are so different when
using glm.nb and glm with a negative.binomial family, from the MASS
library?  I'm using R 1.8.1 with Mac 0S 10.3.4.

>library(MASS)
> dfr <- data.frame(c=rnbinom(100,size=2,mu=rep(c(10,20,100,1000),rep(25,4))),
+                   f=factor(rep(seq(1,4),rep(25,4))))
> AIC(nb1 <- glm.nb(c~f, data=dfr))
[1] 1047
> AIC(glm(c~f, family=negative.binomial(nb1$theta), data=dfr))
[1] -431804

Actually, the difference is already apparent with the function logLik,
but I still would like to understand the difference in what is
calculated in the two instances.

Thank you, in advance.


____________________
Ken Knoblauch
Inserm U 371
Cerveau et Vision
18 avenue du Doyen Lepine
69675 Bron cedex
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: 06 84 10 64 10




More information about the R-help mailing list