2013年初的glmer模型:重新运行时有关收敛的警告消息 [英] glmer model from early 2013: warning message about convergence when re-running it

查看:628
本文介绍了2013年初的glmer模型:重新运行时有关收敛的警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一年多以前(2013年2月),我使用lmer运行包含以下项的二项式结果的混合效应模型:

More than 1 year ago (Feb 2013), I had used lmer to run a mixed effect model involving a binomial outcome with the following command:

nl3.lmer <- glmer( cul.bi ~ food.act + where + intlan + inter.cul + via.m + via.h + (1|Id), data=drm, family=binomial)

一切正常,没有任何错误或警告消息,我已经介绍了我的结果.今天,当尝试查看它时,我遇到了两个问题:

Everything had worked fine, without any error or warning messages and I had presented my results. When trying to look at it today I ran into two problems:

1)

summary(nl3.lmer)
Length  Class   Mode 
     1    mer     S4 

...而不是通常的摘要.
是因为类从mer对象更改为merMod对象吗?我在lme4软件包更新的说明中读到了有关此更改的内容,但我想再次检查是否确实是这种情况....如果是,summary是否有一种简单的方法可以读取mer对象?

...instead of the usual summary.
Is it because of the change of class from a mer object to a merMod object? I read something about that change in the description of the lme4 package updates, but I want to double check this is indeed the case.... If it is, is there an easy way for summary to be able to read a mer object?

2)(我对此更加关注)

2) (I'm much more concerned about this one)

因为我再也无法使用旧的nl3.lmer对象,所以我决定重新运行相同的模型.

Because I couldn't use my old nl3.lmer object anymore I decided to just rerun the same model.

mod <- glmer( cul.bi ~ food.act + where + intlan + inter.cul + via.m + via.h + (1|id), data=drm, family=binomial)
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 1.09141 (tol = 0.001)

我有点惊慌.这是否意味着我去年报告的模型实际上不是好"的(抱歉,缺少更好的统计限定词)?简单来说,实际上是什么意思? 这是该模型的summary:

I'm a little bit alarmed. Does that mean that the model I had reported last year was actually not "good" (sorry for the lack of a better statistical qualifier)? What does it mean actually, in simple terms? Here's the summary of that model:

Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial ( logit )
Formula: cul.bi ~ food.act + where + intlan + inter.cul + via.m + via.h +      (1 | id)
   Data: drm

     AIC      BIC   logLik deviance df.resid 
   522.0    582.3   -247.0    494.0      537 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.6076 -0.4533  0.1179  0.4038  4.4283 

Random effects:
 Groups Name        Variance Std.Dev.
 id     (Intercept) 2.626    1.62    
Number of obs: 551, groups: id, 101

Fixed effects:
                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)         1.9401     1.6664   1.164 0.244317    
food.actYes         0.7533     0.3250   2.318 0.020455 *  
whereschool        -1.5370     0.4127  -3.724 0.000196 ***
wherework          -1.2763     0.7957  -1.604 0.108701    
whereother         -1.1453     0.3749  -3.055 0.002249 ** 
intlanher           3.1935     0.8812   3.624 0.000290 ***
intlanbil           0.9765     0.5805   1.682 0.092555 .  
intlanno int       -0.6395     0.5910  -1.082 0.279268    
inter.culher        2.5482     0.5020   5.076 3.86e-07 ***
inter.culher-main   1.2225     0.4588   2.664 0.007713 ** 
inter.culno int     1.2966     0.6076   2.134 0.032845 *  
via.m              -0.8063     0.2441  -3.304 0.000954 ***
via.h               0.4862     0.2003   2.428 0.015183 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) fd.ctY whrsch whrwrk whrthr intlnh intlnb intlni intr.c intr.- intr.i via.m 
food.actYes -0.091                                                                             
whereschool -0.100  0.143                                                                      
wherework   -0.050  0.103  0.233                                                               
whereother  -0.129  0.179  0.420  0.256                                                        
intlanher   -0.065  0.078  0.019  0.052 -0.037                                                 
intlanbil   -0.053  0.086  0.061 -0.068  0.046  0.072                                          
intlannoint -0.055 -0.012  0.104  0.055  0.137  0.051  0.073                                   
inter.culhr -0.120  0.063 -0.017  0.050  0.022  0.017  0.048  0.024                            
intr.clhr-m -0.118  0.079 -0.155 -0.193 -0.094 -0.011 -0.040 -0.027  0.432                     
intr.clnint -0.049  0.103  0.047  0.036 -0.010  0.048  0.046 -0.745  0.335  0.361              
via.m       -0.596 -0.103  0.083 -0.010  0.084 -0.074  0.037  0.056 -0.034 -0.024 -0.065       
via.h       -0.391  0.119 -0.104  0.006 -0.075  0.126 -0.036 -0.038  0.033  0.031  0.015 -0.469

