nloptwrap {lme4} | R Documentation

## Wrappers for additional optimizers

### Description

Wrappers to allow use of alternative optimizers, from `NLopt` library or elsewhere, for nonlinear optimization stage

### Usage

    nloptwrap(par, fn, lower, upper, control=list(),...)
    nlminbwrap(par, fn, lower, upper, control=list(),...)

### Arguments

`par` | starting parameter vector
`fn` | objective function
`lower` | vector of lower bounds
`upper` | vector of upper bounds
`control` | list of control parameters
`...` | additional arguments to be passed to objective function

### Details

Using alternative optimizers is an important trouble-shooting tool for mixed models. These wrappers provide convenient access to the optimizers provided by Steven Johnson's `NLopt` library (via the `nloptr` R package), and to the `nlminb` optimizer from base R. (`nlminb` is also available via the `optimx` package; this wrapper provides access to `nlminb` without the need to install/link the package, and without the additional post-fitting checks that are implemented by `optimx` (see examples below).

One important difference between the `nloptr`-provided implementation of BOBYQA and the `minqa`-provided version accessible via `optimizer="bobyqa"` is that it provides simpler access to optimization tolerances. `minqa::bobyqa` provides only the `rhoend` parameter ("[t]he smallest value of the trust region radius that is allowed"), while `nloptr` provides a more standard set of tolerances for relative or absolute change in the objective function or the parameter values (`ftol_rel`, `ftol_abs`, `xtol_rel`, `xtol_abs`).

### Value

`par` | estimated parameters
`fval` | objective function value at minimum
`feval` | number of function evaluations
`conv` | convergence code (0 if no error)
`message` | convergence message

### Author(s)

Gabor Grothendieck (`nlminbwrap`)

### Examples

    environment(nloptwrap)$defaultControl
    library(lme4)
    fm1 <- lmer(Reaction~Days+(Days|Subject),sleepstudy)
    ## BOBYQA (default)
    fm1_nloptr <- update(fm1,control=lmerControl(optimizer="nloptwrap"))
    ## Nelder-Mead
    fm1_nloptr_NM <- update(fm1,control=lmerControl(optimizer="nloptwrap",
                                optCtrl=list(algorithm="NLOPT_LN_NELDERMEAD")))
    ## other nlOpt algorithm options include NLOPT_LN_COBYLA, NLOPT_LN_SBPLX
    fm1_nlminb <- update(fm1,control=lmerControl(optimizer="nlminbwrap"))
    if (require(optimx)) {
        fm1_nlminb2 <- update(fm1,control=lmerControl(optimizer="optimx",
                                  optCtrl=list(method="nlminb",kkt=FALSE)))
    }

[Package lme4 version 1.1-12 Index]