ArticleslgStudy

mathematics

Bayes factor

Bayes factor is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Bayes factor rather than just read about it. In short: The Bayes factor (BF) is a ratio of two competing statistical models represented by their evidence, and is used to quantify the support for one model over the other. The models in question can have a common set of parameters, such as a null hypothesis and an alternative, but this is not necessary; for instance, it could also be a non-linear model compared to its linear approximation.

Bayes factor — main illustration
Bayes factor — illustration

Key takeaways

  • Bayes factor belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Bayes factor to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Bayes factor from memory before moving on to harder problems.

Reference excerpt

The Bayes factor (BF) is a ratio of two competing statistical models represented by their evidence, and is used to quantify the support for one model over the other. The models in question can have a common set of parameters, such as a null hypothesis and an alternative, but this is not necessary; for instance, it could also be a non-linear model compared to its linear approximation. The Bayes factor can be thought of as a Bayesian analog to the likelihood-ratio test, although it uses the integrated (i.e., marginal) likelihood rather than the maximized likelihood. As such, both quantities only coincide under simple hypotheses (e.g., two specific parameter values). Also, in contrast with null hypothesis significance testing, Bayes factors support evaluation of evidence in favor of a null hypothesis, rather than only allowing the null to be rejected or not rejected. Although conceptually simple, the computation of the Bayes factor can be challenging depending on the complexity of the model and the hypotheses. Since closed-form expressions of the marginal likelihood are generally not available, numerical approximations based on MCMC samples have been suggested. For certain special cases, simplified algebraic expressions can be derived; for instance, the Savage–Dickey density ratio in the case of a precise (equality constrained) hypothesis against an unrestricted alternative. Another approximation, derived by applying Laplace's approximation to the integrated likelihoods, is known as the Bayesian information criterion (BIC); in large data sets the Bayes factor will approach the BIC as the influence of the priors wanes. In small data sets, priors generally matter and must not be improper since the Bayes factor will be undefined if either of the two integrals in its ratio is not finite.

Definition The Bayes factor is the ratio of two marginal likelihoods; that is, the likelihoods of two statistical models integrated over the prior probabilities of their parameters. The posterior probability Pr⁡(M|D) of a model M given data D is given by Bayes' theorem:

Pr⁡(M|D)=Pr⁡(D|M)Pr⁡(M)Pr⁡(D). The key data-dependent term Pr⁡(D|M) represents the probability that some data are produced under the assumption of the model M; evaluating it correctly is the key to Bayesian model comparison. Given a model selection problem in which one wishes to choose between two models on the basis of observed data D, the plausibility of the two different models M1 and M2, parametrised by model parameter vectors θ1 and θ2, is assessed by the Bayes factor K given by

K=Pr⁡(D|M1)Pr⁡(D|M2)=∫Pr⁡(θ1|M1)Pr⁡(D|θ1,M1)dθ1∫Pr⁡(θ2|M2)Pr⁡(D|θ2,M2)dθ2=Pr⁡(M1|D)Pr⁡(D)Pr⁡(M1)Pr⁡(M2|D)Pr⁡(D)Pr⁡(M2)=Pr⁡(M1|D)Pr⁡(M2|D)Pr⁡(M2)Pr⁡(M1). When the two models have equal prior probability, so that Pr⁡(M1)=Pr⁡(M2), the Bayes factor is equal to the ratio of the posterior probabilities of M1 and M2. If instead of the Bayes factor integral, the likelihood corresponding to the maximum likelihood estimate of the parameter for each statistical model is used, then the test becomes a classical likelihood-ratio test. Unlike a likelihood-ratio test, this Bayesian model comparison does not depend on any single set of parameters, as it integrates over all parameters in each model (with respect to the respective priors). An advantage of the use of Bayes factors is that it automatically, and quite naturally, includes a penalty for including too much model structure. It thus guards against overfitting. For models where an explicit version of the likelihood is not available or too costly to evaluate numerically, approximate Bayesian computation can be used for model selection in a Bayesian framework, with the caveat that approximate-Bayesian estimates of Bayes factors are often biased. Other approaches are:

to treat model comparison as a decision problem, computing the expected value or cost of each model choice; to use minimum message length (MML). to use minimum description length (MDL).

Interpretation A value of K > 1 means that M1 is more strongly supported by the data under consideration than M2. Note that classical hypothesis testing gives one hypothesis (or model) preferred status (the 'null hypothesis'), and only considers evidence against it. The fact that a Bayes factor can produce evidence for and not just against a null hypothesis is one of the key advantages of this analysis method. Harold Jeffreys gave a scale (Jeffreys' scale) for interpretation of K:

The second column gives the corresponding weights of evidence in decihartleys (also known as decibans); bits are added in the third column for clarity. The table continues in the other direction, so that, for example, K≤10−2 is decisive evidence for M2. An alternative table, widely cited, is provided by Kass and Raftery (1995):

According to I. J. Good, the just-noticeable difference of humans in their everyday life, when it comes to a change degree of belief in a hypothesis, is about a factor of 1.3x, or 1 deciban, or 1/3 of a bit, or from 1:1 to 5:4 in odds ratio.

Example Suppose we have a random variable that produces either a success or a failure. We want to compare a model M1 where the probability of success is q = 1⁄2, and another model M2 where q is unknown and we take a prior distribution for q that is uniform on [0,1]. We take a sample of 200, and find 115 successes and 85 failures. The likelihood can be calculated according to the binomial distribution:

(200115)q115(1−q)85. Thus we have for M1

P(X=115∣M1)=(200115)(12)200≈0.006 whereas for M2 we have

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Bayes factor

Start with the simplest possible case. Write down what Bayes factor claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Bayes factor before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Bayes factor ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Bayes factor

In research
Bayes factor appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Bayes factor in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Bayes factor is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bayesian inference, Model selection, Statistical ratios, so understanding it makes those chapters shorter.
In everyday life
Look for Bayes factor outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Bayes factor” →

How to study Bayes factor in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Bayes factor means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Bayes factor out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Bayes factor in simple terms?

The Bayes factor (BF) is a ratio of two competing statistical models represented by their evidence, and is used to quantify the support for one model over the other. The models in question can have a common set of parameters, such as a null hypothesis and an alternative, but this is not necessary…

Why does Bayes factor matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Bayes factor?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Bayes factor.

Tags

  • Bayesian inference
  • Model selection
  • Statistical ratios

Keep exploring