girgit.org

Probability

Guess first: a 99% accurate test says you are ill

The big ideaWhen a disease is rare, even a very accurate test gives more false alarms than true ones, because the few mistakes on the huge healthy group outnumber the correct results on the tiny sick group. Bayes' theorem shows how much.

In simple words

Imagine a smoke alarm that almost never misses a fire, but beeps by mistake once in a hundred times when someone makes toast. Real fires are very rare, while toast is made every day. So most times the alarm beeps, it is toast, not fire. A test for a rare illness works the same way.

Guess first

A disease affects 1 person in 1,000. A test for it is "99% accurate": it gives a positive result for 99% of people who have the disease, and a (false) positive for only 1% of people who don't. A person picked at random tests positive. Guess: what is the chance they actually have the disease? About 99%? 90%? 50%? 10%?

Try it: answer in the widget, then make the disease commoner or rarer and watch the false alarms.

See what happens
About 9%. More than 9 in 10 people who test positive are healthy. Most people, and in surveys many doctors too, guess 90% or more. The reason is below.

Count 100,000 people

Probabilities are easier to feel as counts. Picture 100,000 people being tested.

  1. Who is sick? 1 in 1,000, so 100 are sick and 99,900 are healthy.
  2. Sick people who test positive: 99% of 100 = 99. (One sick person is missed.)
  3. Healthy people who test positive: 1% of 99,900 = 999. These are false positives: a positive result for someone who does not have the disease.
  4. All positives: 99 + 999 = 1,098.
  5. Fraction of positives who are really sick: \( \frac{99}{1098} \approx 0.09 \).

The 1% error rate looks small, but it is 1% of a crowd a thousand times bigger than the sick group.

The same thing with Bayes' theorem

Let E be "has the disease" and A be "tests positive". E and E′ form a partition. The data are

\[ \text{P}(E) = 0.001, \quad \text{P}(E') = 0.999, \quad \text{P}(A \mid E) = 0.99, \quad \text{P}(A \mid E') = 0.01 \]

\[ \text{P}(E \mid A) = \frac{\text{P}(E)\,\text{P}(A \mid E)}{\text{P}(E)\,\text{P}(A \mid E) + \text{P}(E')\,\text{P}(A \mid E')} = \frac{0.001 \times 0.99}{0.001 \times 0.99 + 0.999 \times 0.01} = \frac{0.00099}{0.01098} = \frac{11}{122} \approx 0.090 \]

The key number is the prior, \( \text{P}(E) = 0.001 \), often called the base rate. Forgetting it is the classic mistake. Note also that P(A|E) = 0.99 and P(E|A) ≈ 0.09 are wildly different: this is the "P(A|B) is not P(B|A)" trap from earlier in the chapter, in real life.

What changes the answer

  • A more common disease. If 1 person in 10 had it, the same test would give \( \text{P}(E \mid A) = \frac{0.1 \times 0.99}{0.1 \times 0.99 + 0.9 \times 0.01} = \frac{11}{12} \approx 0.92 \). The test did not change; the base rate did.
  • A second, independent test. After one positive, your chance is \( \frac{11}{122} \). Use that as the new prior. If a second independent test is also positive, \( \text{P} = \frac{\frac{11}{122} \times 0.99}{\frac{11}{122} \times 0.99 + \frac{111}{122} \times 0.01} = \frac{363}{400} \approx 0.91 \). That is why doctors confirm a positive screening test with another test.

The textbook's own worked example, an HIV test, makes the same point with slightly different numbers.

Two more classics of the same shape

Worked examples

  1. The guesser. On a four-option MCQ, a student knows the answer with probability 0.6 and otherwise guesses at random. She gets it right. What is the chance she knew it? Paths to "right": knew, \( 0.6 \times 1 = 0.6 \); guessed, \( 0.4 \times \frac14 = 0.1 \). So P(knew | right) \( = \frac{0.6}{0.7} = \frac67 \).
  2. The truth-teller. Kabir tells the truth 2 times in 3. He rolls a die and says, "It's a six." What is the chance it really is a six? Assume, as such questions do, that when he lies about a non-six he says "six". Paths to "says six": it is a six and he is truthful, \( \frac16 \times \frac23 = \frac{2}{18} \); it isn't and he lies, \( \frac56 \times \frac13 = \frac{5}{18} \). So P(six | says six) \( = \frac{2/18}{7/18} = \frac27 \). His word raises the chance from \( \frac16 \) to \( \frac27 \), not to \( \frac23 \).

Don't mix these up

  • "The test is 99% accurate" gives P(positive | sick). The patient wants P(sick | positive). Bayes connects them, and the base rate decides how far apart they are.
  • A false positive is a positive result for a healthy person. A false negative is a negative result for a sick person.

Try it. A metal detector at a station beeps for 95% of passengers carrying a weapon and, falsely, for 5% of those who aren't. 1 passenger in 500 carries a weapon. The detector beeps. Roughly what is the chance the passenger has a weapon?

Answer
Out of 10,000 passengers, 20 carry a weapon and 19 of them set it off. Of the 9,980 others, 5% = 499 set it off. So \( \frac{19}{19 + 499} = \frac{19}{518} \approx 0.037 \), under 4%.

Words to know

False positive
A test says "yes" for someone who does not have the condition.
False negative
A test says "no" for someone who does have the condition.
Base rate
How common the condition is before testing; the prior P(E).
Natural frequencies
Working with counts of people (99 out of 1,098) instead of decimals.

In the 1-in-1,000 disease example, which change would raise P(disease | positive) the most?

  1. Making the test catch 100% of sick people
  2. Cutting the false-positive rate from 1% to 0.1%
  3. Testing a million people instead of 100,000

A test catches 90% of cases of an illness and gives false positives for 10% of healthy people. Half the people tested have the illness. What is P(ill | positive)?

  1. 0.9
  2. 0.45
  3. 0.5

Why are most positives false when a disease is rare?

  1. The test usually misses sick people
  2. The healthy group is so large that its few errors outnumber the true cases
  3. Test results are random