glmmTMBControl | R Documentation |
Control parameters for glmmTMB optimization
glmmTMBControl(
optCtrl = NULL,
optArgs = list(),
optimizer = nlminb,
profile = FALSE,
collect = FALSE,
parallel = list(n = getOption("glmmTMB.cores", 1L), autopar =
getOption("glmmTMB.autopar", NULL)),
eigval_check = TRUE,
zerodisp_val = log(.Machine$double.eps)/4,
start_method = list(method = NULL, jitter.sd = 0),
rank_check = c("adjust", "warning", "stop", "skip"),
conv_check = c("warning", "skip")
)
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 |
(named list with an integer value |
eigval_check |
Check eigenvalues of variance-covariance matrix? (This test may be very slow for models with large numbers of fixed-effect parameters.) |
zerodisp_val |
value of the dispersion parameter when |
start_method |
(list) Options to initialize the starting values when fitting models with reduced-rank ( |
rank_check |
Check whether all parameters in fixed-effects models are identifiable? This test may be slow for models with large numbers of fixed-effect parameters, therefore default value is 'warning'. Alternatives include 'skip' (no check), 'stop' (throw an error), and 'adjust' (drop redundant columns from the fixed-effect model matrix). |
conv_check |
Do basic checks of convergence (check for non-positive definite Hessian and non-zero convergence code from optimizer). Default is 'warning'; 'skip' ignores these tests (not recommended for general use!) |
By default, glmmTMB
uses the nonlinear optimizer
nlminb
for parameter estimation. Users may sometimes
need to adjust optimizer settings in order to get models to
converge. For instance, the warning ‘iteration limit reached
without convergence’ may be fixed by increasing the number of
iterations using (e.g.)
glmmTMBControl(optCtrl=list(iter.max=1e3,eval.max=1e3))
.
Setting profile=TRUE
allows glmmTMB
to use some special
properties of the optimization problem in order to speed up estimation
in cases with many fixed effects.
Control parameters may depend on the model specification. The value
of the controls is evaluated inside an R object that is derived from
the output of the mkTMBStruc
function. For example,
to specify that profile
should be enabled if the model has
more than 5 fixed-effect parameters, specify
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;
the function also takes a control
argument;
the function returns a list with elements (at least) par
, objective
, convergence
(0 if convergence is successful) and message
(glmmTMB
automatically 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.