Nava
Nava

Reputation: 3

glmer mixed models inconsistent between lme4 updates

This is a long post. I’m having trouble attaining consistent model results between lme4 versions. My old computer was running R 3.0.0 “Masked Marvel”, with the 0.999999-2 version of lme4, and my new work computer is running R 3.0.2 “Frisbee Sailing” with lme4 version 1.1-2. They are not giving me the same model outputs. Omitting the new lme4, I installed every package update on my old laptop one-by-one and ran the models. Then, updated R itself and ran the models. Finally, I made further updates to packages for R 3.0.2, and ran the models once more. They remained consistent with the original analysis. I wasn’t able to run the models with the most recent MASS package with R 3.0.0, and with the most recent nlme package in R 3.0.2. The error message I received in those cases was the same, and is below: “Error in validObject(.Object) : invalid class “mer” object: Slot L must be a monotonic LL' factorization of size dims['q']”

I’m wondering if someone can help shed light on this before I update to lme4 1.1-2 to complete my analyses. There doesn’t appear to be a changelog at the address linked in R Studio…http://cran.rstudio.com/web/packages/lme4/NEWS

Maybe something else has changed on my end? I’ve been using the same datafile, and setting it up the same within R.

I am not sure how to attach data, or how to make this easiest for you all to run through yourselves. I can do that with some instruction. Below are the outputs for 2 models before the updates, and the same models after. The variation occurs in models that I haven't included here as well, some worse than others. It definitely affects an AIC ranking.

lme4 version 0.999999-2 R version 3.0.0 (2013-04-03) -- "Masked Marvel"

at1500o <- glmer(apred ~ 
                 (1 | fFarm) + (1 | Eps) + (1 | fExp),
                 family = binomial,
                 data = PU3.atristis)                
summary(at1500o)

Number of levels of a grouping factor for the random effects
is *equal* to n, the number of observations
Warning message: In mer_finalize(ans) : false convergence (8)

Generalized linear mixed model fit by the Laplace approximation 
Formula: apred ~ (1 | fFarm) + (1 | Eps) + (1 | fExp) 
   Data: PU3.atristis 
   AIC      BIC     logLik      deviance
   182.2    193     -87.11      174.2
Random effects:
 Groups      Name           Variance    Std.Dev.  
 Eps        (Intercept)     1.6630e+01  4.0780e+00
 fFarm      (Intercept)     2.4393e+00  1.5618e+00
 fExp       (Intercept)     5.8587e-13  7.6542e-07
Number of obs: 110, groups: Eps, 110; fFarm, 17; fExp, 2

Fixed effects:
                Estimate  Std. Error  z value   Pr(>|z|)    
(Intercept)     -6.1406     0.7126    -8.618   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

False convergence didn’t seem to be a problem

at1500a <- glmer(apred ~ 
                      pctfield1500 * factor(SiteTrt) +
                      (1 | fFarm) + (1 | Eps) + (1 | fExp),
                    family = binomial,
                    data = PU3.atristis)                
summary(at1500a)

Number of levels of a grouping factor for the random effects
is *equal* to n, the number of observations
Warning message: In mer_finalize(ans) : false convergence (8)

Generalized linear mixed model fit by the Laplace approximation 
Formula: apred ~ pctfield1500 + factor(SiteTrt) + pctfield1500:factor(SiteTrt) + (1 | fFarm) + (1 | Eps) + (1 | fExp) 
   Data: PU3.atristis 

   AIC      BIC     logLik      deviance
   185.2    209.5   -83.59      167.2

Random effects:
 Groups     Name            Variance    Std.Dev.  
 Eps        (Intercept)     2.4539e+01  4.95370375
 fFarm      (Intercept)     8.1397e-01  0.90220336
  fExp      (Intercept)     1.3452e-08  0.00011598
Number of obs: 110, groups: Eps, 110; fFarm, 17; fExp, 2

Fixed effects:
                               Estimate  Std. Error  z value  Pr(>|z|)   
(Intercept)                    -6.82245    2.64044    -2.584   0.00977 **
pctfield1500                   -0.01041    0.10849    -0.096   0.92353   
factor(SiteTrt)2               2.47654     3.97069     0.624   0.53282   
factor(SiteTrt)3               4.33391     4.65551     0.931   0.35190   
pctfield1500:factor(SiteTrt)2  -0.05073    0.13117    -0.387   0.69895   
pctfield1500:factor(SiteTrt)3  -0.05729    0.14524    -0.394   0.69323   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
                (Intr)  pc1500    f(ST)2   f(ST)3  p1500:(ST)2
