Algorithm Search⌘K

Definitioncore

Bayes factor

Also called Bayes factor test.

The ratio of the marginal likelihoods of the data under two models. It turns prior odds into posterior odds and does not depend on the prior probabilities of the models.

A Bayes factor compares two statistical models M0M_0 and M1M_1 by how well each one predicted the observed data xx, with its parameters averaged over its prior. It is the ratio B10(x)=m1(x)/m0(x)B_{10}(x) = m_1(x)/m_0(x) of the two marginal likelihoods. By Bayes's theorem, it is the factor that converts the prior odds of M1M_1 against M0M_0 into the posterior odds, so it does not depend on the prior probabilities of the two models. Jeffreys introduced it to test scientific hypotheses, and it is the Bayesian counterpart of the likelihood ratio.

Definition

Let xx be the data. For k=0,1k = 0, 1, model MkM_k has a parameter θk∈Θk\theta_k \in \Theta_k, a sampling density fk(x∣θk)f_k(x \mid \theta_k) and a proper prior density πk(θk)\pi_k(\theta_k). The marginal likelihood of MkM_k is

mk(x)=∫Θkfk(x∣θk) πk(θk) dθk.m_k(x) = \int_{\Theta_k} f_k(x \mid \theta_k)\, \pi_k(\theta_k)\, d\theta_k.

If 0<m0(x)<∞0 < m_0(x) < \infty and m1(x)<∞m_1(x) < \infty, the Bayes factor of M1M_1 against M0M_0 is

B10(x)=m1(x)m0(x),B01(x)=1B10(x).B_{10}(x) = \frac{m_1(x)}{m_0(x)}, \qquad B_{01}(x) = \frac{1}{B_{10}(x)}.

If MkM_k is a simple hypothesis θ=θk\theta = \theta_k, then mk(x)=f(x∣θk)m_k(x) = f(x \mid \theta_k), and for two simple hypotheses B10B_{10} is the likelihood ratio of the Neyman-Pearson lemma.

Odds form. For prior model probabilities P(M0),P(M1)>0P(M_0), P(M_1) > 0,

P(M1∣x)P(M0∣x)=B10(x) P(M1)P(M0),P(M1∣x)=B10(x) P(M1)B10(x) P(M1)+P(M0).\frac{P(M_1 \mid x)}{P(M_0 \mid x)} = B_{10}(x)\, \frac{P(M_1)}{P(M_0)}, \qquad P(M_1 \mid x) = \frac{B_{10}(x)\, P(M_1)}{B_{10}(x)\, P(M_1) + P(M_0)}.

Proof. P(Mk∣x)=P(Mk) mk(x)/m(x)P(M_k \mid x) = P(M_k)\, m_k(x)/m(x) with m(x)=P(M0)m0(x)+P(M1)m1(x)m(x) = P(M_0)m_0(x) + P(M_1)m_1(x). Divide the case k=1k = 1 by the case k=0k = 0. □\square

Three facts that follow from the definition.

  • Chaining. For three models, B20=B21B10B_{20} = B_{21} B_{10}, so Bayes factors order any set of models consistently.
  • Null expectation 1. If M0M_0 is simple, then E0[B10(X)]=∫m1(x) dx=1\mathbb{E}_0[B_{10}(X)] = \int m_1(x)\, dx = 1, because m1m_1 is a probability density. By Markov's inequality P0(B10≥k)≤1/kP_0(B_{10} \ge k) \le 1/k. So B10B_{10} is an e-variable for a simple null. For a composite null this fails in general.
  • Bounded by the maximized ratio. m1(x)≤sup⁡θ1f1(x∣θ1)m_1(x) \le \sup_{\theta_1} f_1(x \mid \theta_1), so if M0M_0 is simple, B10(x)B_{10}(x) is at most the maximized likelihood ratio, for every prior π1\pi_1.

