Learning guides

Probability · By Riano · Published

Update a probability without ignoring the base rate

Count true and false signals, calculate a posterior probability, and test how changing one assumption changes the answer.

Start with a count, not a reversed conditional

Suppose a signal is common when a particular condition holds. That does not immediately tell us how often the condition holds when the signal appears. Bayes' theorem combines a prior frequency with the signal's behavior in both groups. The direction of conditioning changes which population we are considering.

Use a toy sorting problem: 10% of tokens are marked. A sensor signals for 90% of marked tokens and for 10% of unmarked tokens. Let A mean “marked” and B mean “sensor signals.” The sensor's true-positive rate is P(B|A) = 0.9; the question we want to answer is P(A|B). No real-world sensor accuracy is being claimed.

Calculate the answer with 1,000 tokens

Imagine a population with exactly the stated proportions. Of 1,000 tokens, 100 are marked and 900 are unmarked. There are 90 signals among the marked group and 90 among the unmarked group. Among the 180 signals, only 90 come from marked tokens. The posterior probability is therefore 50%, despite a 90% true-positive rate.

P(B) = 0.9 × 0.1 + 0.1 × 0.9 = 0.18
P(A|B) = (0.9 × 0.1) / 0.18 = 0.5

The denominator includes every way to produce the observed signal. Omitting the unmarked group would count only favorable evidence and lead to a different, incorrect question. The 1,000-token construction is a frequency illustration of the model, not a claim that every random sample contains exactly those counts.

Change one assumption at a time

Open Bayes' Theorem. The three sliders control the prior, true-positive rate and false-positive rate. Start with 10%, 90% and 10%. Check the displayed evidence probability of 18.0% and posterior of 50.0%. Then compare these three cases:

Predictions to check in the module
PriorTrue-positive rateFalse-positive rateEvidencePosterior
10%90%10%18.0%50.0%
1%90%10%10.8%8.3%
10%90%1%9.9%90.9%

In the second case, only 10 tokens are marked: 9 marked tokens and 99 unmarked tokens signal. The ratio is 9/108, approximately 8.3%. In the third case, the prior returns to 10% but the false-positive rate falls to 1%; the ratio becomes 90/(90 + 9), approximately 90.9%. Lowering the false-positive rate and increasing the prior are different changes, even though both can raise the posterior.

Read the visualization carefully

The module represents a population with colored squares. Its displayed probability comes from the formula, while individual square counts are rounded to fit a finite grid. At arbitrary slider settings, a ratio counted from squares may differ slightly from the numeric result. Rounding is a display choice rather than a different definition of probability.

Bayes' theorem assumes P(B) > 0 for this conditional probability. A signal that has probability zero cannot be conditioned on with the elementary ratio formula. The available slider ranges keep the demonstration away from some zero-probability endpoints. Also, the supplied rates are assumptions: the visualization cannot establish that a sensor's rates or a population's prior are correct.

Check your understanding

Keep the true-positive and false-positive rates at 90% and 10%, but set the prior to 50%. Before checking, calculate 450 marked signals and 50 unmarked signals per 1,000 tokens. The posterior is 450/500 = 90%. Explain why this matches the true-positive rate in this particular symmetric setup, but not in the original example.

Continue with the companion theory article and MIT OpenCourseWare: Conditioning and Bayes' Rule. Write down which conditional probability is given and which is being asked for before using either the formula or the module.

These worked examples are educational models. See our editorial process or report a correction.