Creates marginal model-averaged and conditional posterior distributions based on a BayesTools JAGS model, vector of parameters, formula, and a list of conditional specifications for each parameter. Computes inclusion Bayes factors for each marginal estimate via a Savage-Dickey density approximation.

as_marginal_inference(
  model,
  marginal_parameters,
  parameters,
  conditional_list,
  conditional_rule,
  formula,
  null_hypothesis = 0,
  normal_approximation = FALSE,
  n_samples = 10000,
  silent = FALSE,
  force_plots = FALSE
)

Arguments

model

model fit via the JAGS_fit function

marginal_parameters

parameters for which the the marginal summary should be created

parameters

all parameters included in the model_list that are relevant for the formula (all of which need to have specification of is_null_list)

conditional_list

list of conditional parameters for each marginal parameter

conditional_rule

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

formula

model formula (needs to be specified if parameter was part of a formula)

null_hypothesis

point null hypothesis to test. Defaults to 0

normal_approximation

whether the height of prior and posterior density should be approximated via a normal distribution (rather than kernel density). Defaults to FALSE.

n_samples

number of samples to be drawn for the model-averaged prior distribution

silent

whether warnings should be returned silently. Defaults to FALSE

force_plots

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

Value

as_marginal_inference returns an object of class 'marginal_inference'.