12
$\begingroup$

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
$\endgroup$
8
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ what should one do if max(abs(relgrad)) gives you a value of 2.9239489e-05 ? $\endgroup$ – Jens Oct 28 '15 at 16:49
  • 1
    $\begingroup$ @Jens then that would be really, really small (e-05 means "write 5 zeros and then the numbers you see on the left", with a dot after the first zero). So one would be pretty happy with that value! $\endgroup$ – Arthur Spoon Mar 20 '18 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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