带有 lme4 的混合模型无法与 max|grad|

问题描述 投票:0回答:1

当我运行模型 lme4 时,我得到了这个错误信息,但仍然可以得到摘要。我的数据集如下:分类响应是 object_case(binary: nominative (marked as 1) and partitive (0));随机效应因子为verb_lemma;解释变量是数字(单数或复数)、生命(有生命、无生命或人)、顺序(VO 或 OV)、时态(现在或过去)、结果性(是或否)和有界性(是或否)。dataset 我的代码如下:

m2 = glmer(object_case ~ number + animacy + order + tense + resultativity + 
             boundedness + (1|verb_lemma), data = my_dataset, family=binomial(link = "logit"))

但是,我收到了这样的警告

Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 1.26418 (tol = 0.002, component 1)

但我仍然可以得到摘要

> summary(m2)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: object_case ~ Arv + Elusus + Järjekord + Aeg + piiritletus_s +      piiritletus_o + (1 | verb_lemma)
   Data: lra

     AIC      BIC   logLik deviance df.resid 
   148.7    183.3    -65.4    130.7      336 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-0.71743 -0.00001  0.00004  0.00723  0.75621 

Random effects:
 Groups     Name        Variance Std.Dev.
 verb_lemma (Intercept) 218.5    14.78   
Number of obs: 345, groups:  verb_lemma, 171

Fixed effects:
                           Estimate Std. Error z value Pr(>|z|)    
(Intercept)                 -16.411      8.946  -1.834   0.0666 .  
ArvMitmus                    -1.223      1.405  -0.871   0.3839    
ElususEluta                  -9.782      7.993  -1.224   0.2210    
ElususInimene               -12.344      8.615  -1.433   0.1519    
JärjekordVO                  -1.281      1.853  -0.691   0.4893    
AegOlevik                    -0.375      1.530  -0.245   0.8064    
piiritletus_sPiiritlematud   21.882      5.074   4.312 1.61e-05 ***
piiritletus_oPiiritlematud   15.440      2.768   5.577 2.44e-08 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) ArvMtm ElssEl ElssIn JrjkVO AgOlvk prtlts_sP
ArvMitmus   -0.210                                             
ElususEluta -0.760  0.227                                      
ElususInimn -0.735  0.188  0.979                               
JärjekordVO -0.402  0.154  0.441  0.436                        
AegOlevik   -0.380 -0.119  0.272  0.295  0.070                 
prtlts_sPrt -0.307 -0.160 -0.324 -0.335 -0.321  0.156          
prtlts_Prtl -0.139  0.033 -0.395 -0.432  0.005 -0.095  0.565   
optimizer (Nelder_Mead) convergence code: 0 (OK)
Model failed to converge with max|grad| = 1.18052 (tol = 0.002, component 1)

Warning message:
In abbreviate(rn, minlength = 6) : abbreviate不适用于非ASCII字元
> lra <- read.csv(file.choose())
> m2 = glmer(object_case ~ number + animacy + order + tense + resultativity + 
+              boundedness + (1|verb_lemma), data = lra, family=binomial(link = "logit"))
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 1.26418 (tol = 0.002, component 1)
> summary(m2)
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: object_case ~ number + animacy + order + tense + resultativity +      boundedness + (1 | verb_lemma)
   Data: lra

     AIC      BIC   logLik deviance df.resid 
   148.4    183.0    -65.2    130.4      336 

Scaled residuals: 
     Min       1Q   Median       3Q      Max 
-0.73592  0.00000  0.00005  0.00844  0.77798 

Random effects:
 Groups     Name        Variance Std.Dev.
 verb_lemma (Intercept) 221.6    14.89   
Number of obs: 345, groups:  verb_lemma, 171

Fixed effects:
                 Estimate Std. Error z value Pr(>|z|)    
(Intercept)      -26.1970     9.7317  -2.692   0.0071 ** 
numbersingular     1.1154     1.3319   0.837   0.4023    
animacyeluta      -2.6822     5.0778  -0.528   0.5973    
animacyinimene    -5.0652     5.4291  -0.933   0.3508    
orderVO           -0.8986     1.5268  -0.589   0.5562    
tensepresent      -0.2413     1.4865  -0.162   0.8710    
resultativityyes  22.8050     5.0525   4.514 6.37e-06 ***
boundednessyes    15.6020     2.6845   5.812 6.18e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) nmbrsn anmcyl anmcyn ordrVO tnsprs rslttv
numbersnglr -0.105                                          
animacyelut -0.791 -0.072                                   
animacyinmn -0.739 -0.022  0.947                            
orderVO     -0.111 -0.121  0.057  0.068                     
tensepresnt -0.331  0.134  0.262  0.304  0.043              
reslttvtyys -0.872  0.148  0.459  0.402 -0.094  0.253       
bounddnssys -0.568 -0.037  0.114  0.023  0.127 -0.034  0.651
optimizer (Nelder_Mead) convergence code: 0 (OK)
Model failed to converge with max|grad| = 1.26418 (tol = 0.002, component 1)

我的主要问题是

  1. 警告信息的含义
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 1.26418 (tol = 0.002, component 1)
  1. 我能去掉这个警告信息吗?如果我收到这个错误,摘要有什么意义吗? 提前谢谢你!
r logistic-regression lme4
1个回答
0
投票

这可能更像是一个 CrossValidated 问题,但这里的问题几乎可以肯定是基线水平中主格(1-结果)结果的流行率非常低,正如一个模型中的截距估计 -16 和 - 26 在另一个中,以及一些其他参数的相应大值。这很可能是 (准)完全分离 的情况,您可以阅读 CrossValidated 或其他地方。一般来说,逻辑回归中绝对值 >10 的参数估计是这种现象的危险信号(前提是您的预测变量是分类变量或合理缩放的数值变量)。

  • 模型的一般结论是可能OK
  • 您可以通过似然比检验或配置文件置信区间获得更可靠的 p 值/CIs
  • 对于它的价值,在
    glmmTMB
    中运行相同的模型并使用
    diagnose()
    函数可能会给你一个类似的答案。
  • ?lme4::troubleshooting
    和网络上的其他地方所示,对您是否应该关注收敛警告的蛮力检查是使用
    allFit()
    并查看使用各种不同优化器的结果是否与您的目的足够相似.
© www.soinside.com 2019 - 2024. All rights reserved.