Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to cope with a singular fit in a linear mixed model (lme4)?

I am running several linear mixed models for an study about birds with the variable nest as a random variable. The thing is that in some of these models I get what is called 'singular fit': my nest random variable has a variance and st error of 0.00.

Some background: I am working with wild birds to see the effect of living in noisy environments on some oxidative stress parameters. For this, we took a blood sample for each of the nestlings of each nest to do the laboratory stuff. Because of the limited blood sample, some oxidative stress parameters couldn't be measured for every nestling.

model <- lmer(antioxidant_capacity~age+sex+clutch+zone+(1|nestID),
 data=data, contrasts=list(sex=contr.sum, zon=contr.sum, clutch=contr.sum))

Then I get:

singular fit

This is the table:

REML criterion at convergence: 974.3

Scaled residuals: 
 Min       1Q   Median       3Q      Max 
-2.72237 -0.61737  0.06171  0.69429  2.88008 

Random effects:
Groups   Name        Variance     Std.Dev.
nestID (Intercept)      0          0.00   
Residual               363        19.05   
Number of obs: 114, groups:  nido_mod, 46

Fixed effects:
        Estimate      Std. Error  df        t value Pr(>|t|)    
(Intercept) 294.5970    36.8036  109.0000   8.005   1.41e-12 ***
age          -0.2959     3.0418  109.0000  -0.097   0.922685    
clutch1      -0.5242     2.0940  109.0000  -0.250   0.802804    
sex1          2.3167    1.8286 109.0000     1.267   0.207885    
zone1         6.2274     1.7958  109.0000   3.468   0.000752 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
      (Intr) age  clutch1 sex1 
age  -0.999                     
clutch1   0.474 -0.465              
sex1      0.060 -0.054 -0.106       
zone1    -0.057  0.061 -0.022  0.058
convergence code: 0
singular fit

I have read about singularity problems and if I have understood well, the singularity is related to overfitting. Could this be due to that for some response variables I have nests with only one nestling while there are nest with more nestlings? How can I solve this? Any recommendation?

Thank you, so much.

like image 980
Iraida Avatar asked Feb 08 '19 17:02

Iraida


1 Answers

In lmer, a singular fit could be caused by collinearity in fixed effects, as in any other linear model. That would need you to revise your model by removing terms. But in lmer, that (or a "boundary (singular) fit" warning) can also be also triggered in quite simple models when a random effect variance is estimated very near zero and (very loosely) the data is not sufficiently informative to drag the estimate away from the zero starting value.

The formal answer is broadly similar either way; drop terms that estimate as zero. And that remains sensible at least until you know which term is causing the problem. But there are times when a negligible variance is reasonably likely but you'd like to retain it in the model; for example because you're quite deliberately looking for intervals on possibly small variances or maybe doing multiple similar experiments and would prefer to extract all the variances consistently. If you're sure of what's going on, you can suppress these warnings via lmerControl, which can be set not to use the relevant tests. For example, you can include

control=lmerControl(check.conv.singular = .makeCC(action = "ignore",  tol = 1e-4))

in your lmer call. That leaves in the default tolerance (which makeCC needs) but suppresses the singular fit test. (The default is action="warning", which runs the test and issues the warning).

like image 200
S Ellison Avatar answered Feb 24 '23 22:02

S Ellison