[R] estimate of overdispersion with glm.nb

From: Markus Loecher <mao.loecher_at_gmail.com>
Date: Mon, 21 Apr 2008 09:15:35 -0400

Dear R users,
I am trying to fully understand the difference between estimating overdispersion with glm.nb() from MASS compared to glm(..., family = quasipoisson).
It seems that (i) the coefficient estimates are different and also (ii) the summary() method for glm.nb suggests that overdispersion is taken to be one:
"Dispersion parameter for Negative Binomial(0.9695) family taken to be 1", which is not what I expected.
The code I used is pasted below:

  x <- rep(seq(0,23,by=1),50);
  s <- rep(seq(1,2,length=50*24),1);

  tmp <-
cbind.data.frame(y=rnbinom(length(tmp1),mu=8*(sin(2*pi*x/24)+2),size = 1),x=x,s=s);

  tmp.glm.qp <- glm(y~factor(x)-1,data = tmp, family=quasipoisson, offset=log(s));
  tmp.glm.nb <- glm.nb(y~factor(x)-1 +offset(log(s)),data = tmp);

On a more advanced topic, I was furthermore hoping to compare models with a global estimate of overdispersion with one that allows overdispersion to be estimated separately for each level of the factor x. Can I achieve that in glm or do I need to employ a mixed effects model ?



        [[alternative HTML version deleted]]

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. Received on Mon 21 Apr 2008 - 13:19:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 22 Apr 2008 - 22:30:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive