glmer model from early 2013: warning message about convergence when re-running it

坚强是说给别人听的谎言 提交于 2019-12-06 08:58:06

问题


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 

...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) (I'm much more concerned about this one)

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)

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.


回答1:


(Upgraded from a comment)

  • 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")

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

  • 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.



来源:https://stackoverflow.com/questions/23814130/glmer-model-from-early-2013-warning-message-about-convergence-when-re-running-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!