Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206700

R Lmer model fails to converge, nearly unidentifiable (very large eigenvalue)/ singular fit

$
0
0

I had the two following warnings when running a multilevel model:

Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 103.424 (tol = 0.002, component 1) 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue - Rescale variables?

My data can be downloaded in either one of the following links: Google Drive or Dropbox

What is puzzling is that when I tried in a diferente computer, I have a new warning:

boundary (singular) fit: see ?isSingular

The code to run the model is below:

library(mlmRev)

New <- lmer(cong_LH_all ~ voter_exp_dif_LH_all + education + knowledge_adj + dif_cls_LH_all 
            + cong_closest + ENEP + (1|election), cses_leg) 

I have tried many solutions suggested in other Stack Overflow similar questions, like here. First, changing optimizers:

Model1.2 <- lmerTest::lmer(cong_LH_all ~ voter_exp_dif_LH_all + education      
+ knowledge_adj + dif_cls_LH_all + dif_cls_LH_all + cong_closest + ENEP +
+ (1|election), data = cses_leg, control = lmerControl(optimizer="bobyqa",
optCtrl=list(maxfun=2e5)))

Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 6.1826 (tol = 0.002, component 1) 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue - Rescale variables?

Model1.3 <- lmerTest::lmer(cong_LH_all ~ voter_exp_dif_LH_all + education + knowledge_adj + dif_cls_LH_all + dif_cls_LH_all + cong_closest + ENEP  + (1|election), data = cses_leg, control= lmerControl(optimizer="Nelder_Mead", optCtrl=list(maxfun=2e5)))

boundary (singular) fit: see ?isSingular

Model1.4 <- lmerTest::lmer(cong_LH_all ~ voter_exp_dif_LH_all + education + knowledge_adj + dif_cls_LH_all + dif_cls_LH_all + cong_closest + ENEP  + (1|election), data = cses_leg, control= lmerControl(optimizer="nlminbwrap", optCtrl=list(maxfun=2e5)))

Warning messages: 1: In optwrap(optimizer, devfun, getStart(start, rho$lower, rho$pp), : convergence code 1 from nlminbwrap 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 25.1833 (tol = 0.002, component 1) 3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue - Rescale variables?

Then, I've done the singularity check and it might be the problem, but I don't know how to solve that:

tt <- getME(New,"theta")
ll <- getME(New,"lower")
min(tt[ll==0])

The resulting value:

0.1728425

Tried re-scaling (with the code from the same link above):

numcols <- grep("^c\\.", names(cses_leg))
cses_l2 <- cses_leg
cses_l2[,numcols] <- scale(cses_l2[,numcols])
New <- lmer(cong_LH_all ~ voter_exp_dif_LH_all + education + knowledge_adj +    dif_cls_LH_all + cong_closest + ENEP + (1|election), cses_l2)

Maybe I could do some simpler re-scaling on specific variables, but I don't know where to begin. They are all more or less similar (scales from 1-10, 0-4, etc.)


Viewing all articles
Browse latest Browse all 206700

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>