# [R] How to pass eval.max from lme() to nlminb?

Berwin A Turlach berwin at maths.uwa.edu.au
Sun Jul 23 10:29:55 CEST 2006

```G'day Andrew,

>>>>> "AR" == Andrew Robinson <A.Robinson at ms.unimelb.edu.au> writes:

AR> I'm fitting a complex mixed-effects model that requires
AR> numerous iterations and function evaluations.  I note that
AR> nlminb accepts a list of control parameters, including
AR> eval.max.  Is there a way to change the default eval.max value
AR> for nlminb when it is being called from lme?
Looking at the code of lme.formula, I can only find this snippet:

[...]
optRes <- if (controlvals\$opt == "nlminb") {
nlminb(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt,
lmePars), control = list(iter.max = controlvals\$msMaxIter,
trace = controlvals\$msVerbose))
}
else {
optim(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt,
lmePars), control = list(trace = controlvals\$msVerbose,
maxit = controlvals\$msMaxIter, reltol = if (numIter ==
0) controlvals\$msTol else 100 * .Machine\$double.eps),
method = controlvals\$optimMethod)
}
[...]

this seems to indicate that you can only change the values for
'iter.max' and 'trace' in the call to 'nlminb()' by setting values for
'msMaxIter' and 'msVerbose', using 'lmeControl', when calling 'lme()'.

Cheers,

Berwin

========================== Full address ============================
Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)
School of Mathematics and Statistics        +61 (8) 6488 3383 (self)
The University of Western Australia   FAX : +61 (8) 6488 1028
35 Stirling Highway
Crawley WA 6009                e-mail: berwin at maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin

```