Computes prior probabilities, posterior probabilities, and inclusion Bayes factors based either on (1) a list of models, vector of parameters, and a list of indicators the models represent the null or alternative hypothesis for each parameter, (2) on prior model odds, marginal likelihoods, and indicator whether the models represent the null or alternative hypothesis, or (3) list of models for each model.

compute_inference(
  prior_weights,
  margliks,
  is_null = NULL,
  conditional = FALSE,
  on_failure = c("error", "drop", "zero")
)

ensemble_inference(
  model_list,
  parameters,
  is_null_list,
  conditional = FALSE,
  on_failure = c("error", "drop", "zero")
)

models_inference(model_list, on_failure = c("error", "drop", "zero"))

Arguments

prior_weights

vector of prior model odds

margliks

vector of natural-log marginal likelihoods

is_null

logical vector of indicators specifying whether the model corresponds to the null or alternative hypothesis (or an integer vector indexing models corresponding to the null hypothesis; use 0 or integer(0) when no models are null)

conditional

whether prior and posterior model probabilities should be returned only for the non-null models. Defaults to FALSE. Inclusion Bayes factors stay the unconditional inclusion odds; after conditioning, posterior inclusion is 1, so recomputing the Bayes factor from the renormalized probabilities would be Inf.

on_failure

policy for missing (NA) marginal likelihoods in models with positive prior probability. "error" aborts (the default), "drop" removes failed models from the prior model space and renormalizes, and "zero" explicitly assigns the failed models zero evidence. Non-default policies emit a warning and return audit metadata. Only NA is treated as a computation failure under this policy. In model lists, store a failed computation as bridgesampling_object(NA), a result flagged as failed whose marginal likelihood is read as NA. A finite failure must be reported as NA; by contrast, -Inf is an intentional zero-evidence shortcut (for example via bridgesampling_object()) and quietly receives posterior model probability zero without consulting on_failure.

model_list

list of models, each of which contains marginal likelihood estimated with bridge sampling marglik and prior model odds prior_weights

parameters

vector of parameters names for which inference should be drawn

is_null_list

list with entries for each parameter carrying either logical vector of indicators specifying whether the model corresponds to the null or alternative hypothesis (or an integer vector indexing models corresponding to the null hypothesis; use 0 or integer(0) when no models are null) Exact matching unique list names bind by parameter name; other ensemble lists retain positional order. Marginal inference requires unnamed lists or unique complete names matching its requested parameters.

Value

compute_inference returns a named list of prior probabilities, posterior probabilities, and Bayes factors. ensemble_inference gives a list of named lists of inferences for each parameter, and models_inference returns a list of models, each expanded by the inference list.

Details

Dropping every positive-prior-probability model stops because no finite marginal likelihood is available; it does not renormalize an empty model space. Original positive model odds retain their logarithmic declaration even when the visible probability rounds to zero. Evidence is centered before model probabilities and inclusion Bayes factors are evaluated. Finite evidence differences outside the logarithmic range stop with BayesTools_numerical_condition. The returned numeric fields remain ordinary probabilities; passing a visible zero to inclusion_BF() retains that function's exact supplied-zero meaning.