obscure warning lme4 using lmer in optwrap

user1320502

Using lmer I get the following warning:

Warning messages:
1: In optwrap(optimizer, devfun, x@theta, lower = x@lower) :
  convergence code 3 from bobyqa: bobyqa -- a trust region step failed to reduce q

This error ois generated after using anova(model1, model2) . I tried to make this reproducible but if I dput the data and try again I the error does not reproduce on the dput data, despite the original and new datarames have the exact same str.

If have tried again in a clean session, and the error reproduces, and again is lost with a dput

I know I am not giving people much to work with here, like i said I would love to reproduce the problem. Cayone shed light on this warning?

Ben Bolker

(I'm not sure whether this is a comment or an answer, but it's a bit long and might be an answer.)

  • The proximal cause of your difficulty with reproducing the result is that lme4 uses both environments and reference classes: these are tricky to "serialize", i.e. to translate to a linear stream that can be saved via dput() or save(). (Can you please try save() and see if it works better than dput()?
  • In addition, both environments and reference classes use "pass-by-reference" semantics, so operating on the saved model can change it. anova() automatically refits the model, which makes some tiny but non-zero changes in the internal structure of the saved model object (we are still trying to track this down).
  • @alexkeil's comment is wrong: the nonlinear optimizers used within lme4 do not use any calls to the pseudo-random number generator. They are deterministic (but the two points above explain why things might look a bit weird).

To allay your concerns with the fit, I would check the fit by computing the gradient and Hessian at the final fit, e.g.

library(lme4)
library(numDeriv)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
dd <- update(fm1,devFunOnly=TRUE)
params <- getME(fm1,"theta") ## also need beta for glmer fits
grad(dd,params)
## all values 'small', say < 1e-3
## [1] 0.0002462423 0.0003276917 0.0003415010
eigen(solve(hessian(dd,params)),only.values=TRUE)$values
## all values positive and of similar magnitude
## [1] 0.029051631 0.002757233 0.001182232

We are in the process of implementing similar checks to run automatically within lme4.

That said, I would still love to see your example, if there's a way to reproduce it relatively easily.

PS: in order to be using bobyqa, you must either be using glmer or have used lmerControl to modify the default optimizer choice ... ??

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

obscure warning lme4 using lmer in optwrap

From Dev

behavior of na.action = na.exclude using lmer in lme4 1.0-5 inconsistent with lm and with older versions of lme4

From Dev

How to calculate p-value from a linear mixed effect model created by lme4::lmer() using broom::tidy()?

From Dev

Hide warning message in lme4

From Dev

lme4::lmer summary object contains double object with string

From Dev

lme4::lmer summary object contains double object with string

From Dev

Using car:::linearHypothesis() with lme4 models

From Dev

Extract raw model matrix of random effects from lmer objects (lme4, R)

From Dev

How does lmer (from the R package lme4) compute log likelihood?

From Dev

Extract raw model matrix of random effects from lmer objects (lme4, R)

From Dev

R lme4 Plot lmer residuals ~ fitted by Factors levels in ggplot

From Dev

R: Strange errors using lmList from lme4

From Dev

Frequency weights in R (multilevel using lme4)

From Dev

lme4::lmer reports "fixed-effect model matrix is rank deficient", do I need a fix and how to?

From Dev

How to compare a model with no random effects to a model with a random effect using lme4?

From Dev

Incorporating time series into a mixed effects model in R (using lme4)

From Dev

R: Bootstrapped binary mixed-model logistic regression using bootMer() of the new lme4 package

From Dev

rank deficiency warning mixed model lmer

From Dev

How to get rid of lmer warning message?

From Dev

Having trouble promisifying obscure library and then using it in a coroutine

From Dev

Get a clean summary of nlme.lme() or lme4.lmer() in RPy

From Dev

Get a clean summary of nlme.lme() or lme4.lmer() in RPy

From Dev

output lmer summary information to word using ReporteRs

From Dev

How to modify slots lme4 >1.0

From Dev

Convergence error for development version of lme4

From Dev

Setting rhoend parameter with lme4

From Dev

Prediction with lme4 on new levels

From Dev

R stargazer, lme4 and lmerTest incompatibility

From Dev

bootstrapping with lme4 model and missing values

Related Related

  1. 1

    obscure warning lme4 using lmer in optwrap

  2. 2

    behavior of na.action = na.exclude using lmer in lme4 1.0-5 inconsistent with lm and with older versions of lme4

  3. 3

    How to calculate p-value from a linear mixed effect model created by lme4::lmer() using broom::tidy()?

  4. 4

    Hide warning message in lme4

  5. 5

    lme4::lmer summary object contains double object with string

  6. 6

    lme4::lmer summary object contains double object with string

  7. 7

    Using car:::linearHypothesis() with lme4 models

  8. 8

    Extract raw model matrix of random effects from lmer objects (lme4, R)

  9. 9

    How does lmer (from the R package lme4) compute log likelihood?

  10. 10

    Extract raw model matrix of random effects from lmer objects (lme4, R)

  11. 11

    R lme4 Plot lmer residuals ~ fitted by Factors levels in ggplot

  12. 12

    R: Strange errors using lmList from lme4

  13. 13

    Frequency weights in R (multilevel using lme4)

  14. 14

    lme4::lmer reports "fixed-effect model matrix is rank deficient", do I need a fix and how to?

  15. 15

    How to compare a model with no random effects to a model with a random effect using lme4?

  16. 16

    Incorporating time series into a mixed effects model in R (using lme4)

  17. 17

    R: Bootstrapped binary mixed-model logistic regression using bootMer() of the new lme4 package

  18. 18

    rank deficiency warning mixed model lmer

  19. 19

    How to get rid of lmer warning message?

  20. 20

    Having trouble promisifying obscure library and then using it in a coroutine

  21. 21

    Get a clean summary of nlme.lme() or lme4.lmer() in RPy

  22. 22

    Get a clean summary of nlme.lme() or lme4.lmer() in RPy

  23. 23

    output lmer summary information to word using ReporteRs

  24. 24

    How to modify slots lme4 >1.0

  25. 25

    Convergence error for development version of lme4

  26. 26

    Setting rhoend parameter with lme4

  27. 27

    Prediction with lme4 on new levels

  28. 28

    R stargazer, lme4 and lmerTest incompatibility

  29. 29

    bootstrapping with lme4 model and missing values

HotTag

Archive