bayesplain.core.dirichlet_multinomial.log_bayes_factor_goodness_of_fit¶
-
bayesplain.core.dirichlet_multinomial.log_bayes_factor_goodness_of_fit(counts, expected_shares, concentration=
1.0)[source]¶ Log Bayes factor for “the shares are unknown” against fixed shares.
Under the null the category probabilities are exactly
expected_shares; under the alternative they areDirichlet(a). Both marginal likelihoods are closed form and the multinomial coefficient cancels, leaving\[\log \mathrm{BF}_{10} = \log \mathcal{D}(a + n) - \log \mathcal{D}(a) - \sum_j n_j \log p_{0j}\]Examples
With two categories this is the Beta-binomial point-null Bayes factor:
>>> from bayesplain.core import beta_binomial >>> a = log_bayes_factor_goodness_of_fit([34, 186], [0.1, 0.9]) >>> b = beta_binomial.log_bayes_factor_point_null(34, 220, 0.1, 1.0, 1.0) >>> bool(abs(a - b) < 1e-9) True