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.