Reading the size. Jeffreys (Appendix B) graded K=B01K = B_{01} in steps of half a unit of log⁡10\log_{10}. Against M0M_0: 11 to 101/2≈3.210^{1/2} \approx 3.2 is "not worth more than a bare mention", 3.23.2 to 1010 substantial, 1010 to 31.631.6 strong, 31.631.6 to 100100 very strong, and above 100100 decisive. Kass and Raftery (1995) give a coarser scale, quoted on the marginal likelihood page. These words are conventions, not error rates.

What a Bayes factor is not. It is a ratio of predictive probabilities, not a test with a level. The rule "reject M0M_0 when B10>kB_{10} > k" is a test, and its type I error is at most 1/k1/k for a simple null by the fact above, but the number B10B_{10} itself has no level and no type II error. It is also not a p-value and not the posterior probability of M0M_0; the posterior probability needs the prior odds as well.

Examples and non-examples

Example: a coin, exact. Toss a coin n=20n = 20 times and see y=15y = 15 heads. Let M0:θ=1/2M_0: \theta = 1/2 and M1:θ∼M_1: \theta \sim Beta(1,1)(1, 1), the uniform prior. Then

m0=(2015)2−20=155041048576=96965536,m1=(2015)∫01θ15(1−θ)5 dθ=(2015)15! 5!21!=121.m_0 = \binom{20}{15}2^{-20} = \frac{15504}{1048576} = \frac{969}{65536}, \qquad m_1 = \binom{20}{15}\int_0^1 \theta^{15}(1 - \theta)^5\, d\theta = \binom{20}{15}\frac{15!\, 5!}{21!} = \frac{1}{21}.

So B10=65536/20349≈3.221B_{10} = 65536/20349 \approx 3.221, and B01=20349/65536≈0.3105B_{01} = 20349/65536 \approx 0.3105. With prior odds 11, P(M1∣y)=65536/85885≈0.763P(M_1 \mid y) = 65536/85885 \approx 0.763. On Jeffreys's grades it is just past 101/2≈3.1610^{1/2} \approx 3.16, at the bottom of the substantial grade. The exact fractions agree with a direct sum of the binomial terms over a fine grid of θ\theta.

Example: the prior matters. With M1:θ∼M_1: \theta \sim Beta(a,a)(a, a) and the same data:

aa 0.01 0.1 0.5 1 2 5 10 100 1000
B10B_{10} 0.089 0.767 2.404 3.221 3.666 3.298 2.569 1.198 1.020

A very diffuse prior (a→0a \to 0 puts the mass near 00 and 11) wastes prior mass on values that the data rule out, and B10B_{10} goes to 00: the data then favour M0M_0. A very concentrated prior (a→∞a \to \infty) makes M1M_1 the same as M0M_0, and B10→1B_{10} \to 1. Unlike the posterior of θ\theta, the Bayes factor does not forget the prior as nn grows. The limit of this effect is the Lindley paradox.

Example: two simple hypotheses. For x∼N(θ,1)x \sim N(\theta, 1), M0:θ=0M_0: \theta = 0 and M1:θ=1M_1: \theta = 1, B10(x)=ex−1/2B_{10}(x) = e^{x - 1/2}. At x=2x = 2 it is e1.5≈4.48e^{1.5} \approx 4.48.

Non-example: the p-value. For the coin, the two-sided binomial p-value is P1/2(∣Y−10∣≥5)=0.0414P_{1/2}(\lvert Y - 10 \rvert \ge 5) = 0.0414. It is computed under M0M_0 alone, it is not B01=0.31B_{01} = 0.31, and it is not P(M0∣y)=0.237P(M_0 \mid y) = 0.237. See p-value.

Non-example: the maximized likelihood ratio. sup⁡θf(y∣θ)/f(y∣1/2)=(0.7515 0.255)/0.520≈13.68\sup_\theta f(y \mid \theta)/f(y \mid 1/2) = (0.75^{15}\, 0.25^{5})/0.5^{20} \approx 13.68 is the statistic of the likelihood ratio test. It uses the best θ\theta for the data, not an average over the prior, and it is an upper bound for B10B_{10} over every prior on M1M_1.

