2
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ 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. $\endgroup$
    – AdamO
    Commented Apr 30, 2019 at 16:19
  • $\begingroup$ 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. $\endgroup$
    – R-Rex
    Commented May 6, 2019 at 17:29
  • $\begingroup$ 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. $\endgroup$
    – AdamO
    Commented May 6, 2019 at 17:37

1 Answer 1

1
$\begingroup$

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?

$\endgroup$

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.