[R-sig-ME] glmer takes long time even after restricting iterations

Prachi Sanghavi prachi.sanghavi at gmail.com
Fri Sep 5 20:19:36 CEST 2014


Hello!

I have a fairly complex multilevel, multivariate logistic model that I am trying to fit.  In both models below, the variables injury, AMI, stroke, and resp are binary, as well as ALS and most other variables.  There are a total of about 400,000 observations.  When I try to fit the model (Original Model), I get several warnings, and I have pasted these below.  I am largely concerned about number 4.  I think this problem is due to having too many parameters in the model, and so I removed several interactions that were unnecessary anyway (Modified Model).  I ran the Modified Model with a fixed number of iterations, and it finished these quickly enough (maybe 20 minutes?).  But then it took another 19 hours to actually stop running, during which time I suspect R was doing various checks that led to the warnings.  I'm not sure.  When the Modified Model finished, it produced the warnings below.

My biggest problem right now is the amount of time it takes for R to stop running, even after restricting the number of iterations to 100.  Because of this problem, it is impractical to try to figure out how to address the warnings.

Can somebody please help me figure out why R is taking so long, even after it has finished the 100 iterations?  And what can I do about it?

Thank you!!

Prachi Sanghavi
Harvard University


Original Model and Warnings:

AMI_county_final_2 <- glmer(ALS ~ -1 + AMI + (injury + stroke + resp)*(FEMALE + AGE + MTUS_CNT + Asian + Black + Hispanic + Other + Custodial + Nursing + Scene + WhiteHigh + BlackHigh + BlackLow + IntegratedHigh + IntegratedLow + combinedscore + Year06 + Year07 + Year08 + Year09 + Year10 + Metro + Per_College_Plus + Per_Gen_Prac + Any_MedSchlAff + Any_Trauma) + (-1 + injury + AMI + stroke + resp | fullcounty), family=binomial, data=rbind(IARS,IARS2), verbose=2, control=glmerControl(optCtrl=list(maxfun=100)))

Warning messages:
1: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf,  :
  failure to converge in 10000 evaluations
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 480.605 (tol = 0.001)
3: In if (resHess$code != 0) { :
  the condition has length > 1 and only the first element will be used
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?

Modified Model and Warnings:

AMI_county_final_2 <- glmer(ALS ~ -1 + Year06 + Year07 + Year08 + Year09 + Year10 + Metro + AMI + (injury + stroke + resp)*(FEMALE + AGE + MTUS_CNT + Asian + Black + Hispanic + Other + Custodial + Nursing + Scene + WhiteHigh + BlackHigh + BlackLow + IntegratedHigh + IntegratedLow + combinedscore) + (-1 + injury + AMI + stroke + resp | fullcounty), family=binomial, data=rbind(IARS,IARS2), verbose=2, control=glmerControl(optCtrl=list(maxfun=100)))

Warning messages:
1: In commonArgs(par, fn, control, environment()) :
  maxfun < 10 * length(par)^2 is not recommended.
2: In optwrap(optimizer, devfun, start, rho$lower, control = control,  :
  convergence code 1 from bobyqa: bobyqa -- maximum number of function evaluations exceeded
3: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf,  :
  failure to converge in 100 evaluations
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 15923.5 (tol = 0.001)
5: In if (resHess$code != 0) { :
  the condition has length > 1 and only the first element will be used
6: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?
	[[alternative HTML version deleted]]



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