r - 错误(功能(优化程序=“bobyqa”,restart_edge = TRUE,border.tol = 1e-05))

标签 r optimization lme4

我正在尝试运行具有glmm系列的gaussian(),以将数据作为响应变量进行计数,将对数转换后的变量作为固定因子进行计数,以及嵌套的随机效应:

firsttry<-glmer(spm~logterrisize + (1|studyarea/teriid),
     data = Data_table_for_analysis_Character_studyarea,
     family = gaussian(), 
            control=glmerControl(optimizer="bobyqa",
                            optCtrl=list(maxfun=3e11)))


然后我收到此错误消息:


错误(功能(优化程序=“ bobyqa”,restart_edge = TRUE,border.tol = 1e-05 、:未使用的参数(tolPwrss = 1e-07,compDev = TRUE,nAGQ0initStep = TRUE,checkControl = list(“忽略”,“ stop“,” ignore“,” stop“,” stop“,” message + drop.cols“,” warning“,” stop“,” stop“),checkConv = list(list(” warning“,0.001,NULL) ,list(“ ignore”,1e-04),list(“ warning”,1e-06)))


不幸的是,即使经过长时间的互联网搜索,我仍然不知道我应该如何处理该消息。我尝试使用该优化工具或排除了一些优化工具,但错误消息仍然相同。

有关更多信息,这些是数据:





show(spm)[1] 18.461538 22.641509 35.172414 10.418006 15.611285  3.482143  3.692308  4.483986  4.821429 [10]  6.000000  6.122449  6.176471  6.220736  6.260870  6.593407  7.010309  9.200000  9.473684 [19]  9.600000 12.600000 14.200000 16.146179 28.125000 30.099010 13.731343 14.432990 11.089109 [28] 17.960526 32.903226  8.955224 33.311688  8.800000 11.578947 20.000000 14.455446 18.181818 [37] 28.064516 25.684211 17.866667 23.142857 18.208955 20.536913 11.419355 11.593220 12.703583 [46] 20.000000  3.600000 11.320755  6.200000  6.575342 12.800000 19.109589 20.124224 22.941176 [55]  4.600000  6.600000  6.771160  8.000000 19.200000 19.400000 22.773723  3.333333  4.214047 [64]  5.106383 10.200000 12.240803  9.600000 15.789474  6.600000 13.333333 14.400000 30.000000 [73]  7.400000  8.400000  9.000000  9.709544 10.752688 15.800000  8.000000  9.729730 12.200000 [82] 16.909091 20.400000  4.000000  4.909091  5.217391  7.200000  9.800000  0.000000  4.166667

 show(logterrisize) [1] 1.3317643 1.3317643 1.3317643 0.1295798 0.1295798 1.5051368 1.5051368 1.5051368 1.5051368 [10] 1.5051368 1.5051368 1.5051368 1.5051368 1.5051368 1.5051368 1.5051368 1.5051368 1.5051368 [19] 1.5051368 1.5051368 1.5051368 1.4665993 1.4665993 1.4665993 1.8282328 1.8282328 1.9252934 [28] 1.9252934 1.9252934 2.3006582 2.3006582 2.5160920 2.7774040 2.7774040 3.3398623 3.3398623 [37] 3.4759297 1.2563594 1.6061204 1.6061204 1.7835139 1.7835139 2.1669498 2.1669498 2.1669498 [46] 2.1669498 0.7264997 0.7458155 0.8380524 0.8380524 0.8380524 0.8380524 0.8380524 0.8380524 [55] 1.1312118 1.7132464 1.7132464 1.7132464 1.7132464 1.7132464 1.7132464 2.0356960 2.0356960 [64] 2.0356960 2.0356960 2.0356960 2.1590311 2.1590311 0.5235444 0.5235444 0.5235444 0.5235444 [73] 0.6852007 0.6852007 0.6852007 0.6852007 0.6852007 0.6852007 1.2990139 1.2990139 1.2990139 [82] 1.2990139 1.2990139 1.5508422 1.5508422 1.5508422 1.5508422 1.5508422 1.1570730 1.1570730

show(teriid)[1]  2  2  2 79 79 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 24 24 24 27 27 21 21 21 23 23 26 [33] 22 22 20 20 19 38 40 40 39 39 35 35 35 35 53 56 55 55 55 55 55 55 57 54 54 54 54 54 54 58 58 58 [65] 58 58 60 60 86 86 86 86 50 50 50 50 50 50 48 48 48 48 48 47 47 47 47 47 51 51 51 51 51 51 51 51


StudyID包含研究站点的特殊ID。所有变量具有相同的行数。
抱歉,如果缺少某些信息,但如果需要,我将上传更多数据。

最佳答案

tl; dr是的,这看起来像minqa::bobyqa中的错误/烦扰。

我能够找到一个可重现的示例,并显示当maxfun大于可以用长整数表示的最大值(在大多数计算机上为32位带符号:.Machine$integer.max = 2147483647)时,会出现警告。除非出现严重错误,否则20亿个优化步骤就足够了(除了其他事情,如果这样的优化能够在合理的时间内完成,我会感到惊讶)。

library(lme4)
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
             data = cbpp, family = binomial)
imax <- .Machine$integer.max ## 2147483647
tryfun <- function(n) {
    gm2 <- try(update(gm1, control=glmerControl(optimizer="bobyqa",
                                                optCtrl=list(maxfun=n))),
               silent=TRUE)
    if (inherits(gm2,"try-error")) return(rep(NA,4))
    return(fixef(gm2))
}

tryfun(imax)
## (Intercept)     period2     period3     period4 
##  -1.3983316  -0.9919238  -1.1282144  -1.5797501 

tryfun(imax+1)
## (Intercept)     period2     period3     period4 
##  -1.4045886  -0.9349341  -1.0712274  -1.5124660 


如果不进一步研究,我不确定出现此问题时实际上会使用什么maxfun值,但我怀疑它很小。第二个调用产生:


警告信息:
1:在(函数(par,fn,lower = -Inf,upper = Inf,control = list(),:
通过强制将NA引入整数范围
2:在optwrap(优化程序,devfun,开始,rho $ lower,control = control 、:
bobyqa的收敛代码1:bobyqa-超出最大功能评估数
3:在(函数(par,fn,lower = -Inf,upper = Inf,control = list(),:
通过强制将NA引入整数范围
4:在optwrap(优化程序,devfun,开始,rho $ lower,control = control 、:
bobyqa的收敛代码1:bobyqa-超出最大功能评估数
5:在checkConv(attr(opt,“ derivs”),opt $ par,ctrl = control $ checkConv,中:
模型无法与max | grad |收敛= 3.26758(tol = 0.001,组件1)

关于r - 错误(功能(优化程序=“bobyqa”,restart_edge = TRUE,border.tol = 1e-05)),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53031300/

相关文章:

r - 如果横向太长,Bookdown 图标题会失败?

ios - 从给定值的字典中删除键

lmer 模型拟合的 R 平方

r - 更适合线性模型

javascript - 当绘制的数据被更改时,在 R 中更新而不重新创建小部件

r - 如何在R中使用正确的(中文)编码下载网页文本

r - 自定义 Xgboost 超参数调整

algorithm - 优化有向无环图中的连接查询

java - 整个程序中的独特任务

r - 查看序数 CLMM 模型中每个级别的系数