[R] Negative binomial GLMMs in R

Hans.Skaug@mi.uib.no Hans.Skaug at mi.uib.no
Wed Mar 23 16:00:31 CET 2005

Dear R-users,

A recent post (Feb 16) to R-help inquired about fitting 
a glmm with  a negative binomial distribution. 
Professor Ripley responded that this was a difficult problem with the
simpler Poisson model already being a difficult case:


Since we are developing software for fitting general nonlinear random 
effects models we thought this might be an interesting challenge. 
We contacted Professor Ripley who kindly directed us to the epilepsy data 
in Venables & Ripley section 10.4 (4th ed.). While V&B did not actually 
fit a negative binomial to these data they did refer to evidence 
of overdispersion in the response.  Fortunately Booth et al. (2003) did 
attempt to fit this model with a negative binomial which gave us something 
to which we could compare our results. Booth et al. fitted two forms of 
the model a simpler one and a more complicated model. They reported some 
difficulty fitting the more complicated  model. We found that we could 
reliably fit (MLE) both the complicated and simpler model in 20 seconds 
or less (although the more complicated turns out to be overparameterized)

Using the random effects module of AD Model Builder we have developed 
a shared library (Windows dll) that can be called from R via the driver 
function glmm.admb(). The function can be downloaded from


The two models of Booth et al are fit by the commands:


I will be happy to receive feedback on the function glmm.admb().

Best regards,

Hans Skaug

Booth J.G.; Casella G.; Friedl H.; Hobert J.P, Negative binomial loglinear 
mixed models.
Statistical Modelling, October 2003, vol. 3, no. 3, pp. 179-191

More information about the R-help mailing list