Solved – Lmer model fails to converge

lme4-nlmer

My data is described here What can cause a "Error() model is singular error" in aov when fitting a repeated measures ANOVA?

I am trying to see the effect of an interaction using lmer so my base case is:

my_null.model <- lmer(value ~ Condition+Scenario+ 
                             (1|Player)+(1|Trial), data = my, REML=FALSE)

my.model <- lmer(value ~ Condition*Scenario+ 
                             (1|Player)+(1|Trial), data = my, REML=FALSE)

Running the anova gives me significant results, but when I try to account for random slope ((1+Scenario|Player)) the model fails with this error:

  Warning messages:
 1: In commonArgs(par, fn, control, environment()) :
   maxfun < 10 * length(par)^2 is not recommended.
 2: In optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp),  :
  convergence code 1 from bobyqa: bobyqa -- maximum number of function evaluations exceeded
 3: In commonArgs(par, fn, control, environment()) :
  maxfun < 10 * length(par)^2 is not recommended.
 4: In optwrap(optimizer, devfun, opt$par, lower = rho$lower, control = control,  :
   convergence code 1 from bobyqa: bobyqa -- maximum number of function evaluations exceeded
 5: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
   Model failed to converge with max|grad| = 36.9306 (tol = 0.002)
 6: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
   Model failed to converge: degenerate  Hessian with 1 negative eigenvalues

Alternatively if it fails to converge after a lot of iterations (I set it to 100 000) and I am getting the same results after 50k and 100k it means that it is very close to the actual value, just it does not reach it. So can I report my results like this?

Note that when I set the iterations so high I get only these warnings:

 Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
 Model failed to converge with max|grad| = 43.4951 (tol = 0.002)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
 Model failed to converge: degenerate  Hessian with 1 negative eigenvalues

Best Answer

See this conversation for an alternative method of assessing convergence. Specifically, this comment from Ben Bolker:

thanks. An even simpler test would be to take a fitted example that gave you convergence warnings and take a look at the results of
relgrad <- with(fitted_model@optinfo$derivs,solve(Hessian,gradient))
max(abs(relgrad))
and see if it's reasonably small (e.g. <0.001?)

Alternatively, you could try Bolker's advice here, which is to try a different optimizer.

Related Question