apply_optimizer {optimizeR}R Documentation

Apply optimizer object

Description

This function performs numerical optimization using an optimizer object.

Usage

apply_optimizer(optimizer = optimizer_nlm(), objective, initial, ...)

Arguments

optimizer

An object of class optimizer.

objective

A function to be optimized, returning a single numeric. Its first argument must be a numeric vector of the same length as initial, followed by any other arguments specified by the ... argument.

initial

A numeric vector with starting parameter values for the optimization.

...

Additional arguments to be passed to optimizer.

Value

A named list, containing at least these four elements:

value

A numeric, the value of the estimated optimum of objective.

parameter

A numeric vector, the parameter vector where the optimum of objective is obtained.

seconds

A numeric, the total optimization time in seconds.

initial

A numeric, the initial parameter values.

Appended are additional output elements of the optimizer (if not excluded by the output_ignore element via define_optimizer).

See Also

define_optimizer() for creating an optimizer object.

Examples

apply_optimizer(optimizer_nlm(), function(x) x^4 + 3*x - 5, 2)

[Package optimizeR version 1.1.1 Index]