🩺 Screening Lab: Prevention, Early Detection and Why Positives Can Mislead

2D interactive simulation · educational model, not medical advice

Move the sliders: each dot is a person; red = true positive, yellow = false alarm, purple = missed case.

The science

Screening as Bayes' rule. A population of N people has prevalence p. A test has sensitivity Se = P(+|sick) and specificity Sp = P(−|healthy). Expected counts: true positives TP = N p Se, false negatives N p (1−Se), false positives FP = N (1−p)(1−Sp), true negatives N (1−p) Sp.

Predictive values. PPV = TP/(TP+FP) = p Se / (p Se + (1−p)(1−Sp)), NPV = TN/(TN+FN). When the condition is rare, even a good test gives mostly false alarms: the 100×100 dot grid makes that visible (each dot is one person; the grid is a fixed random sample, so the drawn counts differ slightly from the expected values).

Confirmatory second test. Retesting positives with an independent test of the same quality gives TP = N p Se², FP = N (1−p)(1−Sp)². The independence assumption is optimistic: real repeat tests share causes of error.

Lifestyle. A healthier lifestyle multiplies the baseline prevalence by a relative risk RR, p = RR · p0. Prevention and screening act differently: prevention lowers the number of cases; screening lowers deaths among cases that exist.

Benefit of early detection. Deaths without screening = N p mlate; with screening, detected cases die with probability mearly: N p [Se mearly + (1−Se) mlate]. So NNS = 1 / (p Se (mlate−mearly)) people must be screened to prevent one death, and FP/prevented death = FP / (TP (mlate−mearly)).

Honest simplifications. Mortality values are illustrative sliders, not data for any disease; no lead-time or length bias, no overdiagnosis, no harms of treatment or false-positive anxiety, no costs, and the test is assumed to have fixed Se and Sp. Not medical advice.