[R-sig-ME] Convergence in lme4: Something in the documentation

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Sat Nov 14 22:11:38 CET 2020


  The problem here is that some of your pars values are negative, so
you're giving runif() a {min,max} pair that are in the wrong order.
Maybe:

   mins <- pmin(pars/1.01, pars*1.01)
   maxs <- pmax(pars/1.01, pars*1.01)
  runif(length(pars),mins, maxs)

  will do what you want.

On Sat, Nov 14, 2020 at 4:02 PM Simon Harmel <sim.harmel using gmail.com> wrote:
>
> Dear All,
>
> This page (http://search.r-project.org/R/library/lme4/html/convergence.html)
> does a fantastic job of explaining how to possibly overcome/explore the
> lack of convergence in lme4 models.
>
> However, I have a question about item "#4 restart the fit from the original
> value".
>
> For my `lmer()` model, the `getME(fiitted_model,"theta")` returns:
>
> pars = c(0.55714322,  0.04364260, -0.00577823,  0.35910270, -0.03138007,
>  0.02750460)
>
> Following the documentation, when I then do:
>
> (pars_x <- runif(length(pars), pars/1.01, pars*1.01)), I get:
>
> [1] 0.55558159 0.04369471        NaN 0.36202453        NaN 0.02732069
> Warning message:
> In runif(length(pars), pars/1.01, pars * 1.01) : NAs produced
>
> These NaN will mess up the next steps. Is there a solution to this?
>
> Simon
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models



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