Computes inclusion Bayes factors based on prior model probabilities, posterior model probabilities (or natural-log marginal likelihoods), and an indicator of whether the models represent the null or alternative hypothesis.

inclusion_BF(
  prior_probs,
  post_probs,
  margliks,
  is_null,
  on_failure = c("error", "drop", "zero")
)

Arguments

prior_probs

vector of prior model probabilities summing to one.

post_probs

vector of posterior model probabilities summing to one.

margliks

vector of natural-log marginal likelihoods.

is_null

logical vector of indicators 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)

on_failure

policy for missing marginal likelihoods in models with positive prior probability. See compute_inference().

Value

inclusion_BF returns a Bayes factor.

Details

Supplying margliks as the input is preferred since it is better at dealing with under/overflow (posterior probabilities are very close to either 0 or 1). In case that both the post_probs and margliks are supplied, the results are based on margliks. If the prior probability of either the null or alternative hypothesis is zero, the Bayes factor is undefined and NA is returned.