optimize: Optimize an Objective Function using Various Optimization...

View source: R/optimize.R

optimizeR Documentation

Optimize an Objective Function using Various Optimization Methods using optimx

Description

This function extends the existing optimization capabilities by integrating the 'optimx' package, allowing the use of various optimization algorithms such as "L-BFGS-B", "BFGS", "Nelder-Mead", etc.

Usage

optimize(
  objfn,
  parinit,
  method = "L-BFGS-B",
  lower = -Inf,
  upper = Inf,
  control = list(),
  ...
)

Arguments

objfn

A function that computes and returns a list with components 'value', 'gradient', and 'hessian'. This represents the objective function to be minimized.

parinit

A numeric vector of initial parameter values.

method

A character string specifying the optimization method. Defaults to "L-BFGS-B". Available methods include those supported by the 'optimx' package, such as "BFGS", "Nelder-Mead", "L-BFGS-B", etc.

lower

A numeric vector of lower bounds for the parameters (used only by methods that support box constraints, e.g., "L-BFGS-B"). Defaults to '-Inf'.

upper

A numeric vector of upper bounds for the parameters (used only by methods that support box constraints, e.g., "L-BFGS-B"). Defaults to 'Inf'.

control

A list of control parameters to pass to the optimization algorithm.

...

Additional arguments to pass to the objective function.

Value

A list containing: - 'value': The value of the objective function at the optimum. - 'gradient': The gradient at the optimum. - 'hessian': The Hessian at the optimum. - 'argument': The optimized parameters. - 'converged': Logical indicating if the optimizer converged. - 'iterations': The number of function evaluations.


dkaschek/dMod documentation built on March 1, 2025, 9:04 p.m.