I would like to share some of my thoughts when trying to improve the model fitting time of a linear mixed effects model in R
using the lme4
package. <
If you use glmer
rather than lmer
, there is a parameter nAGQ
. I found that setting nAGQ=0
dramatically reduced the time it took to fit a fairly complex model (13 fixed effects, one random effect with varying intercept and slope, 300k rows). This basically tells glmer
to use a less exact form of parameter estimation for GLMMs. See ?glmer
for more details, or this post.