egf_optimizer function

Define an Optimization Method

Define an Optimization Method

Utilities for linking an optimizer with optional arguments and control parameters to define an optimization method for use by egf.

egf_optimizer(f = nlminb, args = list(), control = list())

Arguments

  • f: a function performing optimization. Supported are newton, optim, nlminb, nlm, and any optim-like function.

  • args: a list of optional arguments to f not including control. If f = optim and args does not have method as an element, then method = "BFGS"

    is appended.

  • control: a list of control parameters to be passed to f.

Returns

A list inheriting from class egf_optimizer containing the validated arguments, wherein f may be a new function wrapping the supplied one to make it optim-like.

Details

An optim-like function is a function f such that:

  • the first three arguments of f specify an initial parameter vector, an objective function, and a gradient function, respectively;
  • f accepts control as a fourth (or later) argument; and
  • f returns a named list with elements par, value, convergence, and message.

Examples

optimizer <- egf_optimizer(nlminb) str(optimizer)