Example:Medical test

From CS2800 wiki

Suppose a patient takes a medical test to see if they have a rare disease. The disease is rare: only 1/10,000 people have it. The test has a very good false positive rate of 1% (that is, of the people who don't have the disease, 1% of them still test positive) and a false negative rate of 2% (of the people who do have the disease, 2% of them test negative).

If a patient takes the test and gets a positive result, what is the probability that they have the disease?

We can model this problem probabilistically. Let [math]D [/math] represent the event where the patient has the disease, and let [math]H [/math] be the event where the patient is healthy. Let [math]P [/math] be the event representing a positive test result, and let [math]N [/math] be the event that the test is negative.

We can interpret the facts from the problem:

  • the disease is rare: [math]\href{/cs2800/wiki/index.php/Pr}{Pr}(D) = 1/10000 [/math] (and therefore [math]\href{/cs2800/wiki/index.php/Pr}{Pr}(H) = 1 - \href{/cs2800/wiki/index.php/Pr}{Pr}(D) = 9999/10000 [/math]).
  • the false positive rate is 1%: [math]\href{/cs2800/wiki/index.php/Pr}{Pr}(P|H) = 1/100 [/math].
  • the false negative rate is 2%: [math]\href{/cs2800/wiki/index.php/Pr}{Pr}(N|D) = 2/100 [/math].

We are interested in the probability that the patient has the disease, given that they tested positive. In other words, we want to find [math]Pr(D|P) [/math].

We can apply Bayes' rule and the law of total probability (since [math]H [/math] and [math]D [/math] partition the sample space):


[math]Pr(D|P) = \frac{Pr(P|D)Pr(D)}{Pr(P)} = \frac{Pr(P|D)Pr(D)}{Pr(P|D)Pr(D) + Pr(P|H)Pr(H)} [/math]


We need [math]Pr(P|D) [/math], in other words, what is the probability that the test results are positive, given that someone has the disease. Intuitively, this should be 98% (1 - Pr(N|D)). And indeed it is. You can prove this using the fact that conditional probabilities satisfy Kolmogorov's axioms.


Plugging this in, we get


[math]\href{/cs2800/wiki/index.php/Pr}{Pr}(D\href{/cs2800/wiki/index.php/%5Cmid}{\mid}P) = \frac{98/100 \cdot 1/10000}{98/100 \cdot 1/10000 + 1/100 \cdot 9999/10000} = 98 / (98 + 9999) \approx 1/1000 [/math]


Perhaps this is surprising; you might expect that a positive result on a good test means you have the disease with high probability. And indeed, you have learned a great deal: your chances of having the disease went up by a factor of 10. However, because the disease is still rare, you are still not particularly likely to have it.

However, you might want to have further testing done; see the repeated medical test example.