MakarovSuites
English
EnglishDeutschРусскийУкраїнськаFrançaisEspañolItalianoPolski
Contact & licences

Math

A test and a disease

Ten thousand people, a disease and a test: the test sweeps the population and marks the positives, then everyone moves into a 2×2 table of sick or healthy against positive or negative. Guess what share of the positives is really sick, then see the tray - for a rare disease the false ones outnumber the true ten to one. Bayes' rule with this sheet's numbers, the factor you move lit up, the positives retested, and a task that shows specificity, not sensitivity, is the lever.

A test and a disease — Actual application image
Actual application image

What happens

Ten thousand people on a square. A disease has a prevalence: one in a thousand, say. A test has a sensitivity - how often it says yes to a sick person - and a specificity - how often it says no to a healthy one. Both 99 %. The sick are amber from the start; you can see them, the test cannot. The test sweeps the square row by row and lights the positives: amber where it caught a sick person, red where it flagged a healthy one. With ten sick people on the square and ten thousand healthy, 1 % of the healthy is a hundred - so a positive means sick about one time in eleven. That is Bayes' rule, and the square is the rule drawn: PPV = ps / (ps + (1 − p)(1 − q)). Drag across the square and the prevalence sweeps on a log scale; the chart is the worth of a positive against prevalence. Retest the positives and the last answer becomes the new prior - 9 % becomes 91 % becomes 99.9 %. The task: at a prevalence of 0.1 %, make a positive worth a coin flip without touching the prevalence. Sensitivity cannot do it even at 100 %; specificity can, at 99.90 %, because the false positives come from the healthy, and there are a thousand of them for every sick person.

Equations used in the module
Equations
square:  N = 10 000 people, prevalence p;  sick = pN, healthy = (1 − p)N
test:  sensitivity s = P(positive | sick), specificity q = P(negative | healthy);  true positives s·pN, false positives (1 − q)(1 − p)N, missed (1 − s)pN
value of a positive (Bayes):  PPV = ps / (ps + (1 − p)(1 − q));  rare (p = 0.1 %, s = q = 99 %): 9.0 %;  common (p = 10 %): 91.7 %;  screening (p = 1 %, s = 80 %, q = 90 %): 7.5 %
retest:  the positives tested again, prior = the last PPV;  rare → 9.0 % → 90.7 % → 99.9 %
the sampled square:  one draw for the disease and one for the test per person through the shared xorshift (seed 1);  rare: 13 sick, 13 true and 95 false positives (12.0 % in this draw, 9.0 % exact);  common: 1025 / 1018 / 88;  screening: 101 / 80 / 985
the lever:  at p = 0.1 %, s = 99 % a coin flip (PPV 50 %) needs 1 − q = ps(1 − 0.5)/(0.5(1 − p)), q = 99.90 %;  s = 100 % alone gives 9.1 %

Related experiments

Back to catalogue
Roots on the move — Actual application image

Math

Roots on the move

The roots of a polynomial on the complex plane, running as one coefficient sweeps: the cubic's two roots meet at the discriminant and leave the real axis as a pair, six roots turn on a circle, and Wilkinson's ten roots are thrown into the plane by two parts in a million on one coefficient - the closest pair, the real count and Cauchy's bound measured live, and a task on the collision.

Birthdays and collisions — Actual application image

Math

Birthdays and collisions

People arrive on a ring of days until two share one: in a year of 365 that is the 23rd person, not the 183rd, on Mars the 32nd, in 65 536 hash buckets the 302nd - runs against the exact curve, the days swept by dragging from a year to 2³², the square-root rule read live, and a task on the Martian room.

A code that repairs itself — Actual application image

Math

A code that repairs itself

Sixteen bits in a square, eleven of them a message: click one and the four check lamps spell out its address, and the block puts itself right. Two errors are caught but not repairable; three, and the block lies with confidence. Every claim is exhaustive - all 32 768 single errors located, all 245 760 double errors caught, every triple mis-corrected.