From bolker at ufl.edu  Fri Apr 10 15:04:10 2009
From: bolker at ufl.edu (Ben Bolker)
Date: Fri, 10 Apr 2009 06:04:10 -0700 (PDT)
Subject: [Rd] summary for negative binomial GLMs (PR#13640)
In-Reply-To: <loom.20090406T175943-439@post.gmane.org>
References: <20090404171517.73D7D282EFF6@mail.pubhealth.ku.dk>
	<loom.20090406T175943-439@post.gmane.org>
Message-ID: <22987694.post@talk.nabble.com>



   Bump?  Does anyone else have an opinion on this one?

  cheers
    Ben Bolker


Ben Bolker wrote:
> 
>  <kushler <at> oakland.edu> writes:
> 
>> 
>> 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)
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

-- 
View this message in context: http://www.nabble.com/summary-for-negative-binomial-GLMs-%28PR-13640%29-tp22885745p22987694.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] summary for negative binomial GLMs (PR#13640)
Ben Bolker