Deprecated version of wrapper function. Use sample_nuts or sample_rwm instead.
Source:R/sample_admb.R
sample_admb.Rd
Deprecated version of wrapper function. Use sample_nuts or sample_rwm instead.
Usage
sample_admb(
model,
path = getwd(),
iter = 2000,
init = NULL,
chains = 3,
warmup = NULL,
seeds = NULL,
thin = 1,
mceval = FALSE,
duration = NULL,
parallel = FALSE,
cores = NULL,
control = NULL,
skip_optimization = TRUE,
algorithm = "NUTS",
skip_monitor = FALSE,
skip_unbounded = TRUE,
admb_args = NULL
)
Arguments
- model
Name of model (i.e., 'model' for model.tpl). For non-Windows systems this will automatically be converted to './model' internally. For Windows, long file names are sometimes shortened from e.g., 'long_model_filename' to 'LONG_~1'. This should work, but will throw warnings. Please shorten the model name. See https://en.wikipedia.org/wiki/8.3_filename.
- path
Path to model executable. Defaults to working directory. Often best to have model files in a separate subdirectory, particularly for parallel.
- iter
The number of samples to draw.
- init
Can be either a list containing a vector for each chain, a function which returns a vector of parameters, or NULL which specifies to use the MLE as stored in the admodel.hes file. It is generally recommended to use dispersed initial values to improve diagnostic checks (starting from the same point makes it less likely to find multiple modes).
- chains
The number of chains to run.
- warmup
The number of warmup iterations.
- seeds
A vector of seeds, one for each chain.
- thin
The thinning rate to apply to samples. Typically not used with NUTS.
- mceval
Whether to run the model with
-mceval
on samples from merged chains.- duration
The number of minutes after which the model will quit running. It is recommended to set the warmup carefully and iter higher than expected so it runs through duration. This usually results in chains with different lengths, so the minimum is taken across them all.
- parallel
A deprecated argument, use cores=1 for serial execution or cores>1 for parallel (default is to parallel with cores equal to the available-1)
- cores
The number of cores to use for parallel execution. Default is number available in the system minus 1. If
cores=1
, serial execution occurs (even ifchains>1
), otherwise parallel execution via package snowfall is used. For slow analyses it is recommended to setchains
<=cores
so each core needs to run only a single chain.- control
A list to control the sampler. See details for further use.
- skip_optimization
Whether to run the optimizer before running MCMC. This is rarely need as it is better to run it once before to get the covariance matrix, or the estimates are not needed with adaptive NUTS.
- algorithm
The algorithm to use, one of "NUTS" or "RWM"
- skip_monitor
Whether to skip calculating diagnostics (effective sample size, Rhat) via the
rstan::monitor
function. This can be slow for models with high dimension or many iterations. The result is used in plots and summaries so it is recommended to turn on. If model run withskip_monitor=FALSE
you can recreate it post-hoc by settingfit$monitor=rstan::monitor(fit$samples, fit$warmup, print=FALSE)
.- skip_unbounded
Whether to skip returning the unbounded version of the posterior samples in addition to the bounded ones. It may be advisable to set to FALSE for very large models to save space.
- admb_args
A character string which gets passed to the command line, allowing finer control