mltoptim | R Documentation |
Define optimisers and their control parameters
mltoptim(
auglag = list(
kkt2.check = hessian, ### turn off/on numerical hessian
eps = abstol, ### absolute tolerance for _parameter_ updates
itmax = 1000L, ### max number of outer iterations
method = "BFGS", ### inner algorithm
maxit = 500L ### max number of inner (BFGS) iterations
),
spg = list(
ftol = abstol, ### absolute tolerance for _neg. logLik_
quiet = TRUE, ### don't talk
checkGrad = FALSE ### don't check analytical gradient
),
nloptr = list(
algorithm = "NLOPT_LD_MMA", ### inner algorithm
ftol_rel = reltol, ### relative change for _neg. logLik_
ftol_abs = abstol, ### absolute tolerance for _neg. logLik_
maxeval = 1000L ### max number of evaluations
),
constrOptim = list(
method = "BFGS", ### inner algorithm
maxit = 1000L, ### max number of inner (BFGS) iterations
outer.iterations = 500L, ### max number of outer iterations
outer.eps = reltol, ### relative change for _neg. logLik_
hessian = hessian ### turn off/on numerical hessian
),
nlminb = list(
checkconstraints = TRUE, ### return -Inf if violated
iter.max = 1000L, ### max number of iterations
eval.max = 1500L, ### max number of function evaluations
rel.tol = reltol, ### relative change for _neg. logLik_
abs.tol = 0.0, ### absolute tolerance (nll is not >= 0)
xf.tol = 1e-10
),
abstol = 1e-07,
reltol = 1e-6,
trace = FALSE,
hessian = FALSE)
auglag |
A list with control parameters for the |
spg |
A list with control parameters for the |
nloptr |
A list with control parameters for the |
constrOptim |
A list with control parameters for the |
nlminb |
A list with control parameters for the |
abstol , reltol |
Absolute and relative tolerances used as stopping criterion by various algorithms. |
trace |
A logical switching trace reports by the optimisers off. |
hessian |
A logical indicating if a numerically differentiated Hessian matrix be returned. |
This function sets-up functions to be called in mlt
internally.
A list of functions with arguments theta
(starting values), f
(log-likelihood),
g
(scores), h
(Hessian), ui
and ci
(linear inequality constraints).
Adding further such functions is a way to add more optimisers to mlt
.
The first one in this list converging defines the resulting model.
All procedures except nlminb
perform constained optimisation. The
model is only defined for parameters meeting the constraints. For
parameter configurations not meeting the constraints, the resulting
log-likelihood is -Inf
. This, however, does not mean that
unconstraint optimisation will always produce parameter estimates
which lead to valid models.
### set-up linear transformation model for conditional
### distribution of dist given speed
dist <- numeric_var("dist", support = c(2.0, 100), bounds = c(0, Inf))
ctmm <- ctm(response = Bernstein_basis(dist, order = 4, ui = "increasing"),
shifting = ~ speed, data = cars)
### use auglag with kkt2.check = TRUE => the numerically determined
### hessian is returned as "optim_hessian" slot
op <- mltoptim(auglag = list(maxtry = 5, kkt2.check = TRUE))[1]
mltm <- mlt(ctmm, data = cars, scale = FALSE, optim = op)
### compare analytical and numerical hessian
all.equal(c(Hessian(mltm)), c(mltm$optim_hessian), tol = 1e-4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.