Bayesian Inference in Biology: An Introduction
A patient tests positive for a rare disease that affects 1 in 1,000 people. The test used is 99% accurate. What is the probability she actually has the disease? Most students—and many practicing clinicians—guess something close to 99%. The true answer is closer to 9%. The reason why is one of the most important ideas in all of quantitative biology. That gap between intuition and correct answer is exactly what Bayesian reasoning is built to close. Classical (frequentist) statistics is built around p-values and null-hypothesis significance testing. It asks: "if the null hypothesis were true, how surprising would this data be?" It never directly answers the question biologists actually want answered. That question is: "given this data, how probable is my hypothesis?" Bayesian inference answers exactly that question. It does so by treating hypotheses themselves as things that carry probabilities. These probabilities update as evidence accumulates. This is not a minor technical variant. It is a different philosophy of what probability means. It has direct consequences for how genomic variant calls, phylogenetic trees, disease diagnoses, and even the reproducibility of published findings should be interpreted. The big picture is this: every measurement in biology is noisy. Every test is imperfect. Every hypothesis competes against a background rate of how common it was before you collected data. Bayesian inference gives a formal, quantitative machinery—prior, likelihood, posterior—for combining prior knowledge with new evidence. Together these produce an updated belief. It is the same logic a clinician uses informally ("she's young and healthy, so even a positive test doesn't worry me too much"). Here, that logic is made rigorous and computable. This article builds the mechanism from first principles using Bayes' theorem. It works the diagnostic-test example in full numerical detail. It surveys the historical evidence and controversy behind the framework. It also connects forward to the simulation-based computational tools (Markov chain Monte Carlo, bootstrapping) that make modern Bayesian biology possible, previewing Simulation and Resampling Methods.
- Bayesian inference updates a prior probability into a posterior probability using observed data, via Bayes' theorem.
- Unlike p-values, posteriors answer the direct biological question: "given my data, how probable is this hypothesis?"
- The framework requires three ingredients: prior P(H), likelihood P(data | H), and a normalizing constant P(data).
- Base rates matter enormously: even highly accurate tests produce many false positives when the underlying condition is rare.
- The classic evidence base includes Bayes' and Laplace's original derivations, modern diagnostic-testing studies, and reproducibility work (Ioannidis 2005) showing p-values overstate evidence when priors are low.
- Bayesian methods now underpin phylogenetics (MrBayes, BEAST), genomic variant calling, and clinical decision support, foreshadowing Simulation and Resampling Methods used to compute posteriors numerically.
A Bayesian posterior probability is proportional to prior probability times likelihood—so the same data can support wildly different conclusions depending on how rare or common the hypothesis was to begin with.
The core idea
Bayesian inference is a framework for updating the probability of a hypothesis in light of new data, using Bayes' theorem: P(H | D) = [ P(D | H) × P(H) ] / P(D) Here H is a hypothesis (e.g., "this patient has the disease," "this SNP is a true variant," "this tree topology is correct") and D is the observed data. Each term has a name:
| Term | Name | Meaning | |
|---|---|---|---|
| P(H) | Prior | Probability of H before seeing the data | |
| P(D \ | H) | Likelihood | Probability of observing this data if H were true |
| P(D) | Marginal likelihood (evidence) | Total probability of the data, averaged over all hypotheses | |
| P(H \ | D) | Posterior | Updated probability of H after seeing the data |
The crucial conceptual shift from classical statistics is this: in the Bayesian framework, probability represents a degree of belief, not merely a long-run frequency of repeated trials. A frequentist p-value asks "what fraction of repeated experiments under the null would produce data this extreme?"—a statement about data, not hypotheses. A Bayesian posterior asks "given the data I actually observed, how credible is each hypothesis?"—a statement about hypotheses directly. This is exactly the question a biologist, physician, or geneticist usually wants answered, which is why Bayesian methods have become central wherever Reproducibility and P-Hacking concerns have exposed the limits of p-value-only inference: a "significant" p-value from a poorly-powered study testing a low-prior hypothesis can still correspond to a very low posterior probability that the effect is real. Bayes' theorem is not controversial as mathematics—it follows directly from the definition of conditional probability, P(H∩D) = P(H|D)P(D) = P(D|H)P(H). What has historically been controversial is the prior: where does P(H) come from, and is it legitimate to assign a probability to a hypothesis (like "gene X causes disease Y") that is either true or false, not a repeatable random event? Resolving that philosophical tension—and showing that priors can be chosen defensibly from previous data, population base rates, or explicit sensitivity analysis—is the central methodological project of Bayesian statistics.
Mechanism — how updating actually works
Step 1: Specify the prior, P(H). Before collecting data, assign a probability to each hypothesis under consideration. This can come from published prevalence data (e.g., disease incidence in a population), from previous experiments, or—when truly nothing is known—from a deliberately "flat" or weakly informative prior that lets the data dominate. In genomics, the prior for "this DNA site is a real mutation" might come from known mutation rates (~10⁻⁸ per base pair per generation in humans); in diagnostics, the prior is the disease's population prevalence.
Step 2: Specify the likelihood, P(D | H), for every hypothesis under consideration. This is the same likelihood function used in classical statistics (maximum-likelihood estimation), it just gets used differently. For a diagnostic test, this is the test's sensitivity (P(positive | disease)) and its complement, the false-negative rate, plus the false-positive rate (P(positive | no disease)) for the alternative hypothesis.
Step 3: Compute the marginal likelihood, P(D). This is the total probability of seeing the data, summed (or integrated, for continuous parameters) across all hypotheses weighted by their priors: P(D) = Σᵢ P(D | Hᵢ) × P(Hᵢ) This step is the computational bottleneck of Bayesian statistics—for simple two-hypothesis problems it is one line of algebra, but for realistic biological models with many parameters (a phylogenetic tree's branch lengths, a population genetic model's selection coefficients) this sum becomes an intractable high-dimensional integral. This is precisely the problem that motivates Simulation and Resampling Methods such as Markov chain Monte Carlo (MCMC), which approximate the posterior by drawing samples from it without ever computing P(D) explicitly.
Step 4: Combine into the posterior, P(H | D). Divide the numerator (prior × likelihood) by the marginal likelihood. The posterior is now a legitimate probability distribution over hypotheses—it sums (or integrates) to 1—and can itself become the prior for the next round of data, allowing sequential updating as more evidence arrives. This is the mechanism by which Bayesian inference naturally models how a clinician's belief, or a research field's confidence in a hypothesis, should evolve as replication studies accumulate.
Step 5: Summarize and act. The posterior distribution can be summarized by its mean, mode (maximum a posteriori, MAP estimate), or a credible interval (e.g., the range containing 95% of posterior probability)—which, unlike a frequentist confidence interval, can be interpreted directly as "there is a 95% probability the true parameter lies in this range."
The evidence — where the framework came from and how it was tested
Thomas Bayes and the billiard table (1763, posthumous). The Reverend Thomas Bayes, a Presbyterian minister and mathematician, devised a solution to an "inverse probability" problem: given a certain number of successes and failures in Bernoulli trials, what can we infer about the underlying probability of success? His manuscript, "An Essay towards solving a Problem in the Doctrine of Chances," used a physical thought experiment—a ball rolled onto a table, its resting position unknown, then a second ball rolled repeatedly to see how often it landed left or right of the first—to derive what is now recognized as the theorem bearing his name. It was read to the Royal Society in 1763 by his friend Richard Price after Bayes' death, and largely ignored for decades.
Pierre-Simon Laplace (1774–1812) independently rediscovered and generalized the result, applying it to astronomical and demographic problems—famously estimating the probability that the sun will rise tomorrow given it has risen every day in recorded history, and calculating that slightly more boys than girls are born using French birth registry data. Laplace's version, using what we would now call a uniform (flat) prior, is mathematically the more complete and usable form, and it was Laplace, not Bayes, who made inverse probability a working scientific tool for the following century.
The 20th-century eclipse and revival. Ronald Fisher, Jerzy Neyman, and Egon Pearson built the frequentist edifice (p-values, confidence intervals, hypothesis tests) partly in explicit reaction against subjective priors, arguing that scientific inference should not depend on a researcher's personal belief. Bayesian methods survived in niches (actuarial science, some physics) but were computationally infeasible for realistic biological models until the 1990s, when Markov chain Monte Carlo algorithms—borrowed from statistical physics (the Metropolis algorithm, 1953; Hastings' generalization, 1970; Gibbs sampling, Geman & Geman 1984)—made it possible to numerically approximate posteriors for models with hundreds of parameters. This computational breakthrough is what triggered the explosive adoption of Bayesian methods in modern computational biology, and directly motivates Simulation and Resampling Methods.
The diagnostic-testing evidence base. The clearest empirical demonstration of why Bayesian reasoning matters in biology and medicine comes from studies of screening test performance against known prevalence data. Gerd Gigerenzer and colleagues (1998, 2007) tested practicing physicians with problems structurally identical to the mammography example below—a rare disease, a test with known sensitivity and specificity—and found that the great majority of physicians, even experienced ones, dramatically overestimated the post-test probability of disease, frequently giving answers close to the test's raw sensitivity (e.g., 90%) rather than the correct Bayesian posterior (which can be under 10% for rare conditions). This was not a failure of arithmetic ability but a systematic cognitive bias—now called base-rate neglect—that Bayesian formalization is specifically designed to correct.
Reproducibility evidence. John Ioannidis's influential 2005 paper "Why Most Published Research Findings Are False" used explicitly Bayesian logic (formalized with a positive predictive value calculation structurally identical to the diagnostic-test formula) to show that when the prior probability that a tested hypothesis is true is low—as in exploratory genomic association studies scanning thousands of candidate genes—even a "statistically significant" p < 0.05 result yields a low posterior probability that the finding is a true positive. This work, alongside the replication crisis literature connected to Reproducibility and P-Hacking, has been a major driver of the biological research community's turn toward Bayesian reporting alongside or instead of raw p-values.
Worked examples
Example 1: The diagnostic test (the canonical case). A screening test for a genetic disease has:
| Quantity | Value | ||
|---|---|---|---|
| Disease prevalence, P(D+) | 1 in 1,000 = 0.001 | ||
| Sensitivity, P(test+ \ | D+) | 99% = 0.99 | |
| Specificity, P(test– \ | D–) | 99% = 0.99, so P(test+ \ | D–) = 0.01 |
A random individual tests positive. What is P(D+ | test+)? Apply Bayes' theorem. Take a hypothetical population of 100,000 people to make the arithmetic concrete:
- Diseased: 100,000 × 0.001 = 100 people
- True positives: 100 × 0.99 = 99
- False negatives: 100 × 0.01 = 1
- Not diseased: 100,000 × 0.999 = 99,900 people
- False positives: 99,900 × 0.01 = 999
- True negatives: 99,900 × 0.99 = 98,901
Total positives = 99 + 999 = 1,098
Posterior probability of disease given a positive test: P(D+ | test+) = 99 / 1,098 ≈ 0.090, or 9.0% Despite a test that is "99% accurate" in both directions, a positive result still leaves roughly a 91% chance the person does not have the disease—because false positives from the enormous healthy population (999 of them) vastly outnumber true positives from the tiny diseased population (99). This is the base-rate effect, and it is the single most common Bayesian calculation error made by clinicians and students alike. Note what happens if the same test is applied to a high-risk population where prevalence is 10% instead of 0.1%: diseased = 10,000, true positives = 9,900; not diseased = 90,000, false positives = 900; posterior = 9,900/10,800 ≈ 91.7%. Identical test, identical sensitivity and specificity—wildly different posterior, entirely because the prior changed. This is exactly why the same PCR or antibody test is interpreted differently in a population-wide screening program versus a hospital testing symptomatic patients referred by a physician who already suspects the diagnosis.
Example 2: Sequential updating with a genetic linkage hypothesis. Suppose a geneticist is testing whether a candidate marker M is linked to a disease locus (hypothesis H₁: linked, recombination fraction θ = 0.05) versus unlinked (H₀: θ = 0.5, independent assortment). Before any family data, based on the marker's chromosomal location relative to known disease-associated regions, the geneticist assigns a prior: P(H₁) = 0.20, P(H₀) = 0.80 A family study finds, out of 20 informative meioses, 2 are recombinant and 18 are non-recombinant. Compute the likelihood under each hypothesis using the binomial framework:
- Under H₁ (θ = 0.05): P(data | H₁) = C(20,2) × 0.05² × 0.95¹⁸ ≈ 190 × 0.0025 × 0.397 ≈ 0.1886
- Under H₀ (θ = 0.50): P(data | H₀) = C(20,2) × 0.5² × 0.5¹⁸ ≈ 190 × 0.25 × 0.00000381 ≈ 0.000181
Now apply Bayes' theorem: Numerator for H₁: 0.20 × 0.1886 = 0.03772 Numerator for H₀: 0.80 × 0.000181 = 0.0001448 P(D) = 0.03772 + 0.0001448 ≈ 0.03786
P(H₁ | data) = 0.03772 / 0.03786 ≈ 0.9962, or 99.6% Even though the prior favored the unlinked hypothesis 4-to-1 (80% vs. 20%), the family data is so much more probable under close linkage than under independent assortment (a likelihood ratio of roughly 1,042-to-1) that the posterior swings decisively to favor linkage. This mirrors the logic of the LOD score (logarithm of the odds) used throughout classical human linkage analysis, which is itself a Bayesian-flavored likelihood-ratio statistic—illustrating that Bayesian reasoning is not foreign to mainstream genetics but often hiding in plain sight within tools students already use.
Common misconceptions & traps
| Misconception | Correction | ||
|---|---|---|---|
| "A p-value is the probability the null hypothesis is true." | A p-value is P(data this extreme \ | H₀ true), not P(H₀ \ | data). Only a Bayesian posterior directly gives the latter. |
| "A 99%-accurate test means a positive result is 99% likely to be a true case." | Ignores the prior/base rate; for rare diseases the posterior can be far lower (see Example 1). | ||
| "Bayesian priors are just made up, so Bayesian results are subjective and unscientific." | Priors are often derived from prior data, known population parameters, or explicit sensitivity analyses; results are reported as a function of the prior, and weak priors are swamped by strong data. | ||
| "With enough data, the choice of prior doesn't matter, so priors are irrelevant." | True asymptotically for well-behaved models, but with small or moderate sample sizes (common in biology) the prior can dominate the posterior. | ||
| "Posterior probability and confidence interval mean the same thing." | A 95% credible interval means "95% probability the parameter is in this range"; a 95% confidence interval has a more convoluted long-run frequency interpretation and does not mean that. | ||
| "Bayesian and frequentist methods always give very different answers." | With large samples and flat/weak priors they often converge numerically, even though their interpretations differ philosophically. |
The scientist behind it
Thomas Bayes (c. 1701–1761) was an English Presbyterian minister educated at the University of Edinburgh, elected a Fellow of the Royal Society in 1742 primarily on the strength of earlier mathematical work defending Newton's calculus. He published almost nothing on probability during his lifetime. His now-famous essay was found among his papers after his death and communicated to the Royal Society by his friend, the philosopher and actuary Richard Price, in 1763. Bayes' original formulation was narrow and geometric, framed around the billiard-table thought experiment, and it took Pierre-Simon Laplace's independent, more general derivation in the following decades to turn "inverse probability" into a broadly usable scientific tool. It was not until the mid-20th century, through the work of statisticians Harold Jeffreys, Bruno de Finetti, Leonard "Jimmie" Savage, and later Dennis Lindley, that a coherent modern philosophical and mathematical foundation for Bayesian inference was established, and not until the computational revolution of the 1990s (MCMC) that it became routinely applicable to complex biological models like phylogenetic trees and hierarchical genomic models.
Origins · 1 minThomas Bayes and how this was discovered
Where this matters today
Clinical diagnostics and screening policy. Bayesian base-rate reasoning directly informs decisions about which populations should be screened for which conditions (e.g., mammography guidelines, prenatal genetic screening, COVID-19 testing strategy), because the same test's clinical utility changes with the prevalence of disease in the tested population.
Phylogenetics. Bayesian methods (implemented in software like MrBayes and BEAST) are now a dominant approach for reconstructing evolutionary trees from DNA sequence data, producing posterior probabilities for tree topologies and divergence-time estimates, using MCMC to sample from a posterior distribution over an astronomically large space of possible trees—an approach foreshadowed by Simulation and Resampling Methods.
Genomic variant calling. Modern DNA sequencing pipelines (e.g., GATK's HaplotypeCaller) use Bayesian models to compute the posterior probability that an observed sequencing read pattern reflects a true genetic variant versus a sequencing error, combining priors from known mutation rates and population allele frequencies with the likelihood of the observed sequencing reads.
Conservation biology and ecology. Bayesian hierarchical models are used to estimate species population sizes and extinction risk from sparse field-survey data, formally combining expert-elicited priors with limited observational data—crucial when endangered species are, by definition, rarely observed.
Epidemiology and outbreak response. During infectious disease outbreaks, Bayesian models update estimates of transmission rate (R₀), fatality rate, and epidemic trajectory in real time as new case data arrives, a direct application of sequential Bayesian updating under time pressure.
Personalized medicine and pharmacogenomics. Clinical decision-support tools increasingly report Bayesian posterior probabilities of drug efficacy or adverse reaction risk for a given patient's genotype, rather than population-average p-values, directly connecting the discussion of statistical rigor from Reproducibility and P-Hacking to individualized clinical action.
Ask the tutor: How does Markov chain Monte Carlo actually approximate a posterior distribution without ever calculating the marginal likelihood P(D) directly?
Is a Bayesian posterior probability the same thing as a p-value?
No. A p-value is P(observing data this extreme or more extreme | null hypothesis is true)—a statement about the probability of data under an assumed hypothesis. A posterior probability is P(hypothesis is true | observed data)—a statement about the hypothesis itself, directly incorporating prior information. They answer different questions and can give numerically very different answers, especially when the tested hypothesis had a low prior probability to begin with (as in most exploratory genomic screens), which is exactly the scenario examined in reproducibility studies like Ioannidis (2005).
Where does the prior probability actually come from in real biological research?
Priors can come from several legitimate sources: previously published studies or meta-analyses (an "empirical Bayes" approach), known population parameters like disease prevalence or mutation rate, expert elicitation formalized into a probability distribution, or deliberately weak/flat priors when little is known, letting the likelihood dominate. Good Bayesian practice requires reporting the chosen prior explicitly and often performing a sensitivity analysis, showing how the posterior would change under reasonable alternative priors—this transparency is what distinguishes rigorous Bayesian analysis from an accusation of "just making up numbers."
Why did Bayesian methods take nearly two centuries to become mainstream in biology?
Two obstacles: philosophical objections from Fisher, Neyman, and Pearson, who considered assigning probabilities to fixed (true-or-false) hypotheses illegitimate, and a computational barrier—posteriors for realistic multi-parameter biological models require solving high-dimensional integrals with no closed-form solution. This second obstacle was removed only in the 1990s with the practical adoption of Markov chain Monte Carlo algorithms, borrowed from statistical physics, which approximate posteriors by simulation rather than direct calculation—the topic developed further under Simulation and Resampling Methods.
How does Bayesian phylogenetics differ from traditional maximum-likelihood tree building?
Maximum-likelihood phylogenetics finds the single tree topology and branch lengths that maximize the likelihood of the observed DNA sequence data, without formally quantifying uncertainty across alternative trees. Bayesian phylogenetics instead computes a full posterior probability distribution over all plausible tree topologies, using MCMC to sample trees in proportion to their posterior probability; the fraction of sampled trees containing a given clade becomes that clade's posterior probability, giving a built-in, interpretable measure of confidence analogous to (but numerically distinct from) traditional bootstrap support values.
Does using a strong prior mean a Bayesian analysis is "rigged" toward a particular conclusion?
It can be, if the prior is chosen carelessly or dishonestly, which is precisely why transparent reporting and sensitivity analysis are essential in Bayesian biology. But a strong, well-justified prior (e.g., a hard physical constraint, or a mutation rate measured across thousands of pedigrees) is a legitimate and valuable form of information that a purely frequentist analysis simply discards. The key safeguard is that as sample size grows, a well-behaved likelihood eventually dominates any prior—so honest reporting of both the prior and how much the data actually shifted the posterior lets readers judge for themselves.
Can Bayesian and frequentist analyses of the same dataset disagree in practice?
Yes, especially with small samples or rare-event hypotheses—exactly the diagnostic-test scenario above, where a "99% accurate" test (a frequentist-style performance statistic) and a "9% posterior probability of disease" (the Bayesian answer to the question a patient actually cares about) are both true simultaneously and not contradictory. With large samples and weak priors the two frameworks typically converge numerically, but their interpretations always remain philosophically distinct.
What is the practical takeaway for a student reading a paper that reports Bayesian results?
Check three things: what prior was used and whether it is justified and reported explicitly; whether the posterior is summarized with a credible interval (interpretable directly as a probability) rather than confused with a confidence interval; and whether a sensitivity analysis was performed showing the conclusion is robust to reasonable alternative priors. A Bayesian analysis without a clearly stated, defensible prior is not more rigorous than a p-value—it is simply less transparent about its assumptions.