bayespecon.diagnostics.bayesfactor.bic_to_bf

bayespecon.diagnostics.bayesfactor.bic_to_bf(bic_values, denominator=None, log=False)[source]

Convert BIC values to Bayes factors via the BIC-approximation method.

Following bayestestR ([Wagenmakers, 2007]):

\[BF_{10} = \exp((BIC_0 - BIC_1) / 2)\]
Parameters:
bic_values : array-like

Vector of BIC values, one per model.

denominator : float or None

The BIC value of the denominator (reference) model. If None, uses the first model as the denominator.

log : bool, default False

If True, return log(BF) instead of BF.

Returns:

Bayes factors (or log Bayes factors if log=True) relative to the denominator model.

Return type:

numpy.ndarray

Examples

>>> bic1, bic2, bic3 = 100, 95, 110
>>> bic_to_bf([bic1, bic2, bic3], denominator=bic1)  # BF against model 1
array([1.        , 12.18249396,  0.082085  ])