Skip to contents

Draw samples from the posterior given a Stan/Torsten model and patient data

Usage

get_mcmc_posterior(
  mod,
  data,
  seed = 12345,
  chains = 1,
  iter_warmup = 500,
  iter_sampling = 500,
  output_dir = tempdir(),
  verbose = TRUE,
  method = c("hmc", "vi"),
  skip_processing = FALSE,
  ...
)

Arguments

mod

compiled Stan model

data

dataset (see new_stan_data())

seed

seed for sampling

chains

number of MCMC chains to simulate, passed on to Stan model

iter_warmup

number of warmup (burn-in) iterations

iter_sampling

number of regular sampling iterations

output_dir

output directory

verbose

verbosity

method

either hmc (Hamilton Monte Carlo, using NUTS by default) or vi (variational inference).

skip_processing

will return the raw output from the sampler, without further processing. This can sometimes be useful when errors occur in the processing stage.

...

arguments passed to mod$sample()

Common arguments to cmdstanr include:

  • chains

  • parallel_chains

  • iter_warmup

  • iter_sampling

  • thim

  • adapt_delta

See also