# Zero random intercept variance for glmer mixed model

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.

• Summarizing very loosely, but the mixed model fitter has an internal optimizer where if a variance component is very close to 1 or 0, it just restructures the covariance matrix so as to prevent obtaining unstable estimates. If you remove fixed effects from the model, especially intracluster predictors, it will increase intraclass correlation, so not surprising to see that condition go away. – AdamO Apr 30 at 16:19
• Do you have any advice as to how to obtain the correct variance estimates e.g. change optimizer specifications? Basically, I would like to keep the fixed effects in the model but also need to level 2 variance correctly computed. – R-Rex May 6 at 17:29
• To put it bluntly, you do have the correct variance estimates. The superefficient estimator of the variance component is unbiased and consistent, it's just telling you there's too little residual variability in the estimate to actually solve the matrix algebra needed to get a stable non-zero estimate. Very rich discussion here: stats.stackexchange.com/questions/115090/… It may help to realize that the interpretation and inference for the fixed effects is much better when you fit the models this way. – AdamO May 6 at 17:37