Control parameters for glmmTMB optimization
Control parameters for glmmTMB optimization
glmmTMBControl( optCtrl = NULL, optArgs = list(), optimizer = nlminb, profile = FALSE, collect = FALSE, parallel = NULL, eigval_check = TRUE )
optCtrl |
Passed as argument |
optArgs |
additional arguments to be passed to optimizer function (e.g.: |
optimizer |
Function to use in model fitting. See |
profile |
Logical; Experimental option to improve speed and robustness when a model has many fixed effects |
collect |
Logical; Experimental option to improve speed by recognizing duplicated observations. |
parallel |
Numeric; Setting number of OpenMP threads to evaluate the negative log-likelihood in parallel |
eigval_check |
Check eigenvalues of variance-covariance matrix? (This test may be very slow for models with large numbers of fixed-effect parameters.) |
The general non-linear optimizer nlminb is used by
glmmTMB for parameter estimation. It may sometimes be
necessary to tweak some tolerances in order to make a model
converge. For instance, the warning ‘iteration limit reached
without convergence’ may be fixed by increasing the number of
iterations using something like
glmmTMBControl(optCtrl=list(iter.max=1e3,eval.max=1e3)).
The argument profile allows glmmTMB to use some special
properties of the optimization problem in order to speed up estimation
in cases with many fixed effects. Enable this option using
glmmTMBControl(profile=TRUE).
Control parameters may depend on the model specification, because each
control component is evaluated inside TMBStruc, the output
of mkTMBStruc. To specify that profile should be
enabled for more than 5 fixed effects one can use
glmmTMBControl(profile=quote(length(parameters$beta)>=5)).
The optimizer argument can be any optimization (minimizing) function, provided that:
the first three arguments, in order, are the starting values, objective function, and gradient function;
it also takes a control argument;
it returns a list with elements (at least) par, objective, convergence (0 if convergence is successful) and message
(the code internally handles output from optim(), by renaming the value component to objective)
## fit with default (nlminb) and alternative (optim/BFGS) optimizer
m1 <- glmmTMB(count~ mined, family=poisson, data=Salamanders)
m1B <- update(m1, control=glmmTMBControl(optimizer=optim,
optArgs=list(method="BFGS")))
## estimates are *nearly* identical:
all.equal(fixef(m1), fixef(m1B))Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.