Bayes' Theorem Math Example 2

Follow the full solution, then compare it with the other examples linked below.

Example 2

hard
Drug testing: P(user)=0.05P(\text{user})=0.05. Test sensitivity P(+โˆฃuser)=0.99P(+|\text{user})=0.99. Specificity P(โˆ’โˆฃnon-user)=0.95P(-|\text{non-user})=0.95 (so P(+โˆฃnon-user)=0.05P(+|\text{non-user})=0.05). Find P(userโˆฃ+)P(\text{user}|+).

Solution

  1. 1
    P(non-user)=0.95P(\text{non-user}) = 0.95
  2. 2
    P(+)=P(+โˆฃuser)P(user)+P(+โˆฃnon-user)P(non-user)=0.99(0.05)+0.05(0.95)=0.0495+0.0475=0.097P(+) = P(+|\text{user})P(\text{user}) + P(+|\text{non-user})P(\text{non-user}) = 0.99(0.05) + 0.05(0.95) = 0.0495 + 0.0475 = 0.097
  3. 3
    P(userโˆฃ+)=0.99ร—0.050.097=0.04950.097โ‰ˆ0.510P(\text{user}|+) = \frac{0.99 \times 0.05}{0.097} = \frac{0.0495}{0.097} \approx 0.510
  4. 4
    Despite 99% sensitivity and 95% specificity, only 51% of positives are true users!

Answer

P(userโˆฃ+)โ‰ˆ0.51P(\text{user}|+) \approx 0.51. Even with a highly accurate test, only 51% of positive tests are true users.
The low base rate (5% users) means most positives are false positives, even with a very accurate test. This is the base rate fallacy โ€” ignoring prior probabilities when interpreting test results. Bayes' theorem correctly accounts for prevalence, test sensitivity, and specificity together.

About Bayes' Theorem

Bayes' theorem gives the posterior probability of a hypothesis given evidence: P(HโˆฃE)=P(EโˆฃH)โ‹…P(H)P(E)P(H|E) = \frac{P(E|H) \cdot P(H)}{P(E)}.

Learn more about Bayes' Theorem โ†’

More Bayes' Theorem Examples