MathsStatistics & Probability

Bayes Factor
calculator.

A Bayes factor weighs how well two hypotheses predicted the data you actually saw.

How it's worked out

BF₁₀ is the probability of your data under the alternative, H₁, divided by its probability under the null hypothesis, H₀. Unlike a p-value, it can show support for H₀ as well as against it. Raftery writes the update in one line:

posterior odds\displaystyle \text{posterior odds}=BF10×prior odds\displaystyle {}=\;\text{BF}_{10} \times \text{prior odds}

Prior odds are your chance of H₁ divided by your chance of H₀ before the data. The posterior probability is then the posterior odds over one plus the posterior odds. Each of the four routes below is only a different way to reach BF₁₀, from whatever a paper or your software reported.

From a t statistic

This route uses the JZS default test of Rouder and colleagues. It puts a Cauchy prior with width r on the standardized effect size, and averages the t likelihood over that prior. The tool does this integral numerically. The BayesFactor R package names three widths: medium at about 0.707, wide at 1 and ultrawide at about 1.414. For two groups, the effective size NN and the degrees of freedom are:

N\displaystyle N=n1n2n1+n2\displaystyle {}= \frac{n_1 n_2}{n_1 + n_2}
df\displaystyle \text{df}=n1+n2−2\displaystyle {}= n_1 + n_2 - 2

From a BIC or a chi-square

Wagenmakers shows that a difference in BIC turns into an approximate Bayes factor, with a prior worth about one observation. Raftery gives the form for a likelihood-ratio chi-square, where N is the number of observations:

2ln⁡BF10\displaystyle 2 \ln \text{BF}_{10}≈χ2−dfln⁡N\displaystyle {}\approx \chi^2 - \text{df} \ln N

From a p-value alone

The bound of Sellke, Bayarri and Berger, as coded in the pcal package, caps how far a p-value below one over e can count against H₀. Its reciprocal is the most BF₁₀ can be, so this answer is a ceiling and not an estimate.

BF01\displaystyle \text{BF}_{01}≥−epln⁡p\displaystyle {}\ge -e\, p \ln p

Worked examples

The paired sleep study, with t of −4.06 on 10 patients

Student's 1908 sleep data test two drugs on 10 patients, and the paired t is −4.06. At the default width of 0.707, BF₁₀ is 17.26. That matches the 17.259 printed by the BayesFactor package, and it is strong evidence for a difference.

At a width of 1 it rises a little to 18.42, since a wider prior suits an effect this large. The BIC shortcut gives 57.75, a long way off, as you might expect with only 10 patients. From even odds, the chance of a real effect becomes 94.5%.

Open this example in the tool

Two groups of 40 with a small t of 0.8

BF₁₀ is 0.307, so BF₀₁ is 3.26. The data are 3.3 times more likely under H₀, which counts as moderate evidence for it. A p-value cannot say this, since a large p only means you failed to reject.

Prior width matters here. BF₀₁ runs from 2.52 at the narrow width to 5.96 at the ultrawide one. Wider priors make a small effect look worse for H₁, so state the width whenever you report the result.

Open this example in the tool

A chi-square of 10 from a model comparison

A likelihood-ratio chi-square of 10 on 1 degree of freedom, from 100 observations, gives a BF₁₀ of about 14.84. The same chi-square from 10,000 observations gives only 1.48, because with that much data a chi-square of 10 reflects a much smaller effect.

So the sample size is part of the evidence on this route. If your software gives you only the chi-square, look up N before you use this figure.

Open this example in the tool

Reading your result

Know what the labels are. Common labels are 1 to 3 anecdotal, 3 to 10 moderate, 10 to 30 strong, 30 to 100 very strong and above 100 extreme, with the same cuts for BF₀₁. They descend from Jeffreys' 1961 grades, and Lee and Wagenmakers changed "substantial" to "moderate". The JASP guidelines call such cuts rules of thumb, not strict lines. A BF₁₀ of 2.9 and one of 3.1 say much the same thing.

Keep the prior and the Bayes factor apart. The Bayes factor is the same for every reader, but the posterior depends on where each reader began. If H₁ had a 10% chance, a BF₁₀ of 10 takes it only to 52.6%. To go from even odds to 95%, you need a BF₁₀ of 19.

Check the width. The JASP guidelines recommend a robustness check: see whether your conclusion survives a range of plausible prior widths. If it does, say so. That still does not mean the evidence is strong.

Treat a p-value route as a ceiling. At p of 0.05 the most BF₁₀ can be is 2.46, which is at best anecdotal. The table applies the same bound to other p-values. Its last column starts from even odds and takes the most favorable alternative, so the true figure is usually lower.

The largest Bayes factor each p-value allows
p-valueLargest BF₁₀Highest chance of H₁
0.11.661.5%
0.052.4671.1%
0.017.9988.9%
0.00513.8993.3%
0.00153.2698.2%

Common mistakes

  • Reading BF₁₀ as the chance that H₁ is true. A BF₁₀ of 6 means the data were six times likelier under H₁. You need a prior to turn that into a probability.
  • Calling a BF near 1 evidence for no effect. Near 1, the data simply do not choose. Support for H₀ needs a BF₀₁ well above 1.
  • Quoting a BIC figure from a small study. The BIC routes are approximations for large samples, and Raftery calls the error somewhat crude in general terms. Use the t route when you have the t statistic.
  • Hiding the prior. A Bayes factor with no stated width cannot be checked. For the probability update on its own, use the Bayes' theorem calculator.

Questions people ask

A width of 0.707 is the usual reference, and it needs the least argument. It says half of the prior belief sits on effect sizes between minus 0.707 and 0.707. Pick a narrower width only if you have a reason to expect small effects, and report how the result moves across widths.

Sources