Chapter 01

The Test

Medical Diagnostics

You are a doctor. A patient sits across from you, slightly pale, fingers laced tight in their lap. You've just received the results of a routine screening test — and it came back positive.

The test is 95% accurate. That sounds reassuring. The patient asks the obvious question: “So I have it?”

Your instinct says probably. After all, 95% is a high number. But your instinct is about to betray you. The answer depends on something the test result alone cannot tell you — and it's the single most important number in all of probabilistic reasoning.

The Hidden Variable

Look at the interactive panel. The Base Rate slider is set to 1% — meaning one in every hundred people in the population actually has this disease. Now drag it down to 0.1%.

Watch what happens to the dot grid. Those orange dots? Every one of them is a healthy person who just received a positive test result. They're terrified for nothing. And they vastly outnumber the red dots — the people who actually have the disease.

At a 0.1% base rate with a 95% accurate test, fewer than 2% of positive results are true positives. The test is still 95% accurate. But a positive result is almost meaningless.

Why This Happens

Here's the mechanism. When a disease is rare, the population of healthy people is enormous compared to the population of sick people. Even a small false positive rate — that 5% error — applied to a massive healthy population produces a flood of false alarms.

Try dragging the Specificity slider. This controls how well the test avoids false positives. Push it to 99% and watch the orange dots shrink. That single percentage point matters more than you'd expect, because it's applied to thousands of healthy people.

Now try the Sensitivity slider. This controls how well the test catches real cases. Drag it down to 50%. The red dots thin out — the test is missing half the sick people — but the overall picture barely changes. Sensitivity matters for finding cases. Specificity matters for not crying wolf.

The Equation

Toggle the equation overlay above. What you're looking at is Bayes' theorem, written in a form called the Positive Predictive Value. It answers a single question: given a positive test, what's the probability the patient is actually sick?

The numerator is the probability of being sick and testing positive. The denominator is the probability of testing positive for any reason — truly sick or falsely flagged. When the base rate is low, that denominator is dominated by false positives, and the fraction collapses.

Drag each slider and watch its corresponding term light up in the equation. The math isn't abstract — every symbol maps to a lever you can pull.

Beyond Medicine

This isn't just about medical tests. Every screening system in the world faces this exact tradeoff. Spam filters flag legitimate emails. Airport security stops innocent travelers. Drug tests in workplaces produce false positives that cost people their jobs.

The pattern is always the same: when what you're looking for is rare, even an accurate detector will be wrong most of the time it fires. The base rate is the invisible variable that determines whether a positive result means anything at all.

Sound familiar? In the next chapter, you'll see this same math wearing a different disguise — a radio telescope searching for signals in a sky full of noise.