[R] generalized negative binomial
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Mar 13 09:01:47 CET 2005
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, 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