Non-example: a ratio with an improper prior. If π1\pi_1 is improper, c π1c\,\pi_1 is the same prior for every c>0c > 0, but it multiplies m1m_1 and the "Bayes factor" by cc. The ratio is not defined; see improper prior. Only parameters that both models share, with the same improper prior, are safe.

Non-example: posterior odds. P(M1∣x)/P(M0∣x)P(M_1 \mid x)/P(M_0 \mid x) equals B10B_{10} only when the prior odds are 11.

  • Marginal likelihood. The numerator and the denominator. Most of the work in practice is computing it.
  • Savage-Dickey density ratio. A formula, not a new quantity: when M0M_0 fixes ϕ=ϕ0\phi = \phi_0 inside M1M_1 and the priors are compatible, B01B_{01} equals the posterior density of ϕ\phi at ϕ0\phi_0 divided by its prior density there.
  • Lindley paradox. A theorem about the behaviour of B01B_{01} for a point null as nn grows with the z-statistic fixed, or as the prior spreads. It explains why B01B_{01} and a p-value can disagree.
  • Bridge sampling and nested sampling. Monte Carlo methods that estimate mk(x)m_k(x) or the ratio m1/m0m_1/m_0; they compute the Bayes factor and do not change its definition.
  • Bayesian information criterion. −12BICk-\tfrac12\mathrm{BIC}_k approximates log⁡mk(x)\log m_k(x) with an error of order 11, so 12(BIC0−BIC1)\tfrac12(\mathrm{BIC}_0 - \mathrm{BIC}_1) is a rough approximation to log⁡B10\log B_{10} that does not depend on the prior.
  • Intrinsic and fractional Bayes factors. To use default improper priors, Berger and Pericchi (1996) train them into proper priors on minimal subsets of the data and average over the subsets. O'Hagan (1995) uses a fraction bb of the likelihood for the same purpose. Both are approximations to some Bayes factor, not Bayes factors of the original priors.
  • Posterior model probabilities. With more than two models, P(Mk∣x)∝P(Mk) mk(x)P(M_k \mid x) \propto P(M_k)\, m_k(x). Bayesian model averaging uses them as weights.
  • Likelihood ratio test. The frequentist relative: it maximizes over the parameters where the Bayes factor integrates, and it is calibrated by its distribution under M0M_0.
  • Predictive criteria. PSIS-LOO and WAIC score prediction of each point from the posterior. The Bayes factor scores prediction of all the data from the prior. The two can disagree, and only the Bayes factor depends on how diffuse the prior is.

References

  1. Robert E. Kass and Adrian E. Raftery, Bayes factors, Journal of the American Statistical Association 90(430), 1995, pages 773 to 795 (the definition, the scale for interpretation, the Schwarz approximation, and the methods to compute marginal likelihoods; general locator)
  2. Harold Jeffreys, Theory of Probability, 3rd edition (1961), reprinted in Oxford Classic Texts in the Physical Sciences, Oxford University Press, 1998, Chapter 5 (significance tests with one new parameter) and Appendix B (the grades of the Bayes factor K)
  3. Christian P. Robert, Nicolas Chopin and Judith Rousseau, Harold Jeffreys's Theory of Probability revisited, Statistical Science 24(2), 2009, pages 141 to 172 (Jeffreys's tests, Appendix B and its grades of K; general locator)
  4. Berger and Pericchi 1996, the intrinsic Bayes factor built from minimal training samples (general locator)
  5. O'Hagan 1995, the fractional Bayes factor that uses a fraction b of the likelihood to train an improper prior (general locator)
  6. Christian P. Robert, The Bayesian Choice, 2nd edition, Springer, 2007, Chapter 5 (tests and confidence regions, Bayes factors, and the conflict with p-values) and Chapter 7 (model choice)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/T4B5GB/text.yaml