Learn R Programming

BayesTools (version 0.3.0)

as_mixed_posteriors: Export BayesTools JAGS model posterior distribution as model-average posterior distributions via mix_posteriors

Description

Creates a model-averages posterior distributions on a single model that allows mimicking the mix_posteriors functionality. This function is useful when the model-averaged ensemble is based on prior_spike_and_slab or prior_mixture priors - the model-averaging is done within the model.

Usage

as_mixed_posteriors(
  model,
  parameters,
  conditional = NULL,
  conditional_rule = "AND",
  force_plots = FALSE,
  transform_scaled = FALSE,
  n_prior_samples = 10000
)

Value

as_mix_posteriors returns a named list of mixed posterior distributions (either a vector of matrix).

Arguments

model

model fit via the JAGS_fit function

parameters

vector of parameters names for which inference should be drawn

conditional

a character vector of parameters to be conditioned on

conditional_rule

a character string specifying the rule for conditioning. Either "AND" or "OR". Defaults to "AND".

force_plots

temporal argument allowing to generate conditional posterior samples suitable for prior and posterior plots. Only available when conditioning on a single parameter.

transform_scaled

whether to transform samples from standardized (scaled) to original (unscaled) scale. When TRUE, posterior samples are transformed, and the result can be directly passed to plot_posterior which will automatically detect the transformation and use transformed deterministic prior densities. Requires a model fitted with formula_scale_list. Defaults to FALSE.

n_prior_samples

controls the numerical grid used for transformed prior densities when transform_scaled = TRUE. Defaults to 10000.

See Also

mix_posteriors