EuraStudy
Notes/Statistics/Bayes' theorem
Notes · StatisticsUK · A-Levels

Bayes' theorem

This topic uses the law of total probability and Bayes' theorem to reverse a conditional probability, updating a prior belief in the light of evidence to a posterior. It applies the method to diagnostic and screening problems, where the interplay of a low base rate with test accuracy produces the counter-intuitive but important base-rate effect.

4 sections·~10 min reading time·3 competencies·Level Standard 1 · Advanced 3

T·0444 / 18
Exam profile
AO1 · Apply the law of total probability and Bayes' theoremAO2 · Interpret prior and posterior probabilities correctlyAO3 · Solve real diagnostic and screening problems and comment on the results
Operators:calculatefinddetermineshow thatinterpretcomment

basic level

The AS foundation expects the law of total probability and simple conditional reversals via a tree or table.

higher level

The full A-Level expects the formal statement of Bayes' theorem, prior/posterior language and the base-rate interpretation.

Depth

Reading depth: In depth

Text

Text size: Standard

Contents · 4 sections▾
  1. Bayes' theorem
    • 01The law of total probability◐
    • 02Bayes' theorem●
    • 03Priors, posteriors and updating●
    • 04Diagnostic testing and the base-rate effect●
§ 01

The law of total probability#

●●○StandardLPPearson Edexcel 9ST0, Topic 8 (Paper 1)

Key points

Bayes' theorem is built on the law of total probability, which computes the overall probability of an event by summing over the ways it can occur. If the events A1,A2,…A_1, A_2, \ldotsA1​,A2​,… are mutually exclusive and exhaustive (they partition the sample space), then P(B)=∑iP(B∣Ai) P(Ai)P(B) = \sum_i P(B \mid A_i)\,P(A_i)P(B)=∑i​P(B∣Ai​)P(Ai​). Each term is the probability of one route to BBB, and the routes are added.
The simplest and most common form uses a two-part partition, AAA and its complement A′A'A′: P(B)=P(B∣A)P(A)+P(B∣A′)P(A′)P(B) = P(B \mid A)P(A) + P(B \mid A')P(A')P(B)=P(B∣A)P(A)+P(B∣A′)P(A′). This is exactly the sum of the two tree paths that reach BBB, and it converts a conditional description of a process into the unconditional probability of the observed event.
In the diagnostic context that runs through this topic, let DDD be 'has the disease' with prevalence P(D)=0.01P(D) = 0.01P(D)=0.01, and let +++ be 'tests positive', with P(+∣D)=0.99P(+ \mid D) = 0.99P(+∣D)=0.99 (the test's sensitivity) and P(+∣D′)=0.05P(+ \mid D') = 0.05P(+∣D′)=0.05 (the false-positive rate). The total probability of a positive test is P(+)=0.99(0.01)+0.05(0.99)=0.0099+0.0495=0.0594P(+) = 0.99(0.01) + 0.05(0.99) = 0.0099 + 0.0495 = 0.0594P(+)=0.99(0.01)+0.05(0.99)=0.0099+0.0495=0.0594.
This total is the denominator of Bayes' theorem. Notice how the large group of healthy people (P(D′)=0.99P(D') = 0.99P(D′)=0.99) contributes many false positives (0.0495) despite the low individual false-positive rate, so that most positive results come from healthy people. Recognising which paths dominate the total is the key to the base-rate interpretation later.
P(B)=P(B∣A)P(A)+P(B∣A′)P(A′)P(B) = P(B \mid A)P(A) + P(B \mid A')P(A')P(B)=P(B∣A)P(A)+P(B∣A′)P(A′)

Law of total probability (two-part partition)

Sum the probabilities of every route to BBB through a partition of the sample space.

Worked example

Total probability of a positive test

