[R] over-estimation Negative Binomial models

Ben Bolker bbolker at gmail.com
Tue Oct 18 14:12:40 CEST 2011


D_Tomas <tomasmeca <at> hotmail.com> writes:

> I have fitted a Negative Binomial model (glm.nb) and a Poisson model (glm
> family=poisson) to some count data. Both have the same explanatory variables
> & dataset
> 
> When I call  sum(fitted(model.poisson))  for my GLM-Poisson model, I obtain
> exactly the same number of counts as my data. 
> 
> However, when I call sum(fitted(model.neg.binomial)) for my Negative
> Binomial model I clearly obtain many more count data (approx 27% more
> counts).
> 
> Can anyone explain why such stark contrast between the two models exist? Why
> is the Negative Binomial massively over-estimating the values? 
> 
> Does it have to do with the dispersion parameter of the Negative Binomial
> model?
>

  Nothing springs to mind immediately.  Can you post a reproducible
example?

  The trivial example below works:

> z <- rpois(1000,5)
> pm <- glm(z~1,family=poisson)
> sum(fitted(pm))
[1] 4975
> sum(z)
[1] 4975
> nbm <- MASS::glm.nb(z~1)
Warning messages:
1: In theta.ml(Y, mu, sum(w), w, limit = control$maxit, 
  trace = control$trace >  :
  iteration limit reached
2: In theta.ml(Y, mu, sum(w), w, limit = control$maxit, 
  trace = control$trace >  :
  iteration limit reached
> sum(fitted(nbm))
[1] 4975



More information about the R-help mailing list