[R-sig-ME] Warnings BootMer bootstrap glmer lme4
Ben Bolker
bbolker at gmail.com
Sat May 20 19:39:36 CEST 2017
On 17-05-19 06:43 AM, D.J. Damen wrote:
> Dear all,
>
> Currently, I am using the BootMer function to bootstrap my final
> model (fitted with GLMER from the lme4 package) to estimate the
> confidence intervals and p-values. Since I am alternating my
> reference categories, I have to bootstrap several models, and now the
> bootstrap of one model (below) returns with 50 or more warnings. Is
> there a standard procedure to follow when this happens? Should I
> trust the bootstrap when warnings pop up?
>
> I am fitting a binomial model with the (centered and treatment coded)
> predictors c.con.tr (3 levels), c.type.tr (2 levels), and c.diff.tr
> (2 levels), and the dependent variable “contrast” (1 = mentioned; 0 =
> not mentioned).
>
> Details about the model I want to bootstrap, the bootstrap function
> and the warnings are presented below:
>
> Model:
>
> m0bcc <-glmer
> (contrast~c.con.tr*c.type.tr*c.diff.tr+(1+c.type.tr+c.diff.tr|id)+(1+c.con.tr+c.type.tr|item.new),
> data=mydata, family=binomial (link='logit'),
> control=glmerControl(optimizer="bobyqa"))
This seems like a moderately complex model (2 4x4 variance-covariance
matrices); how big is your data set (total observations, number of id
levels, number of item.new levels)? I wouldn't be surprised if you're
getting some singular fits. On the other hand, the gradient warnings
are fairly small.
Some suggestions:
- (unrelated to your question) if you have small numbers of
observations *per* id (or item), you should consider using Gauss-Hermite
quadrature (e.g. nAGQ=10)
- check to see whether the profile confidence intervals agree
reasonably well with the bootstrap CIs
- you could use blme::bglmer to regularize your model to avoid
singularities
- or try an alternative approach like brms to double-check
>
>
> Bootstrap function:
>
> FUN <- function(fit) { return(fixef(fit)) }
>
> boost <- function(mdl){ name <- match.call()$mdl boosted <-
> bootMer(mdl, FUN, nsim = 100)
> save(boosted,file=paste(name,"_boosted",sep="")) }
>
> p_boosted <- function(mdl,boosted){ for (n in 1:length(fixef(mdl))){
> print(fixef(mdl)[n]) (bMCI <- boot.ci(boosted, conf = c(0.95, 0.99,
> 0.999), index=n, type="norm")) print(bMCI) } }
>
> Warnings: ( posted the first 10 warnings, in total there were 50 (or
> more?).
>
> mdl <- m0bcc
>> boosted <- bootMer(mdl, FUN, nsim = 100)
> There were 50 or more warnings (use warnings() to see the first 50)
>
> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl =
> control$checkConv, ... : unable to evaluate scaled gradient 2: In
> checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
> ... : Model failed to converge: degenerate Hessian with 1 negative
> eigenvalues 3: In checkConv(attr(opt, "derivs"), opt$par, ctrl =
> control$checkConv, ... : unable to evaluate scaled gradient 4: In
> checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
> ... : Model failed to converge: degenerate Hessian with 2 negative
> eigenvalues 5: In optwrap(object at optinfo$optimizer, ff, x0, lower =
> lower, ... : convergence code 1 from bobyqa: bobyqa -- maximum
> number of function evaluations exceeded 6: In checkConv(attr(opt,
> "derivs"), opt$par, ctrl = control$checkConv, ... : Model failed to
> converge with max|grad| = 0.00176467 (tol = 0.001, component 1) 7: In
> checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
> ... : unable to evaluate scaled gradient 8: In checkConv(attr(opt,
> "derivs"), opt$par, ctrl = control$checkConv, ... : Model failed to
> converge: degenerate Hessian with 1 negative eigenvalues 9: In
> optwrap(object at optinfo$optimizer, ff, x0, lower = lower, ... :
> convergence code 1 from bobyqa: bobyqa -- maximum number of function
> evaluations exceeded 10: In checkConv(attr(opt, "derivs"), opt$par,
> ctrl = control$checkConv, ... : Model failed to converge with
> max|grad| = 0.00258682 (tol = 0.001, component 1) 11: In
> checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
> ... :
>
>
> I couldn’t find whether I should decrease the random effects
> structure of my fitted model to decrease these bootstrap warnings,
> but since my fitted glmer model did converge, I am hesitant to do so
> anyway. I hope somebody is able to shed some light on this matter.
>
> Thank you very much in advance.
>
> Best, Debby
>
> Debby Damen PhD Student
>
> Department of Communication and Information Science
>
> Tilburg University Warandelaan 2, room D410 5037 AB Tilburg
>
> T. +31 13 466 8245 M. d.j.damen at uvt.nl<mailto:d.j.damen at uvt.nl>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at 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