Lambdia

Una prueba que nunca falla, un positivo, y 6,7 %

Una enfermedad que tiene una persona de cada doscientas, y una prueba sin ningún falso negativo. La respuesta refleja ante un positivo supera el noventa por ciento, y se equivoca por más de un factor de diez. Una multitud de mil personas lo enseña antes que el álgebra, y Bayes fija la cifra exacta en 100/1493.

A disease affects one person in two hundred. There is a test for it, and the test is flawless in the direction you would worry about first: if you have the disease, it always says so. It has never once returned a clean result for a sick person. Its only weakness runs the other way, calling about 7%7\% of perfectly healthy people sick.

You take the test. It comes back positive. What is the probability that you actually have the disease?

Most people answer somewhere above 90%90\%, and a good number say exactly 93%93\%. The true figure is

P(D+)  =  1001493    6.7%.P(D \mid +) \;=\; \frac{100}{1493} \;\approx\; 6.7\%.

So more than nine positives out of ten belong to people with nothing wrong with them. This is question 4.30 in Timothy Crack's Heard on the Street, and some version of it turns up in quantitative interviews constantly, because it separates candidates who manipulate conditional probabilities from candidates who pattern-match on the number they were handed.

Where the instant answer goes wrong

The 93%93\% answer comes from a single silent substitution. You are told that the test misfires on 7%7\%of healthy people, so it feels natural to say the test is “93% accurate” and therefore that a positive result is 93% likely to be right. That reads the conditional backwards.

The two conditionals are different quantities

P(+Dc)=0.07P(+ \mid D^{c}) = 0.07 is a property of the test: given a healthy person, how often does the machine cry wolf? P(D+)P(D \mid +) is a property of the test and the population: given an alarm, how often is it real? Nothing forces them to be close, and when the disease is rare they are not remotely close.

The missing ingredient is the prevalence, P(D)=1/200P(D) = 1/200. It never appears in the reflex answer, which is exactly why the reflex answer cannot be right: change the disease from common to vanishingly rare, leave the test untouched, and the reflex would return the same 93% every time. A quantity that ignores its own input is not measuring anything.

A thousand people, and the answer you can see

Before any algebra, stop thinking about yourself and think about a crowd. Take a thousand people and run the test on all of them.

Five of them have the disease, since the prevalence is one in two hundred. The test catches every one of those five, because it has no false negatives. That leaves 995 healthy people, and the test flags 7%7\% of them, which is

0.07×995  =  69.65    70 people.0.07 \times 995 \;=\; 69.65 \;\approx\; 70 \text{ people.}
Five real cases hide inside roughly seventy-five alarms.

So about 75 people walk out holding a positive result, and only 5 of them are sick. Your result is one of those 75, and you have no way to tell which kind you are. That gives

55+69.65  =  574.65  =  1001493    6.7%.\frac{5}{5 + 69.65} \;=\; \frac{5}{74.65} \;=\; \frac{100}{1493} \;\approx\; 6.7\%.

The rounded version is easier to carry into an interview: five real cases against seventy false ones is one in fifteen, near enough. The reason the healthy group wins is not that the test is bad. It is that 7%7\% of a very large group is much bigger than 100%100\% of a very small one.

The same result in one line of algebra

The crowd argument is Bayes' theorem with the denominators cleared. Written out, with DD for having the disease and ++ for a positive result,

P(D+)  =  P(+D)P(D)P(+D)P(D)  +  P(+Dc)P(Dc)P(D \mid +) \;=\; \frac{P(+ \mid D)\,P(D)}{P(+ \mid D)\,P(D) \;+\; P(+ \mid D^{c})\,P(D^{c})}

and substituting the three numbers the question gives,

P(D+)  =  1×0.0051×0.005  +  0.07×0.995  =  0.0050.07465  =  1001493.P(D \mid +) \;=\; \frac{1 \times 0.005}{1 \times 0.005 \;+\; 0.07 \times 0.995} \;=\; \frac{0.005}{0.07465} \;=\; \frac{100}{1493}.

There is a faster route that is worth knowing, because it survives contact with messier numbers: work in odds instead of probabilities. The prior odds of being sick are 1/200199/200=1199\tfrac{1/200}{199/200} = \tfrac{1}{199}. The likelihood ratio of a positive result is

Λ  =  P(+D)P(+Dc)  =  10.07  =  1007,\Lambda \;=\; \frac{P(+ \mid D)}{P(+ \mid D^{c})} \;=\; \frac{1}{0.07} \;=\; \frac{100}{7},

and Bayes in odds form is a single multiplication:

posterior odds  =  1199×1007  =  1001393P(D+)=1001393+100=1001493.\text{posterior odds} \;=\; \frac{1}{199} \times \frac{100}{7} \;=\; \frac{100}{1393} \quad\Longrightarrow\quad P(D \mid +) = \frac{100}{1393 + 100} = \frac{100}{1493}.

Same answer, no denominator to assemble. The likelihood ratio says the evidence multiplies your odds by about fourteen. That sounds decisive until you remember what it multiplies: odds of 1 to 199. Fourteen times almost nothing is still almost nothing.

What happens when the disease gets rarer

Keep the test exactly as it is and make the disease ten times rarer, one person in two thousand. With pp for prevalence and ff for the false positive rate, and still no false negatives, the general form is

P(D+)  =  pp+f(1p),P(D \mid +) \;=\; \frac{p}{p + f\,(1 - p)},

which at p=1/2000p = 1/2000 and f=0.07f = 0.07 gives

0.00050.0005+0.07×0.9995  =  10014093    0.71%.\frac{0.0005}{0.0005 + 0.07 \times 0.9995} \;=\; \frac{100}{14093} \;\approx\; 0.71\%.

A positive result now means roughly one chance in a hundred and forty. Nothing about the instrument changed. For small pp the expression is close to p/fp/f, so the answer falls in proportion to the prevalence: the rarer the thing you are hunting, the more of your alarms are noise. That approximation is the one worth memorising, since it turns the whole question into a division you can do out loud.

Screening a population is not testing a patient

None of this says the test is useless, and the difference is where the practical lesson lives. Everything above assumed you were pulled at random out of the general population, so the only thing known about you before the test was the base rate.

Someone who walks into a clinic with symptoms is not a random draw. Their prior is not 1 in 200, it might be 1 in 5, and the same test on the same day produces

0.20.2+0.07×0.8  =  200256    78%.\frac{0.2}{0.2 + 0.07 \times 0.8} \;=\; \frac{200}{256} \;\approx\; 78\%.

The identical positive result now means something almost entirely different. This is why mass screening for rare conditions generates so many frightening letters and so few diagnoses, and why a second, independent test changes the picture so fast: run one with the same likelihood ratio and the odds multiply again, which is what pushes 100/1393100/1393 up past even money.

In an interview, the move being tested is whether you ask for the prevalence at all. A candidate who answers before asking has told the room they will estimate a conditional probability without checking what it is conditioned on.

Sources and further reading

The problem is question 4.30 in Timothy Falcon Crack, Heard on the Street: Quantitative Questions from Wall Street Job Interviews, which collects problems used in real trading and quant interviews. The underlying result is standard: see the Wikipedia entries for Bayes' theorem, the base rate fallacy, and sensitivity and specificity, which is where the vocabulary of false positives and false negatives is defined precisely.

The framing in terms of a crowd rather than a single person follows Gerd Gigerenzer's work on natural frequencies, which found that doctors given the same problem in counts rather than percentages get it right far more often than when it is posed with conditional probabilities.

Comentarios · 0

Sé el primero en comentar.