lme4 1.1-27.1 错误:pwrssUpdate 未在 (maxit) 迭代中收敛

发布于 2025-01-18 16:15:26 字数 632 浏览 4 评论 0原文

抱歉,这个错误之前已经讨论过,stackoverflow 上的每个答案似乎都特定于

我尝试在 lme4 中运行以下负二项式模型的数据:

Model5.binomial<-glmer.nb(countvariable ~ waves + var1 + dummycodedvar2 + dummycodedvar3 + (1|record_id), data=datadfomit) 

但是,在尝试运行模型时收到以下错误:

Error in f_refitNB(lastfit, theta = exp(t), control = control) :pwrssUpdate did not converge in (maxit) iterations

我首先运行模型只有 3 个预测变量(waves、var1、dummycodedvar2)并得到相同的错误。但将预测变量集中解决了这个问题,并且模型运行良好。

现在有 4 个变量(全部居中),我预计模型能够顺利运行,但再次收到错误。

由于该网站上的每个答案似乎都指向数据中的问题,因此可以在此处找到复制该问题的数据:

https://file.io/3vtX9RwMJ6LF

Sorry that this error has been discussed before, each answer on stackoverflow seems specific to the data

I'm attempting to run the following negative binomial model in lme4:

Model5.binomial<-glmer.nb(countvariable ~ waves + var1 + dummycodedvar2 + dummycodedvar3 + (1|record_id), data=datadfomit) 

However, I receive the following error when attempting to run the model:

Error in f_refitNB(lastfit, theta = exp(t), control = control) :pwrssUpdate did not converge in (maxit) iterations

I first ran the model with only 3 predictor variables (waves, var1, dummycodedvar2) and got the same error. But centering the predictors fixed this problem and the model ran fine.

Now with 4 variables (all centered) I expected the model to run smoothly, but receive the error again.

Since every answer on this site seems to point towards a problem in the data, data that replicates the problem can be found here:

https://file.io/3vtX9RwMJ6LF

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尹雨沫 2025-01-25 16:15:27

您的响应变量有很多零:

在此处输入图像描述

我建议拟合一个考虑到这一点的模型,例如零膨胀模型。 GLMMadaptive 包可以拟合零膨胀负二项式混合效应模型:

## library(GLMMadaptive)
## mixed_model(countvariable ~ waves + var1 + dummycodedvar2 + dummycodedvar3, ##   random = ~ 1 | record_id, data = data,
##   family = zi.negative.binomial(), 
##   zi_fixed = ~ var1,
##   zi_random = ~ 1 | record_id) %>% summary()

Random effects covariance matrix:
                StdDev    Corr
(Intercept)     0.8029        
zi_(Intercept)  1.0607 -0.7287

Fixed effects:
               Estimate Std.Err z-value  p-value
(Intercept)      1.4923  0.1892  7.8870  < 1e-04
waves           -0.0091  0.0366 -0.2492 0.803222
var1             0.2102  0.0950  2.2130 0.026898
dummycodedvar2  -0.6956  0.1702 -4.0870  < 1e-04
dummycodedvar3  -0.1746  0.1523 -1.1468 0.251451

Zero-part coefficients:
            Estimate Std.Err z-value    p-value
(Intercept)   1.8726  0.1284 14.5856    < 1e-04
var1         -0.3451  0.1041 -3.3139 0.00091993

log(dispersion) parameter:
  Estimate Std.Err
    0.4942  0.2859

Integration:
method: adaptive Gauss-Hermite quadrature rule
quadrature points: 11

Optimization:
method: hybrid EM and quasi-Newton
converged: TRUE 

Your response variable has a lot of zeros:

enter image description here

I would suggest fitting a model that takes account of this, such as a zero-inflated model. The GLMMadaptive package can fit zero-inflated negative binomial mixed effects models:

## library(GLMMadaptive)
## mixed_model(countvariable ~ waves + var1 + dummycodedvar2 + dummycodedvar3, ##   random = ~ 1 | record_id, data = data,
##   family = zi.negative.binomial(), 
##   zi_fixed = ~ var1,
##   zi_random = ~ 1 | record_id) %>% summary()

Random effects covariance matrix:
                StdDev    Corr
(Intercept)     0.8029        
zi_(Intercept)  1.0607 -0.7287

Fixed effects:
               Estimate Std.Err z-value  p-value
(Intercept)      1.4923  0.1892  7.8870  < 1e-04
waves           -0.0091  0.0366 -0.2492 0.803222
var1             0.2102  0.0950  2.2130 0.026898
dummycodedvar2  -0.6956  0.1702 -4.0870  < 1e-04
dummycodedvar3  -0.1746  0.1523 -1.1468 0.251451

Zero-part coefficients:
            Estimate Std.Err z-value    p-value
(Intercept)   1.8726  0.1284 14.5856    < 1e-04
var1         -0.3451  0.1041 -3.3139 0.00091993

log(dispersion) parameter:
  Estimate Std.Err
    0.4942  0.2859

Integration:
method: adaptive Gauss-Hermite quadrature rule
quadrature points: 11

Optimization:
method: hybrid EM and quasi-Newton
converged: TRUE 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文