Math paradoxes

Glossary / Bayes' theorem

Glossary · Bayes' theorem

A witness says the cab was blue. How far should you believe it?

At night a cab hits a pedestrian and drives off. The town has two companies: 85% of the cabs are green, 15% are blue. A witness says the car was blue. He was tested in the same conditions and names the colour correctly 80% of the time. Most people answer at once: "So it is 80% blue." This is a classic problem by Daniel Kahneman and Amos Tversky, and intuition misses here by almost a factor of two. Bayes' theorem is the rule for honestly changing your mind when new evidence arrives.

In plain wordspictures, analogies, small numbers

“In plain words” is hidden on all puzzles.

The witness paradox

Here are all 100 cabs in town. Imagine any of them could have caused the accident, and the witness looked at each one. Press the buttons in turn and count the cars he would call blue.

green cab blue cab the witness would say "blue"
–
Another town

Evidence shifts your belief, it doesn't replace it

The witness doesn't lie and doesn't err more often than stated. There are simply almost six times as many green cars, and even rare mistakes on so many of them produce more "blues" than the real blue cabs do. The witness's words raised the chance of a blue cab from 15% to 41%, but not to 80%.

  • First: how common is it to begin with?Before any evidence you already have a belief: 15 cabs out of 100 are blue. New evidence starts its work from exactly this number.
  • Then: how well does the evidence tell the options apart?The witness says "blue" about a blue cab four times as often as about a green one. That four is the strength of the evidence.
  • Each new piece of evidence is one more shiftToday's conclusion becomes tomorrow's starting belief. That, step by step, is how learning from experience should work.
Rigoroustables, charts, formulas

“Rigorous” is hidden on all puzzles.

Bayes' three numbers

Bayes' theorem links three quantities. The hypothesis H is "the cab was blue", the evidence E is "the witness said 'blue'".

Prior

What we thought before the evidence. P(blue) = 0.15.

Likelihood

How often this evidence turns up under each hypothesis. P(says "blue" | blue) = 0.8, P(says "blue" | green) = 0.2.

Posterior

What we think after the evidence. P(blue | says "blue") is what we are after.

P(H | E) = P(E | H) · P(H) / P(E)

P(blue | "blue") = 0.8 · 0.15 / (0.8 · 0.15 + 0.2 · 0.85) = 0.12 / 0.29 ≈ 0.41

The denominator is every case in which the witness says "blue": 12 real blue cabs and 17 green ones he got wrong, 29 out of 100 in all. Where the formula itself comes from is explained in the article on conditional probability. Here we care about something else: how to use it to change your mind.

A second witness

The police found another witness, just as reliable, who saw everything from across the street and talked to no one. He says "blue" too. Now 41% is the starting belief, and the new evidence shifts that. Simulate 10,000 night accidents: in each, a random cab and several independent witnesses. We keep only the nights on which the witnesses said what you chose.

Accidents with this testimony–
Of them a blue cab–
Exactly by Bayes–

Two weak pieces of evidence turned out strong together: neither alone reaches even half, yet together they give almost three quarters. And two witnesses who contradict each other bring us back to exactly 15%: their voices cancelled out.

Extraordinary claims

"Extraordinary claims require extraordinary evidence": Carl Sagan popularised the phrase, and Pierre-Simon Laplace put the idea forward much earlier. Bayes explains why. The same witness is equally convincing whether he says "I saw a fox in the park" or "I saw a tiger in the park". But the starting odds of these events differ, and that decides everything. Choose how rare the event is and see how many independent witnesses, each 80% reliable, it takes.

Probability after the testimony–
Witnesses to get above 50%–

One striking piece of evidence weighs little if the event is almost impossible: from a one-in-a-million chance it only gets you to four in a million. To pass one half you need about ten independent witnesses, because each only multiplies the odds by four, and they have to be multiplied a millionfold.

