[R-sig-ME] Fwd: glm.nb convergence issues

Matthew Boden m@tthew@t@boden @end|ng |rom gm@||@com
Wed Mar 20 06:43:22 CET 2019


Hello,



I’m working my way through convergence issues related to a negative
binomial mixed model with an offset and random intercept. Data attached.



A3 <- glmer.nb(wait_n ~ offset(log(wait_d)) +  scale(spr) + (1 | check),
data = ST)

summary(A3)



#Model failed to converge with max|grad| = 0.0031459 (tol = 0.001, component 1)

#Model is nearly unidentifiable: very large eigenvalue

# - Rescale variables?



I have two questions.



1) Outcome variable (wait_n) values are much larger than predictor (spr)
values.



Mean wait_n = 11,783

Mean spr = 7.34



Would transforming the predictor (e.g., multiply by 1000) and/or offset
make sense here. The offset confuses the issue (or, me) - as a log, it is
quite small relative to the outcome and on but on the same scale as the
other predictor.



2) The use of allFit to try different optimizers seems to be giving
conflicting results.



A3.all <- allFit(A3, meth.tab = NULL)

ss <- summary(A3.all)



#bobyqa : [OK]

#Nelder_Mead : [OK]

#nlminbwrap : [OK]

#nmkbw : [OK]

#optimx.L-BFGS-B : [OK]

#nloptwrap.NLOPT_LN_NELDERMEAD : [OK]

#nloptwrap.NLOPT_LN_BOBYQA : [OK]



ss$ which.OK



#bobyqa                         TRUE

#Nelder_Mead                    TRUE

#nlminbwrap                     TRUE

#nmkbw                          TRUE

#optimx.L-BFGS-B                TRUE

#nloptwrap.NLOPT_LN_NELDERMEAD  TRUE

#nloptwrap.NLOPT_LN_BOBYQA      TRUE



What do you know, all optimizers supposedly work.

However, some of them lead to a model that converges, and others don’t.



A3a <- glmer.nb(wait_n ~ offset(log(wait_d)) +  scale(spr) + (1 | check),
data = ST, glmerControl(optimizer = "bobyqa"))



#Model is nearly unidentifiable: very large eigenvalue

# - Rescale variables?



A3b <- glmer.nb(wait_n ~ offset(log(wait_d)) +  scale(spr) + (1 | check),
data = ST, glmerControl(optimizer = "Nelder_Mead"))



#Model failed to converge with max|grad| = 0.00553513 (tol = 0.001, component 1)

#Model is nearly unidentifiable: very large eigenvalue

# - Rescale variables?



A3c <- glmer.nb(wait_n ~ offset(log(wait_d)) +  scale(spr) + (1 | check),
data = ST, glmerControl(optimizer = "nlminbwrap"))



#Model is nearly unidentifiable: very large eigenvalue

# - Rescale variables?



A3d <- glmer.nb(wait_n ~ offset(log(wait_d)) +  scale(spr) + (1 | check),
data = ST, glmerControl(optimizer = "nmkbw"))



#Model failed to converge with max|grad| = 0.00177926 (tol = 0.001, component 1)

#Model is nearly unidentifiable: very large eigenvalue

# - Rescale variables?



I’m trying to understand why allFit responds that all optimizers converge
when they actually do not.



Thank you,

Matt



Matthew Boden, Ph.D.

Senior Evaluator

Program Evaluation & Resource Center

Office of Mental Health & Suicide Prevention

Veterans Health Administration


More information about the R-sig-mixed-models mailing list