Skip to text
Measure of Chance

Chapter IV · 32 min

Bayes' Theorem

The words, then the inversion

“The probability of any event is the ratio between the value at which an expectation depending on the happening of the event ought to be computed, and the value of the thing expected upon its happening.”

— Thomas Bayes, An Essay towards solving a Problem in the Doctrine of Chances (1763)

Bayes’ theorem is not a new axiom, and it is not a personality. It is the multiplication rule, solved for the factor you did not observe. You see a test result; you want the disease. You see an email; you want “spam or not”. You see data; you want the story that produced it. The theorem is permission to invert the arrow.

The formula is short. The words around it are what scare people — prior, likelihood, evidence, posterior, hypothesis. They sound like a secret handshake. They are not. Each one is a role in a three-line play: a story you might believe, a thing you just saw, and a number for how much the seeing should change the believing. This chapter names the cast before anyone has to act.

You already know the tree

Chapter III drew a tree: first the disease (rare), then the test. You read it root to leaf. Bayes is the same tree read leaf to root. The test result is in; you ask which first-branch you are probably on. No new arithmetic. A new question. If conditional probability still feels like a ratio of regions, stay there one more minute: Bayes is that ratio, solved for the factor you did not observe.

The words, one at a time

We will use a clinic as a running picture, but the words do not belong to medicine. They belong to any situation with a hidden story and a visible clue.

Hypothesis

A hypothesis is a story about the world that might be true. Not a guess you are married to — just a labelled branch. In the clinic the two hypotheses are “has the disease” () and “does not” (). In an inbox they are “spam” and “ham”. In learning they are values of a parameter . Call them what you like; they must partition the possibilities you are willing to entertain. If you leave a story out of the list, Bayes cannot resurrect it.

People also say cause, class, state, or model. Same job: the thing you cannot see directly, the thing you will have a degree of belief about.

Prior

The prior is how plausible each hypothesis was before this particular clue. Write . It is not a confession of bias, and it is not cheating. It is the base rate, the prevalence, what you would have said if someone had stopped you in the corridor yesterday. A disease that hits 1 in 100 has prior . A fair-looking coin has prior “probably near one half”. A stranger’s email, before you read it, is probably ham.

If you skip the prior, you are answering a different question from the one you were asked. That is the whole tragedy of the 99% answer later in this chapter.

Data

The data (also: observation, measurement, clue, test result) is the thing that actually happened, the event you now condition on. A positive test . The word “loan” in the subject line. Door 3 opening. Data is not a probability. It is an outcome, or a set of them. We will write in a moment; do not let the notation trick you into thinking the data itself is a number between 0 and 1.

Likelihood

The likelihood is : if this story were true, how unsurprising is what we just saw? A good test of a disease has likelihood of a positive result, given disease, near 1. The same test, given health, has a small likelihood of positive — that small number is the false-positive rate.

Evidence — two meanings, unfortunately

English “evidence” means the clue: the positive test, the witness statement, the dataset. That is the data.

Bayesian jargon also calls “the evidence” (or marginal likelihood). That number is not the clue. It is how unsurprising the clue is if you have not committed to a hypothesis — the average of the likelihoods, weighted by the priors. It sits in the denominator and makes the posteriors add to one. When someone says “the evidence”, ask: do they mean the event, or ? This book will say data for the event and marginal probability of the data for the denominator, unless we are quoting the standard slogan.

Posterior

The posterior is how plausible each hypothesis is after the clue: . It is the prior, reweighted by how well each story predicted what you saw, then renormalised so the stories still add to one. You came in with a prior. You leave with a posterior. Tomorrow, if more data arrives, today’s posterior is tomorrow’s prior. That is all “updating” means.

WordSymbolIn EnglishIn the clinic
HypothesisH, D, θA story that might be true. One branch.Has the disease, or does not.
PriorP(H)Belief in the story, before this clue.Prevalence: 1 in 100.
Datax, T⁺, EThe clue you actually observed. An event, not a probability.The test came back positive.
LikelihoodP(data | H)How unsurprising the clue is if the story is true.True-positive rate 0.99; false-positive rate 0.05.
Marginal / “evidence”P(data)How unsurprising the clue is with no story chosen. The normaliser.All the ways a positive test can happen.
PosteriorP(H | data)Belief in the story, after the clue.About 1 in 6, not 99 in 100.

The inversion, with every piece labelled

Whenever ,

The denominator is usually expanded by total probability, because that is the expansion the tree already computed:

A slogan that is accurate enough to tape above a desk: posterior is proportional to likelihood times prior. The denominator is the same for every hypothesis; it only rescales. If you just want to know which story wins, you can compare the numerators and skip the division. If you want a probability you can say out loud, you divide.

The clinic, named slowly

A disease has prevalence 1%. That is the prior: , so . A test detects the disease with probability 0.99 when it is present (true-positive rate: the likelihood of a positive given disease) and falsely flags the healthy with probability 0.05 (false-positive rate: the likelihood of a positive given health). You test positive. That positive result is the data. What you want is the posterior .

Almost everyone answers “about 99%”. They have quoted the likelihood of the data given disease, and dressed it as a posterior. The theorem answers otherwise.

Read the four numbers once more, with their badges on:

  • — prior of disease.
  • in the numerator — likelihood of a positive, if diseased.
  • — likelihood of a positive if healthy, times the prior of being healthy. The false-alarm mass.
  • — marginal probability of a positive. All the ways the data happens.

One in six. The test is sharp; the disease is rare; most positive tests are false alarms from the huge healthy population. Prevalence is not a footnote. It is half the formula.

PriorPosterior given T⁺P(D) = 0.01P(D | T⁺) ≈ 0.17
The prior puts almost all mass on healthy. After a positive test, the disease slice grows — but only to about one sixth. Intuition without the prior is just the likelihood staring at itself.

