增加新版本 lmer 的迭代次数? [英] increase iterations for new version of lmer?

查看:14
本文介绍了增加新版本 lmer 的迭代次数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将 lme4 更新到 1.0-4 版本,当我运行 lmer() 时,我之前正在收敛的混合效果模型现在打印出以下警告:

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

所以,我想尝试增加迭代次数,看看能否解决这个问题.(我必须说我不知道​​是什么导致了警告,因为消息的第一部分听起来有点不透明).无论如何,我在文档中读到现在我应该使用 lmerControl(),但我无法实现它.有人可以给我一个具体的例子来说明你如何做到具体吗?(帮助文件没有帮助).这是我的模型:

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)

非常感谢!

推荐答案

lmerControl 函数允许您选择优化器并将控制参数传递给它.控制迭代次数或评估次数的参数因函数而异(如 lmerControl 的帮助页面中所述).默认优化器是Nelder_Mead";并且对于那个优化器选择,可以通过指定maxfun"来改变评估的最大数量.在'optCtrl'参数列表中:

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.

感谢@NBrouwer 的注释,用 glmControl 将此建议扩展到 glmer.

And belated thanks to @NBrouwer for his note to extend this advice to glmer with glmControl.

这篇关于增加新版本 lmer 的迭代次数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