Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

control maximum number of iterations in lme4 1.0.*

Tags:

r

I estimated a random coefficient hazard model using the glmer command (from the lme4 package) in R. The command looks like the follwing.

(logit.full <-
   glmer(event ~ 
    + V12 * I(V1 - 2)
    + V13
    + V9 * I(V5 - 2)
    + V11
    + V10
    + V2
    + V3
    + V4
    + V6 + V7 + V8
    + (1 + V6 + V7 + V8 | V14),
    family=binomial("logit"), data=dataset, 
    verbose=TRUE, control=list(maxIter=400)))

The model has been working fine for the past three months. Now, after updating the package to 1.0-4, there seems to be a problem with the "control" command and I get the following error message:

Warning in glmer(event ~ a1+a2+a3 :
  Use control=glmerControl(..) instead of passing a list of class “list”
Error in function (optimizer = c("bobyqa", "Nelder_Mead"), restart_edge = FALSE,  : 
  unused argument(s) (maxIter = 400)

Does anyone know how to solve this problem?

like image 347
user2206985 Avatar asked Sep 25 '13 07:09

user2206985


1 Answers

From ?glmerControl:

optCtrl: a ‘list’ of additional arguments to be passed to the nonlinear optimizer (see ‘Nelder_Mead’, ‘bobyqa’). In particular, both ‘Nelder_Mead’ and ‘bobyqa’ use ‘maxfun’ to specify the maximum number of function evaluations they will try before giving up - in contrast to ‘optim’ and ‘optimx’-wrapped optimizers, which use ‘maxit’.

Admittedly this is a small part of a fairly long and complex help page.

so control=glmerControl(optCtrl=list(maxfun=...)) should do it.

I can see this is likely to be a FAQ, so we may add some special code to detect this case (and/or add a more prominent note to the documentation).

like image 128
Ben Bolker Avatar answered Nov 01 '22 07:11

Ben Bolker