The clinic lab lets you drag prevalence and error rates until the surprise becomes ordinary. Do that before you memorise anything.

A second story, with no medicine in it

You have lost your keys. Hypothesis : they are in the kitchen (prior 0.7, because that is where they usually are). Hypothesis : they are in the hallway (prior 0.3). You glance at the kitchen hook. Data: the hook is empty. If the keys were in the kitchen you would have seen them 90% of the time; if they are in the hallway the hook is empty for sure. So

Same badges: 0.7 is the prior, 0.10 is the likelihood of an empty hook if they really are in the kitchen (you missed them), 0.37 is the marginal of the empty hook. After one look, “kitchen” has dropped from probably to roughly one in five. You have not proved the hallway. You have updated.

Likelihood is not a probability of the hypothesis

is the chance of the data given a story. It is not the chance of the story. Those two numbers can point in opposite directions: a nearly perfect test still yields a modest posterior when the prior is tiny. Confusing likelihood with posterior is the error of the 99% answer above. It is also the error of quoting in court when the jury asked for .

Yesterday’s posterior is today’s prior

Suppose you take a second, independent test, and it is also positive. You may start over with both tests as one datum, or you may take the 0.167 from the first test and use it as the prior for the second. Both routes give about 0.80. Sequential updating is the same theorem applied twice. “Learning from data”, in the Bayesian sense, is this habit: never throw the prior away, and never refuse to revise it.

Foundations studio: make the idea yours

This extended studio deliberately slows the pace. It is for a first-time learner who wants to recognize the idea in a new story, not merely reproduce a formula. Work with pencil and paper. Predict before calculating; redraw the pictures; and finish every numerical answer with a sentence in ordinary language.

A mental map before more algebra

Bayes theorem is bookkeeping for changing perspective. It combines a likelihood with a base rate and then normalizes across competing explanations.

priorevidencelikelihoodnormalizationposteriorWhen a formula feels unmotivated, move one box to the left.
A working map for Bayes' Theorem. Cover the labels and reconstruct the chain from memory.

Do not treat the arrows as a theorem. They are a study aid. A strong probability habit is to move back one box whenever a formula feels unmotivated: ask what the experiment is, what information is available, and what quantity the question actually requests.

Three formulas worth being able to narrate

Read this line from left to right and explain what every symbol refers to in the experiment. If a symbol has no story, the model is not finished.

Now read the statement backwards: what would have to be known to use it? Backwards reading is often the difference between recognizing a formula and knowing when it applies.

Test the expression at an edge case or simple symmetric case. Probability formulas should survive sanity checks before you trust the arithmetic built on them.

Worked example ladder

A small experiment you can actually do

PredictRepresentComputeCheckExplainThe arithmetic is the middle of the loop, not the whole of it.
A five-step habit for every example in this chapter.

What usually goes wrong

When you notice this mistake, do not merely correct the final number. Return to the first line where the model became ambiguous. Probability errors are often representation errors wearing arithmetic clothing.

Questions beginners are right to ask

Where does the denominator come from?

It is the total probability of seeing the evidence under all possible explanations, ensuring the posterior probabilities sum to one.

Is Bayes theorem subjective?

The theorem itself is an identity. Interpretations differ over how probabilities are assigned and used as priors.

Can priors dominate forever?

With sufficiently informative repeated data, many reasonable priors are overwhelmed; with weak or scarce data, the prior can matter substantially.

Where the abstraction earns its keep

For each application, ask what counts as an outcome, what the model treats as random, and which assumptions are approximations. This is how probability becomes a modelling language instead of a catalogue of formulas.

Connections: do not store chapters in separate boxes

Problem-solving clinic: from recognition to fluency

There is a stage where every worked example looks clear but a fresh problem still feels foreign. The cure is not another formula; it is practice choosing the representation. Before equations, do a sixty-second scan: identify the experiment, what is known, what remains uncertain, the quantity being asked for, the assumption doing the heavy lifting, and one impossible answer that gives you a sanity bound.

PredictRepresentComputeCheckExplainThe arithmetic is the middle of the loop, not the whole of it.
The expert loop returns every calculation to the original story.

Case clinic A: Rare disease test

Even a highly accurate test can produce many false positives when the disease is rare. Natural frequencies - for example, counts out of 10,000 - make the denominator visible.

Case clinic B: Two factories

If two factories make different fractions of the total output and have different defect rates, a defective item changes the probability of which factory produced it.

Solve or reason about it twice: once exactly and once with a rough estimate, simulation, or symmetry argument. If the two approaches disagree dramatically, investigate before trusting the more sophisticated calculation.

Debug a confident wrong answer

Two questions to answer without notes

Where does the denominator come from? It is the total probability of seeing the evidence under all possible explanations, ensuring the posterior probabilities sum to one.

Is Bayes theorem subjective? The theorem itself is an identity. Interpretations differ over how probabilities are assigned and used as priors.

A notebook protocol for proficiency

Give this chapter one notebook page divided into four quadrants: picture, formula, example, mistake. Redraw the main visual from memory, narrate one formula in English, invent a fresh story using the same mathematics, and record the most tempting wrong move. Revisit the page after two days and again after a week.

A mastery check before you move on

Try these without looking back. If one item feels slippery, return to the corresponding example and rebuild it rather than memorizing the answer.

  1. Give a one-minute explanation of the chapter title to a curious teenager without a formula.
  2. Invent a tiny example with at most six elementary outcomes and solve it completely by enumeration.
  3. State one assumption that would make your example invalid and identify exactly which line would break.
  4. Draw the mental map from memory and connect at least two boxes to an earlier or later chapter.
  5. Write one question whose answer you still do not know. Good questions show that the concept has become active rather than passive.