algoObj: Constructor for 'minAlgo' classes

View source: R/minAlgo.R

algoObjR Documentation

Constructor for minAlgo classes

Description

This function creates an object that defines minimization solvers. The purpose is to homogenize the call of optimization solvers. These objects can be used by the method minFit to call the associated solvers using the same arguments, and to return the solution using a list with the same names.

Usage

algoObj(algo, start, fct, grad, solution, value, message, convergence)  

Arguments

algo

The name of the solver function to be called in character format. All arguments for the solver optim, nlminb, constrOptim and nlm are determined automatically. The other arguments are only needed for solvers coming from other packages.

start

The name of the argument representing the starting value in character format.

fct

The name of the argument representing the function to minimize in character format.

grad

The name of the argument representing the gradient in character format.

solution

The name of the element of the list returned by the solver that represents the solution, in character format.

value

The name of the element of the list returned by the solver that represents the value of the function at the solution, in character format.

message

The name of the element of the list returned by the solver that represents the convergence message, in character format.

convergence

The name of the element of the list returned by the solver that represents the convergence code, in character format.

Value

An object of class minAlgo.

See Also

minFit for examples on how to use this class object.

Examples

## The optim algorithm:
algo1 <- algoObj("optim")

## The nlminb algorithm:
algo2 <- algoObj("nlminb")

## Defining the algorithm lbfgs from the nloptr package

## Not run: 
algo3 <- algoObj(algo="lbfgs", start="x0", fct="fn",
                 grad="gr", solution="par", value="value",
                 message="message", convergence="convergence")

## End(Not run)


momentfit documentation built on June 26, 2024, 3 p.m.