stats

ðŸŸĒ Stats: Bayes' Theorem — The Most Asked Probability Topic

Bayes lets you flip a conditional probability. You know P(B|A), you want P(A|B).

P(A|B) = P(B|A) × P(A) / [P(B|A) × P(A) + P(B|ÂŽA) × P(ÂŽA)]

The classic interview question

"1 in 1,000 people have a disease. A test is 98% sensitive (true positive rate) with a 1% false positive rate. Someone tests positive — probability they're actually sick?"

Step by step: - P(Disease) = 0.001 - P(Positive | Disease) = 0.98 - P(Positive | No Disease) = 0.01

P(Disease | Positive) = (0.98 × 0.001) / (0.98 × 0.001 + 0.01 × 0.999)
                      = 0.00098 / (0.00098 + 0.00999)
                      = 0.00098 / 0.01097
                      ≈ 0.089 → about 8.9%

Why so low? The disease is so rare that even a 1% false positive rate applied to 999 healthy people (~10 false positives) swamps the ~1 true positive. This is called base rate neglect — most people guess 98% because they ignore how rare the disease is.

The follow-up: "How would you make this test useful?" → Re-test positives with a more specific second test, or only test high-risk populations where the base rate is higher.