我很乐意提供一个可重复的示例,但恐怕它并不能真正反映我的问题. 并且在有用的情况下:

I would have been happy to provide a reproducible example, but I'm afraid it wouldn't really mirror my issue. And in case it's useful:

sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: i686-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8       
 [4] LC_COLLATE=en_CA.UTF-8     LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
 [1] parallel  splines   grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] RColorBrewer_1.0-5 glmmML_1.0         ggplot2_0.9.3.1    pbkrtest_0.3-8     mvoutlier_2.0.4   
 [6] sgeostat_1.0-25    HLMdiag_0.2.5      plyr_1.8.1         prettyR_2.0-7      languageR_1.4.1   
[11] msm_1.3            e1071_1.6-3        nlme_3.1-117       MASS_7.3-33        nnet_7.3-8        
[16] car_2.0-19         effects_3.0-0      colorspace_1.2-4   Hmisc_3.14-4       Formula_1.1-1     
[21] survival_2.37-7    lattice_0.20-29    lmerTest_2.0-6     lme4_1.1-6         Rcpp_0.11.1       
[26] Matrix_1.1-3      

loaded via a namespace (and not attached):
 [1] bitops_1.0-6          caTools_1.17          class_7.3-10          cluster_1.15.2       
 [5] DEoptimR_1.0-1        dichromat_2.0-0       digest_0.6.4          expm_0.99-1.1        
 [9] gdata_2.13.3          gplots_2.13.0         gtable_0.1.2          gtools_3.4.0         
[13] KernSmooth_2.23-12    labeling_0.2          latticeExtra_0.6-24   minqa_1.2.3          
[17] munsell_0.4.2         mvtnorm_0.9-99992     numDeriv_2012.9-1     pcaPP_1.9-49         
[21] pls_2.4-3             proto_0.3-10          RcppEigen_0.3.2.1.2   reshape2_1.2.2       
[25] robCompositions_1.8.0 robustbase_0.91-1     rrcov_1.3-4           scales_0.2.3         
[29] stats4_3.1.0          stringr_0.6.2         tools_3.1.0   

在此先感谢您提供的帮助.

Thank you in advance for any help you can offer.

推荐答案

(从评论升级)

  • the class of objects produced by glmer has indeed changed (from mer to merMod). You can install a back-compatibility lme4.0 package from http://lme4.r-forge.r-project.org/repos :
install.packages("lme4.0",repos="http://lme4.r-forge.r-project.org/repos")

,请参见?convert_old_lme4中的实用程序功能来转换保存的模型拟合,以便您可以在lme4.0中使用它.

and see ?convert_old_lme4 for a utility function to convert the saved model fit so you can use it in lme4.0.

  • 您的收敛警告几乎肯定是假阳性:请参见此邮件列表线程此Github问题的末尾.您可以从Github(通过devtools::install_github("lme4","lme4"))或上面列出的存储库安装开发版本,也可以尝试以下操作:
  • Your convergence warning is almost certainly a false positive: see this mailing list thread or the tail end of this Github issue. You can either install the development version from Github (via devtools::install_github("lme4","lme4")) or the repository listed above, or just try this:
relgrad <- with(mixmod1@optinfo$derivs, solve(Hessian, gradient))
max(abs(relgrad))

看看缩放的梯度是否很小.

and see if the scaled gradient is small.

这篇关于2013年初的glmer模型:重新运行时有关收敛的警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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