[R] Negative binomial glm and dispersion

Dan Kehler kehler at mathstat.dal.ca
Fri May 28 18:54:48 CEST 2004


Using  R 1.8.1, and the negative binomial glm implemented in MASS, 
the default when using anova and a chi-square test is to divide the
deviance by the estimated dispersion.  Using my UNIX version of S-plus (v
3.4), and the same MASS functions, the deviances are *not* divided by the
estimated dispersion. 

Firstly, I'm wondering if anyone can enlighten about the correct procedure
(I thought the F-test was more appropriate when dispersion is estimated)? 

Secondly, after a bit of muddling with the negative binomial pdf, I
concluded that, like for the Poisson, phi is actually 1.  This result is
borne out by simulations. Is this correct?

# an example in R 1.81 with library(MASS) 
 y<-rnegbin(n=100,mu=1,theta=1)
 x<-1:length(y) 

 model<-glm(y~x,family=neg.bin(1))

 summary(model)$dispersion
 [1] 1.288926

 anova(model,test='Chisq")
#...
     Df Deviance Resid. Df Resid. Dev P(>|Chi|)
NULL                    99    102.038          
x     1    0.185        98    101.853     0.705

# But the "real" chi-square probability is 

  1-pchisq(0.185,1)
[1] 0.6671111


Thanks in advance, 

Dan 

____________________________________
Daniel Kehler
Dept. of Biology 
Dalhousie University, B3H 4J1
Halifax, Nova Scotia, Canada
Office: LSC 800
email: kehler at mscs.dal.ca 
phone: 902 494 3910




More information about the R-help mailing list