Rcgmin
AND DO NOT USE DIRECTLY.The purpose of Rcgminu
is to minimize an unconstrained function
of many parameters by a nonlinear conjugate gradients method. This code is
entirely in R to allow users to explore and understand the method.
This code should be called through Rcgmin
which selects Rcgminb
or Rcgminu
according to the presence of bounds and masks.
Rcgminu(par, fn, gr, control = list(), ...)
A list with components:
The best set of parameters found.
The value of the objective at the best set of parameters found.
A two-element integer vector giving the number of calls to 'fn' and 'gr' respectively. This excludes those calls needed to compute the Hessian, if requested, and any calls to 'fn' to compute a finite-difference approximation to the gradient.
An integer code. '0' indicates successful convergence. '1' indicates that the function evaluation count 'maxfeval' was reached. '2' indicates initial point is infeasible.
A character string giving any additional information returned by the optimizer, or 'NULL'.
Returned index describing the status of bounds and masks at the proposed solution. Parameters for which bdmsk are 1 are unconstrained or "free", those with bdmsk 0 are masked i.e., fixed. For historical reasons, we indicate a parameter is at a lower bound using -3 or upper bound using -1.
A numeric vector of starting estimates.
A function that returns the value of the objective at the
supplied set of parameters par
using auxiliary data in ....
The first argument of fn
must be par
.
A function that returns the gradient of the objective at the
supplied set of parameters par
using auxiliary data in ....
The first argument of fn
must be par
. This function
returns the gradient as a numeric vector.
The use of numerical gradients for Rcgminu is STRONGLY discouraged.
An optional list of control settings.
Further arguments to be passed to fn
.
Functions fn
must return a numeric value.
The control
argument is a list.
A limit on the number of iterations (default 500). Note that this is
used to compute a quantity maxfeval
<-round(sqrt(n+1)*maxit) where n is the
number of parameters to be minimized.
Set 0 (default) for no output, >0 for trace output (larger values imply more output).
Tolerance used to calculate numerical gradients. Default is 1.0E-7. See
source code for Rcgminu
for details of application.
dowarn
= TRUE if we want warnings generated by optimx. Default is TRUE.
The source code Rcgminu
for R is likely to remain a work in progress for some time,
so users should watch the console output.
As of 2011-11-21 the following controls have been REMOVED
There is now a choice of numerical gradient routines. See argument
gr
.
To maximize user_function, supply a function that computes (-1)*user_function. An alternative is to call Rcgmin via the package optimx.
See Rcgmin
documentation.