Re: [R] generalized negative binomial

From: Prof Brian Ripley <>
Date: Sun 13 Mar 2005 - 19:01:47 EST

On Sat, 12 Mar 2005, Erin M Simpson wrote:

> I am looking for code that allows for a more flexible negative binomial
> model (similar to Stata's "gnbreg").

Your subject line is not clear to me: Stata appears to fit a negative binomial model, the point being that it is not a glm as fitted by glm.nb. (So when Stata says

      `gnbreg is a generalized negative binomial regression'

it is `regression' not `negative binomial' that is being generalized.)

> In particular, I am looking to be able to model the ancillary
> shape parameter in terms of a series of covariates. So if,
> y[i] ~ poisson(mu[i])
> mu[i] = exp(x[i]beta + u[i])
> exp(u[i]) ~ Gamma(1/alpha, alpha)
> I am looking to parameterize alpha as exp(z[i]gamma).
> If you are familiar with a package that allows for this, I'd appreciate
> the heads up. Similar information that allows for first differences with
> such a model is also appreciated.

Just write down the log-likelihood (I am not sure what the free parameters here are: are beta and gamma vectors?), and call optim() to maximize it.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Mon Mar 14 10:33:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:46 EST