3

I am using R 3.2.0 and lme4 1.1.7.

With a particular glmer run, the function keeps halting announcing that "pwrssUpdate did not converge in 30 iterations."

I have tried every combination I can think of to increase the iterations and it seems like glmer is hardwired to a maximum of 30 and will not increase it.

My most recent attempt within the glmer was control = glmerControl(optCtrl=list(maxfun=250)), but I have tried every combination I can find in any email list or other posting here which involved somebody trying to increase the number of permissible iterations. Nothing stops glmer from just stopping at 30 and giving me that error.

I'd like to keep this question general and not about my data if possible so that the answer(s) are useful to others. Assume that my data is suitable for the purpose if enough iterations can be performed.

If anyone has any quick methodological suggestions, I'd appreciate it. I'd like to think I'm just missing something, but if I'm encountering this I assume others have / are as well.

Ben Bolker
  • 43,543
bachlaw
  • 31

1 Answers1

4

I don't think this is going to help, for reasons discussed below, but:

  • the max iterations might be larger in the current development version (100?), which is on Github and be on CRAN soon.
  • it is admittedly hard to adjust the max. PWRSS iterations; the reason we have not made this a high priority (it wouldn't be too hard to fix) is that as far as I know we have never seen a situation where increasing the number of PWRSS iterations actually helps. PWRSS failures are sometimes cases where NaN values pop up in the course of the calculation (this is not handled very well/transparently).
  • while I appreciate your desire to focus on the general question and not on the details of your data, I have almost always found that PWRSS failures do stem from some kind of problem with the data and/or model and are dealt with by addressing the underlying problem, not by boosting the number of iterations.

All that said, you should be able to increase the maximum number of iterations by following a slightly modified version of the steps shown in ?modular (without a reproducible example, I'm not 100% sure this actually works ...)

library(lme4)
## 1. set up model terms
glmod <- glFormula(cbind(incidence, size - incidence) ~
                 period + (1 | herd),
                   data = cbpp, family = binomial)
## 1A. adjust maxit.
glmod <- c(glmod,list(maxit=200))
## 2.  Create the deviance function for optimizing over theta:
devfun <- do.call(mkGlmerDevfun, glmod)
## 3.  Optimize over theta using a rough approximation (i.e. nAGQ = 0):
opt <- optimizeGlmer(devfun)
## 4.  Update the deviance function for optimizing over theta and beta:
devfun <- updateGlmerDevfun(devfun, glmod$reTrms)
    ## 5.  Optimize over theta and beta:
    opt <- optimizeGlmer(devfun, stage=2)
    mkMerMod(environment(devfun), opt, glmod$reTrms, fr = glmod$fr)
Ben Bolker
  • 43,543