Solved – Zero random intercept variance for glmer mixed model

lme4-nlme

I'm running the following glmer model in lme4:

fit <- glmer(outcome ~ var1 + var2 + var3 + var4 + var5 + 
                      CONDITION + (1 | ranint), 
             family = binomial(), data = data)

summary(fit)

The predictors are all categorical variables, I've named them varx for simplicity. The output for the random intercept displays a variance of 0 as below:

Random effects:
 Groups Name        Variance Std.Dev.
 ranint (Intercept) 0        0       
Number of obs: 5572, groups:  ranint, 260 

Why is the variance and std.dev of the random intercept equal to 0? This does not seem to be a tiny value, it's actually equal to 0. When running ranef(), I obtain a vector of 0 values for each level 2 unit.

I read online that one issue could be the small sample size at level 2. For this particular outcome, there are 260 units in the random intercept so the sample size should not be a problem. I was wondering if the model is overfit so to test, I removed the predictor CONDITION which has 6 categories in total and should add some degrees of freedom. The problem seems to have disappeared as I get the following output:

Random effects:
 Groups Name        Variance Std.Dev.
 ranint (Intercept) 0.142    0.3768  
Number of obs: 5572, groups:  ranint, 260

However I still need CONDITION as a predictor in my model so any ideas how to fit the model would be appreciated.

Best Answer

There is no error or problem with the model that estimates 0 for the variance component(s) in question. In fact, for carefully balanced designs, like Latin Squares, you often find a variance component for intrasubject variability that is nullified by the balance. It's actually a testament to how well controlled the experiment is: you get to save 1 degree of freedom, more reliably estimate the residual standard error, and get more precise inference.

The interpretation of the finding is that "after controlling for fixed effects of CONDITION, var1, ..., numerical routines identified an intraclass correlation very close to 0, and hence the random effect for subject was removed so as to ensure stability of estimates.

An important point is that you cannot really "get" the non-zero intrasubject variance. If you upped your sample size, there may be precision to get a reliable estimate, and if you fit the ML routine, even if the linear algebra package did not obtain a 0 determinant, you would have highly, highly variable estimates that can't be trusted.

A very rich discussion can be found here.

Why do I get zero variance of a random effect in my mixed model, despite some variation in the data?

Related Question