
Run MCMC for an Opal object
opal_mcmc.RdSampling uses a fresh RTMB objective. It never changes the stored optimum.
init = "auto" uses the fitted point when available and the configured
active parameters otherwise. Failed sampler attempts are recorded and
warned about, preserving any existing posterior. The default sampler skips
internal optimisation; an MLE is optional. The default stan metric supports
bounds. Random effects are sampled jointly by default, over their full
domain, while fixed effects retain the object's bounds. Change bounds
with opal_update(). Use laplace = TRUE and metric = "unit"
for marginal sampling.
Usage
opal_mcmc(
x,
sampler = "snuts",
init = "auto",
check = TRUE,
check_args = list(),
...
)Arguments
- x
A configured or fitted
opal_obj.- sampler
"snuts"or a function accepting anobjargument and sampler settings.- init
Initial-value policy or explicit sampler initial values.
- check
Run posterior diagnostics.
- check_args
Arguments passed to
opal_check().- ...
Named sampler settings, including seed, chains, cores, num_samples, and num_warmup. The obj, globals, lower, and upper arguments are reserved.
Details
Defaults are four chains, four cores, 1,000 warm-up iterations, and 500
retained iterations per chain. Set seed and choose effort appropriate to
the assessment. After sampling, inspect x$validation$mcmc and
x$mcmc_history; a failed or unchecked attempt cannot replace a previously
checked, passing posterior. opal_as_tmbfit() exposes the selected samples
to SparseNUTS plotting and diagnostic tools.
See also
Other assessment workflow:
opal_attach_fit(),
opal_attach_mcmc(),
opal_build(),
opal_check(),
opal_derived(),
opal_example_inputs(),
opal_fit(),
opal_from_fit(),
opal_io,
opal_obj(),
opal_posterior(),
opal_project(),
opal_report(),
opal_update()