3
$\begingroup$

I ran a mixed effects model a few weeks ago, it all went fine, no errors. Here is the model:

logRT ~ condition * NumSpk * Group + (condition * NumSpk | Participant)

I tried to run now the exact same model - and I get a singular fit message. I didn't change anything, simply ran it again. I tried several times - I get this singular fit message every time.

When I observe the correlation matrix of the random effects - nothing changed between last time and this time. To my understanding, a singular fit would also reflect in correlations near +1 or -1. This is not the case, not then and not now. Here is the correlation matrix:

Random effects:
 Groups      Name                               Variance  Std.Dev. Corr                         
 Participant (Intercept)                        0.0066121 0.08131                               
             conditiondivided_vs_mean           0.0004034 0.02008  -0.48                        
             NumSpk2-1                          0.0004550 0.02133  -0.16  0.15                  
             NumSpk3-2                          0.0001917 0.01385  -0.68 -0.13  0.47            
             conditiondivided_vs_mean:NumSpk2-1 0.0001640 0.01281  -0.49  0.32  0.41  0.60      
             conditiondivided_vs_mean:NumSpk3-2 0.0004466 0.02113   0.11  0.02  0.41 -0.02  0.45
 Residual                                       0.0156130 0.12495                               
Number of obs: 11088, groups:  Participant, 69

Anyone has any idea what went wrong? Why did I get now this singular fit message?

EDITS:

  1. A picture of the message: enter image description here
  2. A link to the R data frame on which I run the model: https://drive.google.com/open?id=1qBOPjEk6oHv33OUyfObzOuJHmGNhvU8a
$\endgroup$
9
  • $\begingroup$ Exactly what does the message state? $\endgroup$
    – whuber
    Commented Feb 13, 2019 at 14:36
  • $\begingroup$ Just a red message that says "singular fit". In the summary of the model it also appears in the bottom (convergence code: 0, singular fit). $\endgroup$
    – Galit
    Commented Feb 13, 2019 at 14:46
  • 1
    $\begingroup$ The estimated variances are quite low, so it is perhaps questionable whether the data supports those random effects. What is the scale of the numeric variables ? Rescaling might help. $\endgroup$ Commented Feb 13, 2019 at 16:45
  • 1
    $\begingroup$ Please post a link to your data. Anonymise it first if you need to. You should get some decent answers then. Otherwise people can only guess. $\endgroup$ Commented Feb 14, 2019 at 8:08
  • 1
    $\begingroup$ @RobertLong, Thank you. You are absolutely right, I'd be happy if anyone could take a look. This is the link to an R data frame, the input to the model stated in the question: drive.google.com/file/d/1qBOPjEk6oHv33OUyfObzOuJHmGNhvU8a/… $\endgroup$
    – Galit
    Commented Feb 15, 2019 at 12:14

1 Answer 1

1
$\begingroup$

I suspect that this may be due to the version of lme4 that you are using. I do not get the the warning. The random effects are estimated slightly differently so it hard to say if your warning is a false positive or not - I suspect that it is, and that the difference in the estimates is due to a different version, since they are very close.

As mentioned in my comment in the question, the variances of the random effects are very small, and I see very little advantage in fitting random slopes. I fitted the model without random slopes and found the fixed effects estimates almost unchanged. Also, a likelihood ratio test shows that the reduced model is indeed preferred.

Here is my relevantsessionInfo():

R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] emmeans_1.3.2      bindrcpp_0.2.2     dplyr_0.7.6        lme4_1.1-18-1      Matrix_1.2-15      deming_1.3        
 [7] rugarch_1.4-1      tfestimators_1.9.1 htmltools_0.3.6    DT_0.4             ggthemes_4.0.1     ggplot2_3.1.0     
[13] shiny_1.1.0        magrittr_1.5       rvest_0.3.2        xml2_1.2.0         gbm_2.1.3          lattice_0.20-38   
[19] survival_2.43-3    RPostgreSQL_0.6-2  DBI_1.0.0          jsonlite_1.5      

And here is the output from fitting the full model and running summary():

> lmm1 <- lmer(logRT ~ condition * NumSpk * Group + (condition * NumSpk | Participant), data = Bar_data_RT)
> summary(lmm1)
Linear mixed model fit by REML ['lmerMod']
Formula: logRT ~ condition * NumSpk * Group + (condition * NumSpk | Participant)
   Data: Bar_data_RT