A disease affects 1% of a population. A test gives a positive result for 99% of sufferers and 5% of non-sufferers. Find P(+)P(+)P(+).

  1. 01Route through D

    P(+∣D)P(D)=0.99×0.01=0.0099P(+ \mid D)P(D) = 0.99 \times 0.01 = 0.0099P(+∣D)P(D)=0.99×0.01=0.0099.

  2. 02Route through D'

    P(+∣D′)P(D′)=0.05×0.99=0.0495P(+ \mid D')P(D') = 0.05 \times 0.99 = 0.0495P(+∣D′)P(D′)=0.05×0.99=0.0495.

  3. 03Total

    P(+)=0.0099+0.0495=0.0594P(+) = 0.0099 + 0.0495 = 0.0594P(+)=0.0099+0.0495=0.0594.

    P(+)=0.99(0.01)+0.05(0.99)=0.0594P(+) = 0.99(0.01) + 0.05(0.99) = 0.0594P(+)=0.99(0.01)+0.05(0.99)=0.0594

Result: P(+)=0.0594P(+) = 0.0594P(+)=0.0594, of which most (0.0495) comes from healthy people.

Exam focus

  • Identify a partition and sum the conditional routes to find the total probability of an event.
  • Set up the total probability as the denominator ready for Bayes' theorem.

Typical mistakes

  • Using a partition whose parts are not exhaustive, so the routes do not cover every case.
  • Adding conditional probabilities without weighting them by the probabilities of the partition.

Active revision

A disease has prevalence 2%. A test is positive for 95% of sufferers and for 3% of non-sufferers. Find the overall probability of a positive test.

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 02

Bayes' theorem#

●●●AdvancedLPPearson Edexcel 9ST0, Topic 8 (Paper 1)

Probability tree for a diagnostic test

