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=???) Thanks! Tim Tim Clark Department of Zoology University of Hawaii
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
Brian, glm.convert() does exactly what I am wanting. Thanks for putting it in MASS. Sorry about not giving credit. It is a great package and I keep finding functions that make statistical programming easy! Aloha, Tim Tim Clark Department of Zoology University of Hawaii --- On Mon, 5/3/10, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:> From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > Subject: Re: [R] Estimating theta for negative binomial model > To: "Tim Clark" <mudiver1200 at yahoo.com> > Cc: r-help at r-project.org > Date: Monday, May 3, 2010, 7:50 PM > 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 >
Apparently Analagous Threads
- Generating all possible models from full model
- Goodness of fit for negative binomial model
- using stepAIC with negative binomial regression - error message help
- Trying to rename spatial pts data frame slot that isn't a slot()
- xyplot help - colors and break in plot