4
$\begingroup$

I ran a mixed model using lme4::glmer for a logistic regression and consistently got these warning messages. I noticed there are still regular results even so, but are they accurate estimates?

    > glmm.ms1<-glmer(as.formula(paste(paste(y[1], x, sep="~"), mix[1], sep="+")),
    +             data=rtf2,control=glmerControl(optimizer="bobyqa",
    +             optCtrl=list(maxfun=100000),family=binomial)
Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.8766 (tol = 0.001)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge: degenerate  Hessian with 1 negative eigenvalues

> coef(summary(glmm.ms1))
                       Estimate Std. Error    z value  Pr(>|z|)
(Intercept)           1.810e+00  6.558e-01   2.760464 5.772e-03
lepidays             -3.340e+00  2.770e-01 -12.059620 1.726e-33
cldaysbirth          -1.555e+00  5.224e-01  -2.975934 2.921e-03
rotaarm              -2.057e-01  3.209e-01  -0.641102 5.215e-01
cldaysbirth2         -3.072e-01  2.955e-01  -1.039510 2.986e-01
bfh2                 -1.043e+01  1.160e+03  -0.008996 9.928e-01
bfh3                  4.653e-01  4.806e-01   0.968103 3.330e-01
bfh4                  2.547e-01  4.994e-01   0.509966 6.101e-01
bfh5                  3.744e-01  9.926e-01   0.377213 7.060e-01
ruuska               -1.020e-01  5.928e-02  -1.720396 8.536e-02
genderMale           -4.008e-01  2.645e-01  -1.515453 1.297e-01
epiexlbf              6.078e-04  2.796e-03   0.217391 8.279e-01
haz.epi              -7.211e-02  1.373e-01  -0.525039 5.996e-01
cldaysbirth:rotaarm   6.928e-01  4.771e-01   1.452148 1.465e-01
rotaarm:cldaysbirth2  5.181e-01  3.352e-01   1.545527 1.222e-01
Warning messages:
1: In vcov.merMod(object, use.hessian = use.hessian) :
  variance-covariance matrix computed from finite-difference Hessian is
not positive definite: falling back to var-cov estimated from RX
2: In vcov.merMod(object, correlation = correlation, sigm = sig) :
  variance-covariance matrix computed from finite-difference Hessian is
not positive definite: falling back to var-cov estimated from RX

Due to data's sensitivity, I can't post the whole process for generating same messages, but I would like to know how to handle these warnings. I don't think it's suitable to keep my eye blind here.

$\endgroup$
6
$\begingroup$

I think that the main issue is that you need to increase the number of possible iterations the optimizer is allowed to have (in my humble opinion the default of 10,000 is a little low). This is what is literally said in the first warning:

maximum number of function evaluations exceeded

You should try the following in your call to glmer to increase the number to e.g., 100,000:

glmerControl(optimizer="bobyqa", optCtrl = list(maxfun = 100000))

If warnings persist than there are other problems.

$\endgroup$
  • $\begingroup$ Thanks, Henrik! It does work now for the the first warning. But the other two are still three. I don't know whether there's way for model convergence issue. $\endgroup$ – David Z May 15 '14 at 13:37
  • 2
    $\begingroup$ You should then post the new warnings. But you might also want to check this. $\endgroup$ – Henrik May 15 '14 at 14:28
  • $\begingroup$ Is there any rules what value will I use for maxfun , i.e., maxfun=100000 or maxfun=1500000 ? Is there any advantage/disadvantage of increasing the number ? $\endgroup$ – ABC Jul 22 '15 at 3:45
  • $\begingroup$ @ABC If you need a lot of samples you either have massive amounts of data or an overparameterized model. But as long as the warning appears you have to increase the number. As long as the warning is there the results are non-sensical. $\endgroup$ – Henrik Jul 22 '15 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.