REML criterion at convergence: -13991

Scaled residuals: 
   Min     1Q Median     3Q    Max 
-5.797 -0.670 -0.104  0.560  3.939 

Random effects:
 Groups      Name                               Variance Std.Dev. Corr                         
 Participant (Intercept)                        0.006919 0.0832                                
             conditiondivided_vs_mean           0.000426 0.0206   -0.48                        
             NumSpk2-1                          0.000495 0.0223   -0.16  0.15                  
             NumSpk3-2                          0.000208 0.0144   -0.67 -0.13  0.46            
             conditiondivided_vs_mean:NumSpk2-1 0.000193 0.0139   -0.47  0.30  0.37  0.61      
             conditiondivided_vs_mean:NumSpk3-2 0.000491 0.0222    0.11  0.02  0.40 -0.04  0.39
 Residual                                       0.015617 0.1250                                
Number of obs: 11088, groups:  Participant, 69

Fixed effects:
                                           Estimate Std. Error t value
(Intercept)                                7.112816   0.016751  424.61
conditiondivided_vs_mean                   0.019425   0.004574    4.25
NumSpk2-1                                  0.023218   0.006492    3.58
NumSpk3-2                                  0.016247   0.005673    2.86
Groupp                                    -0.014598   0.023935   -0.61
Groups                                     0.043286   0.025137    1.72
conditiondivided_vs_mean:NumSpk2-1         0.004727   0.005482    0.86
conditiondivided_vs_mean:NumSpk3-2         0.030852   0.006599    4.68
conditiondivided_vs_mean:Groupp            0.013792   0.006533    2.11
conditiondivided_vs_mean:Groups           -0.014269   0.006896   -2.07
NumSpk2-1:Groupp                          -0.002179   0.009259   -0.24
NumSpk3-2:Groupp                           0.000964   0.008088    0.12
NumSpk2-1:Groups                          -0.007775   0.009849   -0.79
NumSpk3-2:Groups                          -0.021268   0.008657   -2.46
conditiondivided_vs_mean:NumSpk2-1:Groupp -0.003391   0.007813   -0.43
conditiondivided_vs_mean:NumSpk3-2:Groupp -0.001763   0.009410   -0.19
conditiondivided_vs_mean:NumSpk2-1:Groups -0.009818   0.008354   -1.18
conditiondivided_vs_mean:NumSpk3-2:Groups -0.009678   0.010024   -0.97

Correlation matrix not shown by default, as p = 18 > 12.
Use print(x, correlation=TRUE)  or
    vcov(x)        if you need it

And finally, the likelihood ratio test:

> lmm0 <- lmer(logRT ~ condition * NumSpk * Group + (1 | Participant), data = Bar_data_RT)
> anova(lmm0, lmm1)
refitting model(s) with ML (instead of REML)
Data: Bar_data_RT
Models:
lmm0: logRT ~ condition * NumSpk * Group + (1 | Participant)
lmm1: logRT ~ condition * NumSpk * Group + (condition * NumSpk | Participant)
     Df    AIC    BIC logLik deviance Chisq Chi Df          Pr(>Chisq)    
lmm0 20 -13831 -13685   6936   -13871                                     
lmm1 40 -14058 -13766   7069   -14138   267     20 <0.0000000000000002 ***
$\endgroup$
3
  • $\begingroup$ Thanks. I downgraded my lme4 version to yours - and still I get this singular fit message. Now I am just curious as to what is going on here. Could there be another relevant package that has a different version from yours? Also, I would like to know in principle if different versions provide different results - which veresion should we "trust"? What are they doing differently? $\endgroup$
    – Galit
    Commented Feb 17, 2019 at 7:09
  • $\begingroup$ Do you get the warning without random slopes too ? Obviously something is different. Have you looked at the rest of the sessioninfo we have in common ? $\endgroup$ Commented Feb 17, 2019 at 10:57
  • $\begingroup$ I don't get a warning when I remove the random slopes. I tried to figure out what other differences relevant to lmer were betewen our sessioninfo. I thought maybe it was because I have lmerTest and you don't. I removed lmerTest, but still - singular fit. New R session - same error. However, when I restarted my computer and allowed for updates (Windows) - error disappeared. I find this puzzling, I would assume that Windows updates have no impact on R's internal algorithms. Do you have an idea or an explanation for this situation? $\endgroup$
    – Galit
    Commented Feb 18, 2019 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.