You have the code, so take a look for youself. There's an error in the aic formula in negative.binomial (and neg.bin)
On Tue, 15 Jun 2004, Ken Knoblauch wrote: > 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. -- Brian D. Ripley, [EMAIL PROTECTED] 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 ______________________________________________ [EMAIL PROTECTED] 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
