11 Bayesian hypothesis testing: Asking the right questions when hypothesizing
The chapter introduces Bayesian hypothesis testing as a more direct way to compare competing explanations of data than classical p-values. Using a website redesign example, it contrasts the frequentist approach, which asks how surprising the observed conversions would be if the baseline rate were true, with the Bayesian approach, which explicitly compares a null model against an alternative model. Instead of focusing only on whether data are unusual under one hypothesis, Bayesian testing evaluates which hypothesis makes the data more plausible and uses that comparison to support real decisions.
A central tool in this framework is the Bayes factor, defined as the ratio of the data likelihoods under two competing hypotheses. In the example, the Bayes factor compares a fixed conversion rate of 0.1 with a broader beta model over possible rates. The chapter shows how this value can favor one model, how it differs from a p-value, and why the Bayesian setup requires a clear specification of both hypotheses. It also emphasizes that marginal likelihoods can be computed directly in simple cases, though more complex models may require approximation.
Beyond testing, the chapter highlights why Bayesian reasoning is especially useful in practice: it accounts for prior beliefs, lets evidence accumulate over time, and supports decision-making through posterior distributions rather than binary accept-or-reject rules. A small p-value or low likelihood under one hypothesis does not by itself settle the question, because prior plausibility and alternative explanations matter too. By updating beliefs as new data arrive, Bayesian methods can combine results across replications and estimate quantities like the probability that a conversion rate exceeds a business threshold. The chapter closes by showing how these posterior beliefs can be paired with costs and benefits to choose actions based on expected utility, rather than on statistical significance alone.
The PMF of the binomial distribution representing the number of conversions out of 500 site visitors given the null hypothesis. Most probability mass centers around 50 conversions.
The right tail region of the distribution corresponds to the event that the outcome is at least as extreme as the data. The likelihood of this event gives the 𝑝-value of the hypothesis test.
Two competing hypotheses about the conversion rate 𝑟. The first hypothesis states that 𝑟 is equal to 0.1, while the second states that 𝑟 follows a Beta(1, 1) distribution.
Diagram of Bayesian reasoning in weighing prior probabilities against evidence likelihoods to produce posteriors. The final posterior probabilities are what should inform court decisions.
Comparisons between the results from Bayesian hypothesis testing with the Bayes factor under a uniform prior (left) and a more informative prior (right). With the more informative prior, the Bayes factor offers support for both hypotheses, thus leading to less conclusive results about conversion improvement.
Left: the 𝑝-values obtained from independent binomial tests throughout six studies, only one of which shows statistical significance (in the frequentist sense). Right: the evolution of the Bayes factor comparing the constant hypothesis and a beta distribution that continually updates in light of new data. We gradually observe more evidence in support of the beta model.
Summary
- Classical hypothesis testing evaluates how surprising the data are under a null hypothesis using a 𝑝-value.
- A 𝑝-value doesn’t tell us how likely a hypothesis is given the data, nor does it directly guide decision making.
- Bayesian hypothesis testing treats hypotheses as competing models and compares how well they explain the observed data.
- The Bayes factor measures the relative evidence for two hypotheses by comparing their marginal likelihoods.
- Unlike 𝑝-values, Bayes factors allow us to quantify evidence in favor of either hypothesis, rather than only rejecting one hypothesis.
- Bayesian methods require explicitly specifying both competing hypotheses, making assumptions more transparent.
- Incorporating prior knowledge can meaningfully affect conclusions, especially when data are limited.
- Bayesian evidence accumulates naturally over time, allowing for sequential analysis over multiple replicated experiments without starting from scratch.
- Misinterpreting conditional probabilities (such as confusing 𝑝(𝐻 | 𝐷) with 𝑝(𝐷 | 𝐻)) can lead to serious reasoning errors, as illustrated by the prosecutor’s paradox.
- Posterior distributions can provide richer information than hypothesis tests, enabling us to answer more targeted questions about outcomes.
- Decisions should be based not only on evidence, but also on consequences, which can be formalized using expected values of possible actions.
Grokking Bayes ebook for free