Usage
maxBFGS(fn, grad = NULL, hess=NULL, start, fixed = NULL,
print.level = 0, iterlim = 200, constraints = NULL,
tol = 1e-08, reltol=tol, parscale=rep(1, length=length(start)), ... )maxSANN(fn, grad = NULL, hess = NULL, start, fixed = NULL,
print.level = 0, iterlim = 10000, constraints = NULL,
tol = 1e-08, reltol=tol, cand = NULL, temp = 10, tmax = 10,
parscale = rep(1, length = length(start)),
random.seed = 123, ... )
maxNM(fn, grad = NULL, hess = NULL, start, fixed = NULL,
print.level = 0, iterlim = 500, constraints = NULL,
tol = 1e-08, reltol=tol, parscale = rep(1, length = length(start)),
alpha = 1, beta = 0.5, gamma = 2, ...)
Arguments
fn
function to be maximised. Must have the parameter vector as
the first argument. In order to use numeric gradient
and BHHH method, fn
must return vector of
observation-specific likelihood values. Those are summed by maxNR
if
grad
gradient of the function. Must have the parameter vector as
the first argument. If NULL
, numeric
gradient is used (only maxBFGS uses gradient). Gradient may return
a matrix, where columns correspond to the parameters and rows t
hess
Hessian of the function. Not used by any of these methods, for
compatibility with maxNR
. start
initial values for the parameters.
fixed
parameters that should be fixed at their starting values:
either a logical vector of the same length as argument start
,
a numeric (index) vector indicating the positions of the fixed parameters,
or a vector of character stri
print.level
a larger number prints more working information.
iterlim
maximum number of iterations.
constraints
either NULL
for unconstrained optimization
or a list with two components. The components may be either
eqA
and eqB
for equality-constrained optimization
$A \theta + B = 0$; or ineqA
and
tol, reltol
the relative convergence tolerance (see
optim
). tol
is for compatibility with maxNR
. cand
a function used in the "SANN"
algorithm
to generate a new candidate point;
if it is NULL
, a default Gaussian Markov kernel is used
(see argument gr
of optim
) temp
controls the '"SANN"' method. It is the starting
temperature for the cooling schedule. Defaults to '10'.
tmax
is the number of function evaluations at each temperature
for the '"SANN"' method. Defaults to '10'. (see
optim
) random.seed
an integer used to seed R's random number generator.
This is to ensure replicability when the Simulated Annealing
method is used. Defaults to 123.
parscale
A vector of scaling values for the parameters.
Optimization is performed on 'par/parscale' and these should
be comparable in the sense that a unit change in any element
produces about a unit change in the scaled value. (see
alpha, beta, gamma
Scaling parameters for the
'"Nelder-Mead"' method. 'alpha' is the reflection factor
(default 1.0), 'beta' the contraction factor (0.5) and
'gamma' the expansion factor (2.0). (see
optim
...
further arguments for fn
and grad
.