[R] Negative Binomial modelling

kjetil brinchmann halvorsen kjetil at entelnet.bo
Sat Jan 18 00:40:03 CET 2003

On 17 Jan 2003 at 15:59, Damon Wischik wrote:

It seems like gnlr() in Jim Lindsay's package
gnlm might help you.

Kjetil Halvorsen

> I have some data which I am trying to fit with a negative binomial
> distribution. I have found the glm.nb function from MASS.
> I have reason to believe that the mean parameter mu depends on
> certain factors, and that the shape parameter theta depends on
> others.
> If, say, the factors are P and Q, it might be that
>   mu ~ P:Q and theta ~ P
> (where mu ~ P:Q means that mu is a function of the pair (P,Q))
> in which case I could call glm.nb several times, one for each
> level of P (though this would be somewhat cumbersome).
> From looking at the data, I have reason to believe that
>   mu ~ P and theta ~ Q.
> How can I go about fitting this?
> I expect I will have to write my own likelihood-maximization
> routine, and I am happy to do this (though if there are packages
> that do it for me, so much the better). In fact, my real model
> is a mixture model, and for this I am sure I will have to write
> my own likelihood-maximization routine.
> What I want to learn from this list is if there are helpful
> commands that would do all the tedious work of working out how
> many variables there are etc. I'm hoping for some sort of call like
>   gm( count ~ mydist(mu=p:q, theta=q) )
> where all I need to write the likelihood-maximization routine
> and the function gm does the rest, providing the answer in
> a suitable format for doing chi-squared tests etc.
> Damon Wischik.
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help

More information about the R-help mailing list