pctfild1500         -0.876                                 
fctr(StTr)2     -0.665  0.582                          
fctr(StTr)3     -0.571  0.504     0.380                   
p1500:(ST)2     0.724   -0.827   -0.850   -0.417            
p1500:(ST)3     0.654   -0.747   -0.435   -0.887    0.618

Lme4 version 1.1-2 R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"

at1500o <- glmer(apred ~ 
                 (1 | fFarm) + (1 | Eps) + (1 | fExp),
                 family = binomial,
                 data = PU3.atristis)                
summary(at1500o)

Generalized linear mixed model fit by maximum likelihood ['glmerMod']
 Family: binomial ( logit )
Formula: apred ~ (1 | fFarm) + (1 | Eps) + (1 | fExp) 
   Data: PU3.atristis 

      AIC           BIC         logLik      deviance 
      236.8296      247.6316    -114.4148   228.8296 

Random effects:
 Groups      Name           Variance    Std.Dev. 
 Eps        (Intercept)     4.799e+01   6.927e+00
 fFarm      (Intercept)     6.542e-01   8.088e-01
 fExp       (Intercept)     6.056e-10   2.461e-05
Number of obs: 110, groups: Eps, 110; fFarm, 17; fExp, 2

Fixed effects:
             Estimate     Std. Error     z value   Pr(>|z|)    
(Intercept)   -7.975        1.115        -7.154   8.43e-13 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

No warnings anymore, but everything is pretty different. The model fit statement has changed from the Laplace approximation, to maximum likelihood [‘glmerMod’].

at1500a <- glmer(apred ~ 
                      pctfield1500 * factor(SiteTrt) +
                      (1 | fFarm) + (1 | Eps) + (1 | fExp),
                    family = binomial,
                    data = PU3.atristis)                
summary(at1500a)

Generalized linear mixed model fit by maximum likelihood ['glmerMod']
 Family: binomial ( logit )
Formula: apred ~ pctfield1500 + factor(SiteTrt) + pctfield1500:factor(SiteTrt) + (1 | fFarm) + (1 | Eps) + (1 | fExp) 
   Data: PU3.atristis 

      AIC           BIC         logLik      deviance 
      242.7874      267.0917    -112.3937   224.7874 

Random effects:
 Groups     Name            Variance    Std.Dev. 
 Eps        (Intercept)     3.346e+01   5.784e+00
 fFarm      (Intercept)     1.809e-07   4.253e-04
 fExp       (Intercept)     4.380e-11   6.618e-06
Number of obs: 110, groups: Eps, 110; fFarm, 17; fExp, 2

Fixed effects:
                              Estimate  Std. Error  z value   Pr(>|z|)  
(Intercept)                   -7.46800      3.04197     -2.455    0.0141 *
pctfield1500                   0.00032      0.12301     0.003     0.9979  
factor(SiteTrt)2               2.05618      4.57444     0.450     0.6531  
factor(SiteTrt)3               6.72139      5.20895     1.290     0.1969  
pctfield1500:factor(SiteTrt)2 -0.04882      0.14911     -0.327    0.7434  
pctfield1500:factor(SiteTrt)3 -0.11324      0.16495     -0.686    0.4924  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr)  pc1500    f(ST)2   f(ST)3  p1500:(ST)2
pctfild1500 -0.875                                 
fctr(StTr)2 -0.665  0.582                          
fctr(StTr)3 -0.584  0.511     0.388                   
p1500:(ST)2 0.722   -0.825   -0.850   -0.422            
p1500:(ST)3 0.653   -0.746   -0.434   -0.886    0.615 

Cheers, Nava

Upvotes: 0

Views: 3676

Answers (1)

Marius
Marius

Reputation: 60080

Version 1.0 of the lme4 package marked a major change, with a pretty substantial rework of the underlying fitting code. From the changelog:

Because the internal computational machinery has changed, results from the newest version of lme4 will not be numerically identical to those from previous versions. For reasonably well- defined fits, they will be extremely close (within numerical tolerances of 1e-4 or so), but for unstable or poorly-defined fits the results may change, and very unstable fits may fail when they (apparently) succeeded with previous versions. Similarly, some fits may be slower with the new version, although on average the new version should be faster and more stable. More numerical tuning options are now available (see below); non-default settings may restore the speed and/or ability to fit a particular model without an error. If you notice significant or disturbing changes when fitting a model with the new version of lme4, please notify the maintainers.

Considering your model fits using the 0.9999 version of lme4 produced false convergence warnings, your model might be in the "unstable fits" category this is talking about.

Upvotes: 2

Related Questions