Where Bayes is at work

  • Spam filtersIn 2002 Paul Graham described a filter that, for each word in a message, works out how much more often it appears in spam than in ordinary mail, and combines that evidence. The word "free" is weak evidence, but a dozen such words together are convincing.
  • Searching for lost thingsIn 1968 the US Navy was searching for the lost submarine Scorpion. John Craven's team drew a map of the probabilities of where it might be and updated it as the search went on. At the end of October the wreck was found more than 3 km down, about 740 km southwest of the Azores. The same approach was used to look for a hydrogen bomb off Palomares in 1966 and for the flight recorders of Air France flight 447 in 2011.
  • Breaking EnigmaAt Bletchley Park Alan Turing added up the evidence for possible settings of the cipher machine in units he called the "ban" and the "deciban". More about them in the "Deeper" section.

How to update your mind honestly

  • Don't forget the starting belief"The witness is 80% reliable" is not the answer, only half the data. The other half is how common the thing he testifies to is.
  • Ask how often the evidence turns up under the other versionEvidence weighs exactly as much as how many times more often it appears under one hypothesis than under the other. If equally often, it weighs nothing, however impressive it seems.
  • Check whether the evidence is independentTen people retelling the same rumour are one witness, not ten. Only independent evidence can be multiplied.
  • Zero and one are foreverIf the starting belief is 0 or 100%, no evidence will move it: multiplying zero is pointless. So it is better never to be absolutely sure about real things.
Deepergeneralisations, theory, history

“Deeper” is hidden on all puzzles.

Posterior odds = prior odds × likelihood ratio

P(H | E) / P(not H | E) = P(H) / P(not H) · P(E | H) / P(E | not H)

Write Bayes' formula for H and for "not H" and divide one by the other: the awkward denominator P(E) cancels. A single multiplication remains. For the cab, the starting odds of blue are 15 : 85, and the likelihood ratio (LR) is 0.8 / 0.2 = 4. After one witness the odds are 60 : 85 = 12 : 17, that is 12 / 29 ≈ 41%. Each further independent witness who says "blue" multiplies the odds by 4 again, and one who says "green" divides them by 4.

For the choice in the simulation above: –

Evidence adds up: bits and decibans

log2 posterior odds = log2 prior odds + log2 LR1 + log2 LR2 + …

A logarithm turns multiplication into addition. So if you measure confidence by the logarithm of the odds, each independent piece of evidence simply adds its own number. One witness gives log2 4 = 2 bits in favour of a blue cab. The starting belief is log2(15/85) ≈ −2.5 bits, that is 2.5 bits against. Zero means "fifty-fifty". Turing used the base-10 logarithm and counted in decibans, tenths of a ban: a witness gives 10 · log10 4 ≈ 6 decibans. His colleague I. J. Good wrote that a change of about 1 deciban is about the smallest a person can feel.

"Blue" witnessesBitsOddsProbability

Each witness moves the point by the same step of 2 bits. So the line is even, though the probability grows unevenly: 15%, 41%, 74%, 92%. Near 50% one step changes a lot, near 100% almost nothing.

Striking evidence that weighs nothing

LR = P(E | H) / P(E | not H)

The strength of evidence is not how likely it is under your version, but the ratio of two numbers. "The cab had a taxi sign on the roof" is 100% true for a blue cab. But it is also 100% true for a green one, so LR = 1, the logarithm is 0 bits, and the belief doesn't move a single step. Conversely, evidence that is rare under both versions but ten times rarer under one of them weighs 10 · log10 10 = 10 decibans, however mundane it sounds.

Why the witnesses must not confer

P(E1, E2 | H) = P(E1 | H) · P(E2 | H)

Likelihood ratios may be multiplied only when the pieces of evidence are independent under each hypothesis. If the second witness first heard the first one, his "blue" is already half a retelling, and the real LR of the second testimony is less than 4. In the extreme case, when he simply repeats what he heard, the LR is 1, and two voices weigh as one. The order of independent evidence, on the other hand, doesn't matter: multiplication is commutative, so it makes no difference which witness you hear first.

The theorem is named after Thomas Bayes, an English minister and mathematician. His essay was published by Richard Price in 1763, after the author's death.

Where it shows up

Other terms