Solved – lme4 lmer() multilevel model: why do I have singular fit and a -1 correlation between random effects slope and intercept

lme4-nlmemixed modelmultilevel-analysisrsingular

I'm running a varying intercepts varying slopes multilevel model with the lme4::lmer() function with no group level predictors and only one predictor: FilingFee to predict evictionfilingrate.

I cannot for the life of me figure out why I am getting a singular fit and correlation of -1 between the random effects intercept and slope. I've been reading as many posts as I can about this and understand that this can happen when there isn't sufficient group-level variation, or enough data for a complex model.

But my model isn't complex, I have a good amount of data, and I have a good amount of variation within states. There is a theoretical reason for looking at random effects of states, and the states really do each have different distributions of FilingFees! The FilingFees of counties within each states are normally distributed, but different states have totally different means and sds.

DATA:

County-level data. 1269 counties in 16 states. Average number of counties in a state is 17, minimum 6, maximum 196.

FilingFee: continuous, numeric. variance of 5083, mean 125, max 350, min 25. Variance within each state: 684.4, 142.3, 218, 1688.2, 330, 168.3, 949.9, 12.6, 13.8, 229.5, 150, 923, 401.6, 1102.5, 520, 7.7.

evictionfilingrate: continuous, numeric.variance of 24, mean 3, max 45, min 0. Variance within each state: 2, 4.9, 53, 2.6, 10.9, 3.3, 2.2, 0.7, 20, 3.8, 10.8, 3.9, 9.9, 6.4, 3.4, 83.5

MODEL:

lmerfit <- lmer(evictionfilingrate ~ FilingFee + (1 + FilingFee | state), data = d)

summary(lmerfit)
Linear mixed model fit by REML ['lmerMod']
Formula: evictionfilingrate ~ FilingFee + (1 + FilingFee | state)
   Data: d

REML criterion at convergence: 7307.3

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.1829 -0.3828 -0.1405  0.2213  8.7975 

Random effects:
 Groups   Name        Variance  Std.Dev. Corr 
 state    (Intercept) 3.441e+01 5.86642       
          FilingFee   8.272e-04 0.02876  -1.00
 Residual             1.772e+01 4.20987       
Number of obs: 1269, groups:  state, 16

Fixed effects:
             Estimate Std. Error t value
(Intercept)  4.904464   1.544465   3.176
FilingFee   -0.013458   0.007964  -1.690

Correlation of Fixed Effects:
          (Intr)
FilingFee -0.974
convergence code: 0
boundary (singular) fit: see ?isSingular

Please let me know if I should provide more information about my data or code.

Best Answer

Try rescaling your predictor variable FilingFee, e.g.,

lmerfit <- lmer(evictionfilingrate ~ I(FilingFee/10) + 
                  (1 + I(FilingFee/10) | state), data = d)

and also using nlme::lme(), i.e.,

 lmefit <- lme(evictionfilingrate ~ FilingFee, data = d,
               random = ~ FilingFee | state)

or

 lmefit <- lme(evictionfilingrate ~ I(FilingFee/10), data = d,
               random = ~ I(FilingFee/10) | state)

And also possibly changing the optimization algorithm to optim in lme(); see lmeControl() for more info.

Related Question