View source: R/generate_posterior_quantities.R
generate_posterior_quantities | R Documentation |
generate_posterior_quantities
automates the CmdStanR
$generate_quantities
method, which enables the "generated quantities"
block of a Stan model to be sampled from after a model is fit. This vastly
reduces memory requirements, particularly if per-sample posterior predictions
are desired.
generate_posterior_quantities(
fit_mcmc,
data_list,
out_dir = "outputs/cmdstan",
save_model_as = "",
return_type = c("paths", "draws_list"),
par_chains = getOption("mc.cores", 4)
)
fit_mcmc |
CmdStanR model environment or a full path to a saved CmdStanR fit (as an .RDS file). |
data_list |
Raw data that |
out_dir |
Path to output directory (relative to working directory). |
save_model_as |
Name to give model; defaults to model name from the fit metadata. |
return_type |
Return something other than the fit environment? Options
are |
par_chains |
Maximum number of chains to compute in parallel; defaults
to |
Either file paths or a posterior::draws_list.
## Not run:
data(example_data)
fit <- fit_learning_model(
example_data$nd,
model = "2a",
vb = FALSE,
exp_part = "training"
)
posterior_preds <- generate_posterior_quantities(
fit_mcmc = fit,
data_list = fit$stan_datalist,
return_type = "draws_list"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.