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$

closed as off-topic by mkt - Reinstate Monica, Robert Long, user158565, kjetil b halvorsen, Michael R. Chernick Jul 24 at 20:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – mkt - Reinstate Monica, Robert Long, Michael R. Chernick
If this question can be reworded to fit the rules in the help center, please edit the question.

3
$\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$
  • $\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 Jul 24 at 14:26

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