Attic › Mathematics › Bayesian probability

Bayes' theorem updates a starting belief with the weight of new evidence

About Bayes' theorem

To update a probability when you find new evidence, you use a mathematical rule called Bayes' theorem. This formula combines your starting probability with the strength of the new evidence to calculate a revised probability. Because the starting probability is part of the calculation, an unlikely idea needs very strong evidence before you believe it.

This process of updating beliefs with data is called Bayesian inference. Suppose you have a hypothesis H (for example, that a patient has a rare disease) and you observe a piece of evidence E (a positive test result). Bayes' theorem connects four numbers:

1. Prior probability, written as P(H): how sure you are that the hypothesis H is true before you see the new evidence. This is the prior probability.

2. Likelihood, written as P(E | H): the probability that you would see the evidence E if the hypothesis H were actually true. When you calculate this across different hypotheses, it is called the likelihood function.

3. Marginal likelihood, written as P(E): the total probability of seeing the evidence E under all possible hypotheses, whether H is true or false.

4. Posterior probability, written as P(H | E): how sure you are that H is true after you include the evidence E. This is the posterior probability.

Bayes' theorem states that the posterior probability equals the prior probability multiplied by the likelihood, divided by the marginal likelihood:

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

An example from medicine shows why the prior probability matters. Suppose 1 in 1,000 people has a certain disease, so the prior probability P(H) for a random person is 0.001. A medical test detects this disease correctly 99% of the time when it is present, so the likelihood P(E | H) is 0.99. However, the test also gives a false positive result to 1% (0.01) of healthy people.

If 1,000 people take the test, the 1 sick person will almost certainly test positive (1 × 0.99 ≈ 1). Out of the 999 healthy people, about 10 will also get a false positive result (999 × 0.01 ≈ 10). Thus, about 11 people in total get a positive result, making the marginal likelihood P(E) about 0.011.

If you test positive, Bayes' theorem gives the probability that you actually have the disease:

P(H | E) = 0.001 × 0.99 / 0.011 ≈ 0.09 (9%)

Even though the test is 99% accurate, your chance of having the disease is only 9%. Because the disease is very rare (a low prior), most positive results are false alarms. However, if you take a second independent test, your new prior probability is 9% instead of 0.1%, and a second positive result will push your posterior probability above 90%.

Fact-checked against Bayesian probability on Wikipedia

Part of the Mathematics syllabus: Probability and Statistical Inference

See it on the timeline of Probability and Statistical Inference