AI Grounds

Open AI Grounds on a desktop

These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.

Guided discovery

Bayes’ Rule

Count every positive signal before judging it.

Prior: real cases out of everyone before a signal. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Positive signals out of real cases. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Positive signals out of non-cases. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.

Expected counts per 1000

In this fictional scenario, a real case means has condition; a positive signal means tests positive. Expectations are model averages and can be fractional. This is not a simulated sample; actual counts vary.

The prior splits the population; sensitivity and false-positive rate split each row.
GroupPositiveNegativeTotal
Real case9.5True positives0.5False negatives10
No real case49.5False positives940.5True negatives990
Total599411000

True positives = 10 × 95% = 9.5.
False positives = 990 × 5% = 49.5.

Positive results only

The outlined table cells form this new reference group. Its total is 59 expected positives.

Real positives: 9.5 (≈ 16.1%). False positives: 49.5 (≈ 83.9%).

Posterior = 9.5 / (9.5 + 49.5) = 9.5/59; ≈ 16.1%

Connect the counts to Bayes’ formula

P(real | positive) = sensitivity × prior / [sensitivity × prior + false-positive rate × (1 − prior)]. The vertical bar means “given”. Both terms in the denominator are ways to get a positive result. Population size cancels, so the posterior depends on the rates.

Prior

Real cases before the signal.

1%

10 / 1000

All positives

True plus false positives.

59

9.5 + 49.5

Posterior

Real cases among positive results.

≈ 16.1%

9.5 / 59

Medical Test; prior 1%, sensitivity 95%, false-positive rate 5%. 9.5 expected true positives and 49.5 false positives; posterior ≈ 16.1%.