Disease status and test resultProbability tree, 4 paths, Data: D → +: 0.01; D → -: 0; D' → +: 0.05; D' → -: 0.9410.99+0.01-0.05+0.95-0.01D0.99D'P = 0.01P = 0P = 0.05P = 0.941DiseaseNo disease+-+-
Fig. 1Path products: P(D and +) = 0.0099 and P(D' and +) = 0.0495; so P(D given +) = 0.0099 / 0.0594 = 0.167.

Key points

Bayes' theorem reverses a conditional probability. Starting from the definition P(A∣B)=P(A∩B)P(B)P(A \mid B) = \dfrac{P(A \cap B)}{P(B)}P(A∣B)=P(B)P(A∩B)​ and writing the numerator as P(B∣A)P(A)P(B \mid A)P(A)P(B∣A)P(A) and the denominator by the law of total probability, gives P(A∣B)=P(B∣A)P(A)P(B∣A)P(A)+P(B∣A′)P(A′)P(A \mid B) = \dfrac{P(B \mid A)P(A)}{P(B \mid A)P(A) + P(B \mid A')P(A')}P(A∣B)=P(B∣A)P(A)+P(B∣A′)P(A′)P(B∣A)P(A)​. It converts the known direction P(B∣A)P(B \mid A)P(B∣A) into the wanted direction P(A∣B)P(A \mid B)P(A∣B).
The tree below organises the diagnostic problem for direct use of the formula. The numerator is the single path D→+D \to +D→+, with probability 0.99×0.01=0.00990.99 \times 0.01 = 0.00990.99×0.01=0.0099, and the denominator is the total probability of a positive test, 0.05940.05940.0594, the sum of both positive paths. The posterior is P(D∣+)=0.00990.0594=0.167P(D \mid +) = \dfrac{0.0099}{0.0594} = 0.167P(D∣+)=0.05940.0099​=0.167 (3 s.f.).
Reading a Bayes problem from a tree is the reliable method: the numerator is the target path's product, and the denominator is the sum of ALL paths that produce the observed evidence. This makes the arithmetic mechanical once the tree is drawn, and it exposes exactly which competing explanations of the evidence are being weighed.
The result P(D∣+)=0.167P(D \mid +) = 0.167P(D∣+)=0.167 is strikingly low given a 99% sensitive test: even after a positive result, the probability of disease is only about 1 in 6. This is not a paradox but a consequence of the low prevalence, and it is the reason Bayes' theorem is essential for interpreting screening tests honestly.
P(A∣B)=P(B∣A)P(A)P(B∣A)P(A)+P(B∣A′)P(A′)P(A \mid B) = \frac{P(B \mid A)P(A)}{P(B \mid A)P(A) + P(B \mid A')P(A')}P(A∣B)=P(B∣A)P(A)+P(B∣A′)P(A′)P(B∣A)P(A)​

Bayes' theorem

The wanted conditional equals the target path over the total probability of the evidence.

Worked example

Reversing the conditional with Bayes

With P(D)=0.01P(D) = 0.01P(D)=0.01, P(+∣D)=0.99P(+ \mid D) = 0.99P(+∣D)=0.99 and P(+∣D′)=0.05P(+ \mid D') = 0.05P(+∣D′)=0.05, find the probability that a person who tests positive actually has the disease.

  1. 01Target path

    P(D∩+)=P(+∣D)P(D)=0.99×0.01=0.0099P(D \cap +) = P(+ \mid D)P(D) = 0.99 \times 0.01 = 0.0099P(D∩+)=P(+∣D)P(D)=0.99×0.01=0.0099.

  2. 02Total evidence

    P(+)=0.0099+0.05×0.99=0.0594P(+) = 0.0099 + 0.05 \times 0.99 = 0.0594P(+)=0.0099+0.05×0.99=0.0594.

  3. 03Apply Bayes

    P(D∣+)=0.00990.0594=0.167P(D \mid +) = \dfrac{0.0099}{0.0594} = 0.167P(D∣+)=0.05940.0099​=0.167 (3 s.f.).

    P(D∣+)=0.00990.0594=0.167P(D \mid +) = \frac{0.0099}{0.0594} = 0.167P(D∣+)=0.05940.0099​=0.167
  4. 04Interpret

    Despite the positive result, there is only about a 16.7% chance the person has the disease.

Result: P(D∣+)=0.167P(D \mid +) = 0.167P(D∣+)=0.167 (3 s.f.), so a positive result implies only about a 1-in-6 chance of disease.

Exam focus

  • Apply Bayes' theorem as target-path over total-probability, reading from a tree.
  • Show the numerator and denominator explicitly and interpret the posterior.

Typical mistakes

  • Putting only one positive path in the denominator instead of the total probability of the evidence.
  • Confusing P(D∣+)P(D \mid +)P(D∣+) with P(+∣D)P(+ \mid D)P(+∣D) — Bayes' theorem exists precisely to distinguish them.

Active revision

Using the diagnostic tree, find P(D∣+)P(D \mid +)P(D∣+) from the path products.

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 03

Priors, posteriors and updating#

●●●AdvancedLPPearson Edexcel 9ST0, Topic 8 (Paper 1)

Key points

Bayes' theorem is naturally read as belief updating. The prior probability P(A)P(A)P(A) is the belief before the evidence, the likelihood P(B∣A)P(B \mid A)P(B∣A) is how probable the evidence is under AAA, and the posterior P(A∣B)P(A \mid B)P(A∣B) is the revised belief after the evidence. In the diagnostic example the prior 0.01 is updated by the positive test to the posterior 0.167 — a large relative increase, from 1% to about 17%, even though it remains below one half.
The strength of the update depends on how much more probable the evidence is under AAA than under A′A'A′, a ratio known as the likelihood ratio. When the evidence is far more likely under AAA, the posterior rises sharply; when it is only slightly more likely, the belief barely moves. This explains why a single positive on a test with a high false-positive rate is only weakly informative.
Updating can be repeated: the posterior after one piece of evidence becomes the prior for the next, provided the pieces of evidence are conditionally independent given the state. Two independent positive tests, for instance, multiply the evidence and can push a modest posterior much higher, which is why doctors confirm a screening result with a second, independent test.
The framework insists that a conclusion depends on the prior as much as on the evidence. The same positive test yields a very different posterior in a high-prevalence population than in a low-prevalence one. Stating the prior, and acknowledging its influence, is part of an honest Bayesian interpretation and a frequent discussion point in examination answers.
posterior  ∝  likelihood×prior:P(A∣B)∝P(B∣A) P(A)\text{posterior} \;\propto\; \text{likelihood} \times \text{prior}: \quad P(A \mid B) \propto P(B \mid A)\,P(A)posterior∝likelihood×prior:P(A∣B)∝P(B∣A)P(A)

Bayesian updating

The posterior is proportional to the likelihood times the prior; normalise by P(B)P(B)P(B).

Worked example

The prior changes the posterior

With the same test (P(+∣D)=0.99P(+ \mid D) = 0.99P(+∣D)=0.99, P(+∣D′)=0.05P(+ \mid D') = 0.05P(+∣D′)=0.05), recompute P(D∣+)P(D \mid +)P(D∣+) when the prevalence is P(D)=0.20P(D) = 0.20P(D)=0.20.

  1. 01Target path

    P(D∩+)=0.99×0.20=0.198P(D \cap +) = 0.99 \times 0.20 = 0.198P(D∩+)=0.99×0.20=0.198.

  2. 02Total evidence

    P(+)=0.198+0.05×0.80=0.198+0.04=0.238P(+) = 0.198 + 0.05 \times 0.80 = 0.198 + 0.04 = 0.238P(+)=0.198+0.05×0.80=0.198+0.04=0.238.

  3. 03Posterior

    P(D∣+)=0.1980.238=0.832P(D \mid +) = \dfrac{0.198}{0.238} = 0.832P(D∣+)=0.2380.198​=0.832 (3 s.f.).

    P(D∣+)=0.1980.238=0.832P(D \mid +) = \frac{0.198}{0.238} = 0.832P(D∣+)=0.2380.198​=0.832
  4. 04Compare

    The same test gives a posterior of 0.832 at 20% prevalence versus 0.167 at 1% — the prior dominates the interpretation.

Result: At 20% prevalence the posterior is 0.832, far above the 0.167 at 1%, showing the decisive role of the prior.

Exam focus

  • Identify the prior, likelihood and posterior in a described problem.
  • Explain how the posterior depends on both the evidence and the prior.

Typical mistakes

  • Ignoring the prior and quoting the likelihood P(B∣A)P(B \mid A)P(B∣A) as if it were the posterior.
  • Updating with a second piece of evidence that is not conditionally independent of the first.

Active revision

Explain how the posterior probability of disease after a positive test would change if the disease were much more common (say 20% prevalence).

Active recall

Recall the key points — then reveal.

Sources: Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification (Pearson Edexcel)

§ 04

Diagnostic testing and the base-rate effect#

●●●AdvancedLPPearson Edexcel 9ST0, Topic 8 (Paper 1)

Frequency table for 10 000 tested people

Diagnostic outcomes (10 000 people)Table with 4 columns and 3 rows, Data: Disease · No disease · Total; Test + · 99 · 495 · 594; Test - · 1 · 9405 · 9406; Total · 100 · 9900 · 10000DISEASENO DISEASETOTALTEST +99495594TEST -194059406TOTAL100990010000
Fig. 2Of 594 positive tests only 99 are true cases, so P(D given +) = 99/594 = 0.167.

Key points

The base-rate effect is the tendency to neglect the underlying prevalence (the base rate) when interpreting a test, focusing instead on the test's accuracy. The diagnostic example makes it concrete: with a 1% base rate, a 99%-sensitive test still leaves a positive result only 16.7% likely to be a true case, because the healthy majority generates so many false positives.
A frequency (natural-numbers) table often communicates this more clearly than probabilities. Imagining 10 000 people, 100 have the disease and 9 900 do not; of the 100, 99 test positive, while of the 9 900, 495 test positive as false alarms. Of the 99+495=59499 + 495 = 59499+495=594 positives, only 99 are true cases, so P(D∣+)=99594=0.167P(D \mid +) = \dfrac{99}{594} = 0.167P(D∣+)=59499​=0.167 — the same answer, now visible in whole people.
The table also names the four cells of any diagnostic test: true positives (99), false positives (495), false negatives (1) and true negatives (9 405). Sensitivity is the true-positive rate among the diseased, and specificity the true-negative rate among the healthy; the positive predictive value, P(D∣+)P(D \mid +)P(D∣+), is what Bayes' theorem computes and is what actually matters to a patient.
The practical lesson is that a good test is not enough when the condition is rare: screening programmes must weigh the harm of many false positives against the benefit of detecting rare true cases, and confirmatory testing is standard. Communicating this honestly, with the base rate made explicit, is exactly the AO3 skill the topic assesses.
P(D∣+)=true positivestrue positives+false positives=9999+495=0.167P(D \mid +) = \frac{\text{true positives}}{\text{true positives} + \text{false positives}} = \frac{99}{99 + 495} = 0.167P(D∣+)=true positives+false positivestrue positives​=99+49599​=0.167

Positive predictive value

The proportion of positive tests that are true cases; low when the base rate is low.

Worked example

The base-rate effect in whole numbers

Among 10 000 people, 100 have a disease. A test detects 99 of them but also flags 495 of the 9 900 healthy people. Find the probability that a positive test is a true case.

  1. 01Count the positives

    Positives total 99+495=59499 + 495 = 59499+495=594.

  2. 02True cases among them

    Only 99 of these are genuinely diseased.

  3. 03Predictive value

    P(D∣+)=99594=0.167P(D \mid +) = \dfrac{99}{594} = 0.167P(D∣+)=59499​=0.167 (3 s.f.).

    P(D∣+)=99594=0.167P(D \mid +) = \frac{99}{594} = 0.167P(D∣+)=59499​=0.167
  4. 04Interpret

    Because the disease is rare, over 83% of positive results are false alarms, so a confirmatory test is warranted.

Result: P(D∣+)=0.167P(D \mid +) = 0.167P(D∣+)=0.167; most positives are false alarms because of the low base rate.

Exam focus

  • Use a natural-frequency table to compute and explain the positive predictive value.
  • Explain the base-rate effect and its consequences for screening.

Typical mistakes

  • Equating the sensitivity P(+∣D)P(+ \mid D)P(+∣D) with the predictive value P(D∣+)P(D \mid +)P(D∣+).
  • Ignoring the base rate when judging how informative a positive result is.

Active revision

For a condition with 0.5% prevalence and a test with 98% sensitivity and 96% specificity, build a table for 10 000 people and find the positive predictive value.

Active recall

Recall the key points — then reveal.

Sources: GCE AS and A level subject content (Statistics) (Department for Education / Ofqual)

Contents

Section -- / 04

    • 01The law of total probability◐
    • 02Bayes' theorem●
    • 03Priors, posteriors and updating●
    • 04Diagnostic testing and the base-rate effect●

0/4 Read

From notes into training

Bayes' theorem

Reinforce this topic with matching tasks from the question bank.

~10
min
3
Competencies
Practise

References & sources

Sources

Pearson Edexcel

  • Pearson Edexcel Level 3 Advanced GCE in Statistics (9ST0) Specification

Department for Education / Ofqual

  • GCE AS and A level subject content (Statistics)

Previous topic

Probability

Next topic

Introduction to probability distributions

EuraStudy·Notes T·04·MMXXVI

Carry on to the next topic — your learning path is kept.