LMER的替代优化算法 [英] Alternative optimization algorithms for lmer

查看:109
本文介绍了LMER的替代优化算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下, lme4 包中的函数 lmer 使用 minqa 包中的 bobyqa 作为优化算法.

The function lmer in the lme4 package uses by default bobyqa from the minqa package as optimization algorithm.

根据以下帖子 https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q1/020075.html ,也可以在 minqa

According to the following post https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q1/020075.html, it is possible to use also the other optimization algorirthms in the minqa package

如何使用 uobyqa newuoa 作为 lmer 的优化算法?

How can one use uobyqa or newuoa as optimization algorithm for lmer?

library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy, control=lmerControl(optimizer="bobyqa"))

推荐答案

您不能使用 newuoa uobyqa ,因为它们都不允许对参数进行约束.来自?lmerControl (添加了重点)

You can't use newuoa nor uobyqa because neither allows for constraints on the parameters. From ?lmerControl (emphasis added)

任何允许框约束的最小化功能 都可以使用

(1)接受输入参数'fn'(要优化的功能),'par'(起始参数值),'lower'(下限)和'control'(控制参数,从'control'传递过来的参数)参数)和

(1) takes input parameters ‘fn’ (function to be optimized), ‘par’ (starting parameter values), ‘lower’ (lower bounds) and ‘control’ (control parameters, passed through from the ‘control’ argument) and

(2)返回包含(至少)元素"par"(最适合)的列表参数),"fval"(最佳拟合函数值),转换"(收敛码,成功等于0收敛)和(可选)消息"(信息消息或收敛失败的说明.

(2) returns a list with (at least) elements ‘par’ (best-fit parameters), ‘fval’ (best-fit function value), ‘conv’ (convergence code, equal to zero for successful convergence) and (optionally) ‘message’ (informational message, or explanation of convergence failure).

"bobyqa"开头的 b 代表"bound"(约束),我假设其他算法中的 u 类似地代表"unconstrained"".您可以检出此文件,以了解一些可以通过一堆不同的优化器(重新)拟合相同模型的机器:

The b at the beginning of "bobyqa" stands for "bound" (as in constrained), I assume the u in the other algorithms similarly stands for "unconstrained". You can check out this file for some machinery to (re)fit the same model with a bunch of different optimizers:

allFit <- system.file("utils", "allFit.R", package="lme4")
file.show(allFit)

我目前所知道的所有优化器的列表允许框约束并且不需要指定显式渐变函数(中的大多数受约束约束的优化器都是必需的如上文件所示,是optimx 包)

The list of all optimizers I currently know about that allow box constraints and don't require an explicit gradient function to be specified (required for most of the bound-constrained optimizers in the optimx package), as shown in the file above, is

  • BOBYQA( minqa nloptr 包实现)
  • Nelder-Mead( lme4 nloptr dfoptim 包实现)
  • 来自R的
  • nlminb (来自Bell Labs PORT库)
  • 通过 optimx (来自Boyden-Fletcher-Goldfarb-Shanno,通过Nash)从基数R中获得
  • L-BFGS-B ()
  • BOBYQA (minqa and nloptr package implementations)
  • Nelder-Mead (lme4, nloptr, and dfoptim package implementations)
  • nlminb from base R (from the Bell Labs PORT library)
  • L-BFGS-B from base R, via optimx (Broyden-Fletcher-Goldfarb-Shanno, via Nash)

除了这些内置在 allFit.R 中的代码之外,您还可以使用 COBYLA nloptr 中的次级复合优化器:请参见?nloptwrap .在 subplex 包中还有另一种subplex的实现:可能还有其他一些我想念的.

In addition to these, which are built in to allFit.R, you can use the COBYLA or subplex optimizers from nloptr: see ?nloptwrap. There's another implementation of subplex in the subplex package: there may be a few others I've missed.

这篇关于LMER的替代优化算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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