# [R-sig-ME] Lmer output for negative binomial data

Sandrine-et-Francois francoisetsandrine.mercier at wanadoo.fr
Sun Dec 9 22:22:15 CET 2007

```Dear R-list,
May I ask for help in interpretating the output of 'lmer' (from the lme4
package) when dealing with negative binomial data ?

I'm using the functions glm.nb (from the MASS package) and lmer (from the
lme4) to fit respectively fixed-effects and mixed-effects generalized linear
models to data, generated from a negative binomial distribution : count ~
Neg.Bin (mu, theta). Here is the code:
==============================================================================
#Generate the data frame
set.seed(2153)
mydf<-data.frame(subjs=seq(1:nsubjids),
counts=rnbinom(nsubjids*ntimes, size=0.5, mu=1.8))

#Model
require(MASS); require(lme4)
summary(glm.nb(counts~1, data=mydf))
summary(lmer(counts~1+(1|subjs),
family=negative.binomial(theta=fixed.nb0\$theta), data=mydf))
==============================================================================
The glm.nb output gives : mu=exp(0.5306) and theta=0.513.
I use the theta estimate from glm.nb as input into lmer, and I obtain,
mu=exp(0.5306).

The output from lmer gives the following for the Random effects:
Random effects:
Groups   Name        Variance   Std.Dev.
subjs    (Intercept) 3.5577e-10 1.8862e-05
Residual             7.1155e-01 8.4353e-01
number of obs: 30, groups: subjs, 10

I interprete the "subjs" component as an individual error term "e" (so, that
mu=exp(0.5306)*exp(e)) with e~N(0, 3.5577e-10) ? Is this correct ?
What about the 'Residual' term ?

Thanks for your help,
Best regards,
François

```