Bayesian t-Test

Statistics
Introduced by
Rouder, Speckman, Sun, Morey & Iverson
Year
2009
Type
Bayesian hypothesis test

What does it do?

The Bayesian t-test, formalised by Rouder and colleagues in 2009, compares two group means on a continuous outcome within a Bayesian framework.

Instead of a p-value, it reports a Bayes Factor (BF₁₀) that quantifies how strongly the data favour the alternative hypothesis over the null, together with the posterior distribution of the standardised effect size δ and its 95% highest-density interval (HDI).

The intuition behind the method

Think of two groups of measurements. A frequentist t-test asks whether a gap this large could plausibly arise by chance if there were no real difference. The Bayesian t-test asks a different question: how much more probable are the observed data under the hypothesis of a difference than under the hypothesis of no difference? That ratio is the Bayes Factor. A BF₁₀ of 10 means the data are ten times more likely under the difference hypothesis than under the no-difference hypothesis. The method also returns a probability distribution for how large the standardised difference is, so the answer is a range of plausible effect sizes rather than a yes-or-no verdict.

History

Rouder, Speckman, Sun, Morey, and Iverson presented Bayesian t tests for accepting and rejecting the null hypothesis in their 2009 paper in Psychonomic Bulletin & Review. The method described here, a Bayesian comparison of two group means, is based on that line of work. Choices such as the prior scale should be stated explicitly in any report.

When to use it

Choose the Bayesian t-test when you compare two independent groups on a continuous outcome and want graded evidence, not only a significance decision. It is useful when you need to quantify support for the null hypothesis, which a non-significant p-value cannot do, or when you want to report the effect size with its full posterior uncertainty. With modest samples, an explicit prior on the effect size helps keep the estimate stable. With very small samples, however, the result depends heavily on the prior, so the sample size should be reported and a prior-sensitivity analysis carried out. Avoid the test when the within-group Normal model with a common variance is clearly inappropriate, or when the design is paired or repeated, which requires a different model.

Limitations and considerations

  • With very small samples the posterior can be dominated by the prior, and BF₁₀ then says little about the data.
  • The Cauchy scale r is a modelling choice; defensible alternative values can move BF₁₀ noticeably, so results should be checked across a range of scales.
  • The model assumes Normal observations with a common variance in both groups. If the groups differ strongly in spread or the outcome is far from Normal, the Bayes Factor answers a question about a model that does not fit the data.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • BF₁₀ expresses evidence for both H₁ and H₀, whereas a p-value can only fail to reject H₀ and cannot support it.
  • The posterior distribution of δ and its 95% HDI report the effect size with its full uncertainty, not only a point estimate and a standard error.
  • The prior on δ is explicit and can be inspected, so its influence on the result can be examined and reported.
  • Probability statements about δ, such as the posterior probability that it lies within the HDI, follow directly from the posterior without reference to repeated sampling.

Applications

  • Two-condition experiments in psychology with small samples, where an explicit prior helps stabilise the effect-size estimate.
  • Studies where support for the absence of a group difference, rather than a failure to reject it, is the actual question, reported with BF₁₀ and the HDI.
  • Replication analyses asking whether new two-group data favour an effect or its absence.
  • Reporting two-group results as a posterior range of standardised effect sizes, when the common-variance Normal model is defensible for the data.

How it works

How it works

1

Bayes' rule updates prior odds between H₁ (a difference exists) and H₀ (no difference) by multiplying them by the Bayes Factor, giving posterior odds. BF₁₀ is the ratio of the marginal likelihood of the data under H₁ to its marginal likelihood under H₀. Values well above 1 favour H₁ and values well below 1 favour H₀. Verbal labels such as 'strong evidence' for BF₁₀ above 10 (or below 1/10) are conventions rather than sharp thresholds, and intermediate values call for cautious wording.

Formula
p(H_1 \mid \text{data}) / p(H_0 \mid \text{data}) = BF_{10} \times p(H_1)/p(H_0)
2

Each observation is modelled as Normally distributed within its group, with both groups sharing a common variance σ². The parameter of interest is the standardised mean difference δ = (μ₁ − μ₂)/σ. Under H₁, δ receives a Cauchy prior centred at zero with scale parameter r. Under H₀, 'no difference' corresponds to the point value δ = 0. The prior scale r shapes the result, so it must be stated and justified in any report.

Formula
x_{ij} \sim \mathcal{N}(\mu_j,\, \sigma^2),\quad \delta = (\mu_1 - \mu_2)/\sigma \sim \text{Cauchy}(0, r)
3

Multiplying the likelihood by the prior gives the posterior distribution of δ given the data. From it one reads the posterior mean as a point estimate of effect size, and the 95% HDI, the shortest interval containing 95% of the posterior probability. The Bayes Factor compares the marginal likelihoods under H₁ and H₀. Depending on the implementation, these quantities are obtained analytically or numerically (closed-form or MCMC), so the computation used in any given software should be checked.

Formula
p(\delta \mid \text{data}) \propto p(\text{data} \mid \delta)\, p(\delta)

Common pitfalls

  • Reading BF₁₀ = 3 as strong evidence; values between 1 and 10 indicate only modest support and should be described with restraint.
  • Reporting the Bayes Factor without the prior scale r, which makes the result impossible to reproduce.
  • Skipping prior-sensitivity checks when the prior is contested or the sample is small.
  • Interpreting the 95% HDI as a frequentist confidence interval; the HDI is a direct statement about posterior probability for δ, given the prior and the data.
  • Applying the test to very small samples without acknowledging that BF₁₀ may mainly reflect the prior.
  • Interpreting BF₁₀ without first checking the Normal and common-variance assumptions. Inspect residuals and group variances; if the variances differ strongly or outliers are present, consider a robust or unequal-variance Bayesian model, and state which model was checked and used.

Frequently asked questions

What does BF₁₀ = 10 actually mean?

It means the observed data are ten times more probable under the hypothesis that a difference exists (H₁) than under the hypothesis of no difference (H₀). Labelling BF₁₀ above 10 as strong evidence for H₁ is a convention, not a sharp threshold.

How do I choose the Cauchy scale parameter r?

The scale r sets how large standardised differences are expected to be before the data are seen. If you have genuine prior information about the effect size, for instance from earlier studies, choose r to reflect it. Whatever value you use must be stated in the report, and you should test at least one alternative value to see how sensitive BF₁₀ is to that choice.

Can the Bayesian t-test confirm the null hypothesis?

Yes, this is one of its key advantages over frequentist testing. A BF₁₀ below 1/10 (equivalently BF₀₁ above 10) indicates that H₀ is much more compatible with the data than H₁. A frequentist p-value above 0.05 cannot make this claim; it only fails to reject the null.

What is a Highest Density Interval and how does it differ from a confidence interval?

The 95% HDI is the shortest posterior interval that contains 95% of the probability mass. It is a direct statement: given the data and the prior, there is a 95% probability that δ lies in that range. A frequentist 95% confidence interval is a statement about the long-run coverage of the procedure across hypothetical replications, not about any single computed interval. The two intervals can overlap numerically but carry different interpretations.

Related methods

Sources

  1. Rouder, J. N., Speckman, P. L., Sun, D., Morey, R. D. & Iverson, G. (2009). Bayesian t Tests for Accepting and Rejecting the Null Hypothesis. Psychonomic Bulletin & Review, 16(2), 225–237.

    Open DOI reference