Skip to contents

Run MCMC using rtmbstan

Usage

do_mcmc(obj, chains, cores, iter, thin, bounds = Inf, laplace = FALSE, ...)

Arguments

obj

Object built from ADFUN via RTMB

chains

Number of chains to run

cores

Number of cores to use

iter

Number of MCMC iterations to run

thin

Thinning rate

bounds

Uniform bounds to constrain parameter bounds

laplace

Whether or not to do laplace approximation for random effects and MCMC for fixed effects

...

Additional arguments for tmbstan (e.g., adapt_delta)

Value

MCMC list object from rtmbstan

Examples

if (FALSE) { # \dontrun{
obj <- RTMB::MakeADFun(cmb(SPoRC_rtmb, data), parameters = parameters, map = mapping)
mcmc <- do_mcmc(obj = obj,
                chains = 4,
                cores = 4,
                iter = 10000,
                thin = 10,
                bounds = 1.5,
                laplace = FALSE,
                adapt_delta = 0.99)
saveRDS(mcmc, here('output', 'MCMC_Model_23.5.rds'))
} # }