increase iterations for new version of lmer?

夙愿已清 提交于 2019-11-30 06:38:10

问题


I just updated lme4 to version 1.0-4 and when I run lmer() my mixed effects model, which was converging before, now prints this warning:

Warning message:
In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf,  :
  failure to converge in 10000 evaluations

So, I'd like to try to increase the number of iterations to see if I can fix this. (I must say I have no idea what is causing the warning, as the first part of the message sounds a bit opaque). In any case, I read in the documentation that now I should use lmerControl(), but I haven't been able to implement it. Could someone give me a specific example of how you'd do it for concreteness? (the Help file doesn't help). Here is my model:

m <- lmer(RT ~ Factor1*Factor2 + (0+Factor1+Factor2|Subject) + (1|Subject)  + (1|Item) + (0+Factor1+Factor2|Item), data= data)

Thanks a lot!


回答1:


The lmerControl function allows you to choose an optimizer and pass controls parameters to it. The parameters that control numbers of iterations or evaluations vary from function to function (as described in the help page for lmerControl). The default optimizer is "Nelder_Mead" and for that optimizer choice the maximum number of evaluations can be changed by specifying "maxfun" in the 'optCtrl' parameter list:

m <- lmer(RT ~ Factor1*Factor2 + (0+Factor1+Factor2|Subject) + 
               (1|Subject)  + (1|Item) + (0+Factor1+Factor2|Item),
          data= data, control=lmerControl(optCtrl=list(maxfun=20000) ) )

This is not a guarantee that convergence will be reached. (My experience is that the default maximum is usually sufficient.) It's perfectly possible that your data is insufficient to support the complexity of the model or the model is incorrectly constructed for the design of the study.



来源:https://stackoverflow.com/questions/19478686/increase-iterations-for-new-version-of-lmer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!