[R] How to do generalized linear mixed effects models

Ross Boylan ross at biostat.ucsf.edu
Fri Feb 22 02:53:40 CET 2013

I want to analyze binary, multinomial, and count outcomes (as well as 
the occasional continuous one) for clustered data.
The more I search the less I know, and so I'm hoping the list can 
provide me some guidance about which of the many alternatives to choose.

The nlme package seemed the obvious place to start.  However, it seems 
to be using specifications from nls, which does non-linear least 
squares.  I found the documentation opaque, and I'd prefer to stay in 
the generalized linear model framework and, ideally, maximum likelihood 
estimators.  (A recent review found maximum likelihood estimators using 
quadrature performed better than penalized likelhood methods, which 
specifically included glmmPQL in MASS: 

The lme4 package apparently supports generalized linear models.  The 
title of the package is "lme4: Linear mixed-effects models using S4 
classes" but the brief description is "Fit linear and generalized linear 
mixed-effects models."

Various people, including Douglas Bates in 2011 
who is an author of both nlme and lme4, seem to use it. Some 2007 slides 
by Chris Manning: 
http://nlp.stanford.edu/~manning/courses/ling289/GLMM.pdf also use lme4.

However, http://cran.cnr.berkeley.edu/web/views/SocialSciences.html says 
"the lme4 package, which largely supersedes nlme for *linear* mixed 
models", suggesting nlme is the most appropriate choice.

Finally, there's gee in the same problem area.  Since I'm fuzzy on the 
underlying theory, and actually want to use the models to generate 
individual level imputations (and I know GEE is about the marginal 
distributions), I'd also rather avoid it.

Thanks for any guidance.  Summarizing, the candidates include at least
glmmPQL (in MASS)

I think lme4 is what I want, despite the title and the Social Science 
task page.

Ross Boylan

P.S. Zero inflated models would be nice too.

More information about the R-help mailing list