1
$\begingroup$

I want to translate this formula from glmer() (lme4 package) to glmmPQL() (MASS package).

glmer(y ~ a + b + c + (a + b + c | x), 
      family = binomial())

I want to include the random intercept and the random slopes of all 3 predictors (a, b, c) in my model.

I have tried this one (not sure whether I rewrote the formula correctly), but it seems not working.

glmmPQL(y ~ a + b + c, random = ~ a + b + c | x, 
        family = binomial())

Here is the error message. Not exactly sure whether it was a formula error or convergence error.

Error in lme.formula(fixed = y ~ 1 + a + b + c, random = ~1 +  : 
  nlminb problem, convergence error code = 1
  message = iteration limit reached without convergence (10)
$\endgroup$

1 Answer 1

4
$\begingroup$

The translation from glmer() to glmmPQL() is correct. The error you receive indicates that the optimization algorithm behind lme() that is internally used in glmmPQL() did not converge successfully. You could try setting as optimization algorithm the optim() function instead of the nlminb() (the default).

But note that the glmmPQL() algorithm (penalized quasi likelihood) is inferior to the one behind glmer() (Laplace approximation). It is even better to use the adaptive Gaussian quadrature that is provided from the mixed_model() function of the GLMMadaptive package. The equivalent code would be:

mixed_model(y ~ a + b + c, random = ~ a + b + c | x,
            family = binomial())
$\endgroup$
1
  • $\begingroup$ Thanks! It works now using the formula: glmmPQL(y ~ a + b + c, random = ~ a + b + c | x, family = binomial(), control=lmeControl(opt = "optim")) $\endgroup$
    – curl sloth
    Commented Jul 24, 2019 at 14:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.