[R] Estimating theta for negative binomial model

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 4 07:50:42 CEST 2010


On Mon, 3 May 2010, Tim Clark wrote:

> Dear List,
>
> I am trying to do model averaging for a negative binomial model 
> using the package AICcmodavg.  I need to use glm() since the package 
> does not accept glm.nb() models.  I can get glm() to work if I first 
> run glm.nb and take theta from that model, but is there a simpler 
> way to estimate theta for the glm model?  The two models are:
>
> mod.nb<-glm.nb(mantas~site,data=mydata)
> mod.glm<-glm(mantas~site,data=mydata, family=negative.binomial(mod.nb$theta))
>
> How else can I get theta for the family=negative.binomial(theta=???)

library(MASS) is missing here -- do give credit where credit is due.
It contains functions

glm.convert
theta.ml

and the first does what you seem to want and the second answers the 
actual question you asked.

> Thanks!
>
> Tim
>
> Tim Clark
> Department of Zoology
> University of Hawaii

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list