Full_Name: Robert Kushler
Version: 2.7.2
OS: Windows XP
Submission from: (NULL) (69.246.102.98)
I believe that the negative binomial family (from MASS) should be
added to the
list for which dispersion is set to 1.
Could you please clarify? In what procedures, under what
circumstances? Sounds like you mean l. 573 of glm.R:
if(object$family$family %in% c("poisson", "binomial")) 1
The use case here is using negative.binomial with a fixed
theta parameter, right? Using glm.nb takes care of this problem
(it produces an object of class "negbin": MASS:::summary.negbin
shows that the dispersion gets set to 1 here).
I guess there's a little bit of a jurisdictional
argument here, since the negative.binomial family is
in MASS, and summary.glm is in base R ... also, there's
a bit of a challenge in figuring out the test, because
object$family$family is not a fixed string for negative
binomial-family objects (e.g. "Negative Binomial(0.4)"
in the example below) -- I'm not sure of the cleanest
way to detect this case.
I think I agree with you, but it would help to present
your case in more detail ...
Ben Bolker
====================
Example:
x <- rep(seq(0,23,by=1),50)
s <- rep(seq(1,2,length=50*24),1)
tmp2 <- data.frame(y=rnbinom(length(s),
mu=8*(sin(2*pi*x/24)+2),size = 0.4),x=factor(x),s=s)
library(MASS)
tmp.glm.nb2 <- glm.nb(y~factor(x)-1 +offset(log(s)),data = tmp2)
summary(tmp.glm.nb2)
## summary.negbin takes care of this case
tmp.glm.nb3 <- glm(y~factor(x)-1 +offset(log(s)),data = tmp2,
family=negative.binomial(theta=0.4))
summary(tmp.glm.nb3)