LightMySky
En anglais

Bayes' Rule and Updating a Belief

Bayes' rule combines a prior probability with evidence likelihoods to find a posterior probability. A test with high sensitivity and specificity can still have many false positives when the condition is rare. Repeated updates use likelihoods that account for earlier evidence.

No account needed. Progress saves in this browser.

What a learner can do afterwards

  • Interpret priors and test error rates, then compute result probabilities and posteriors
  • Explain the base rate effect on a rare condition with an accurate test
  • Update a belief twice using the correct conditional likelihoods and obtain the same posterior in either order

1 · Read

Let C mean a condition is present and + mean a positive result. The prior q = P(C) is the chance before the test. Let s = P(+ given C) and r = P(+ given not C). The true-positive share is q × s; the false-positive share is (1-q) × r. Their sum is P(+). If this sum is positive, the posterior is P(C given +) = q × s / [q × s + (1-q) × r]. It is the condition share within the positive group.

Try it together

Suppose 1% have the condition. A test detects 99% with it and flags 1% without it. In a model group of 10,000, 100 have the condition and 9,900 do not. The test gives 99 true positives and 99 false positives. Among all 198 positives, the condition share is 99/198 = 0.5. To use this counting method with other rates, split the group first, apply each rate, then divide true positives by all positives.

Truepositives99Falsepositives99
The positive group contains equal numbers with and without the condition. Its condition share is one half.

A false positive is a positive result when C is absent. Its rate divides false positives by everyone without C. Sensitivity s is the positive rate within C. Specificity 1-r is the negative rate without C. A false negative is a negative result within C; its rate is 1-s. Rarity can make false positives outnumber true ones, but this is not automatic. With fixed rates 0 < r < s, a higher base rate gives a higher positive-result posterior.

A negative result also updates the prior. Its likelihood is 1-s when C is present and 1-r when C is absent. The negative shares are q × (1-s) and (1-q) × (1-r). Divide the first by their sum to find P(C given negative), provided the sum is positive. The denominator now contains everyone with a negative result.

For two results, use the first posterior as the next prior. You may reuse each test's original rates if the results are independent given C and also given not C. This means learning one result leaves the other's rate unchanged within either group. Independence across the whole population is not enough. Without within-group independence, use rates conditional on the earlier result.

C: 0.2 × 0.75 × 0.5not C: 0.8 × 0.25 × 0.10.075 / (0.075 + 0.02)
These products use independence within each condition group. The example below explains their rates.
Try it together

Take q = 0.2. A's positive rates are 0.75 with C and 0.25 without; B's are 0.5 and 0.1. Assume independence within each group. For two positives, the shares are 0.2 × 0.75 × 0.5 = 0.075 and 0.8 × 0.25 × 0.1 = 0.02. The posterior is 0.075/0.095, about 0.7895. Reversing A and B leaves both products unchanged. This gives the same result as two Bayes updates. Keep intermediate values unrounded.

For a positive result, divide the true-positive share by all positives. Base rates matter. Repeated updates need the correct conditional likelihoods and give the same posterior in either order.

Lesson, question and flashcard revisions written for this dataset.

Six original practice questions written for this dataset. Probability-table formats were studied in Benjamin Walter's METU-NCC WeBWorK records; no source wording was copied.

2 · Watch

En anglais

Take it off screen

Print a worksheetA4 with an answer key page for grown-ups. No screen, no internet.

Where it sits

Then practise

14 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.

Spotted a problem on this page? Tell us
Bayes' Rule and Updating a Belief · Computing, ages 18 to 19 · LightMySky