Run parallel MCMC sampling using JAGS.
run_jags(
data,
jags_code,
pars,
ST,
cores,
sample,
n.chains,
n.iter,
n.adapt,
inits
)
`mcmc.list``
Data.frame or tibble in long format.
A string. JAGS model, usually returned by make_jagscode()
.
Character vector of parameters to save/monitor.
A segment table (tibble), returned by get_segment_table
.
Only really used when the model contains varying effects.
Positive integer or "all". Number of cores.
1
: serial sampling. options(mc.cores = 3)
will dominate cores = 1
but not larger values of cores
.
>1
: parallel sampling on this number of cores. Ideally set chains
to the same value. Note: cores > 1
takes a few extra seconds the first
time it's called but subsequent calls will start sampling immediately.
"all"
: use all cores but one and sets chains
to the same value. This is
a convenient way to maximally use your computer's power.
One of
"post"
: Sample the posterior.
"prior"
: Sample only the prior. Plots, summaries, etc. will
use the prior. This is useful for prior predictive checks.
"both"
: Sample both prior and posterior. Plots, summaries, etc.
will default to using the posterior. The prior only has effect when doing
Savage-Dickey density ratios in hypothesis
.
"none"
or FALSE
: Do not sample. Returns an mcpfit
object without sample. This is useful if you only want to check
prior strings (fit$prior), the JAGS model (fit$jags_code), etc.
the number of parallel chains for the model
number of iterations to monitor
the number of iterations for adaptation. See
adapt
for details. If n.adapt = 0
then no
adaptation takes place.
A list if initial values for the parameters. This can be useful
if a model fails to converge. Read more in jags.model
.
Defaults to NULL
, i.e., no inits.
Jonas Kristoffer Lindeløv jonas@lindeloev.dk