Conditional Probability
& Screening Tests
Learn how to compute \( P(A \mid B) \), apply Bayes' Theorem, and interpret real-world screening results with confidence.
What Is Conditional Probability?
Conditional probability measures the likelihood of event \( A \) occurring given that event \( B \) has already occurred. We write it as \( P(A \mid B) \) and read it as "the probability of \( A \) given \( B \)."
The denominator \( P(B) \) restricts our "universe" to only those outcomes where \( B \) is true. The numerator counts outcomes where both \( A \) and \( B \) happen.
Visualising \( P(A \mid B) \)
Why Screening Tests Matter
Businesses and healthcare systems use screening tests to make quick decisions: Is this transaction fraudulent? Does this patient have a disease? The test says positive or negative, but no test is perfect.
Don't Confuse These Two
| Sensitivity | Positive Predictive Value | |
|---|---|---|
| Symbol | \( P(+ \mid D) \) | \( P(D \mid +) \) |
| Question | If truly sick, will the test catch it? | If the test is positive, am I really sick? |
| Known | Disease status is known | Test result is known |
| Depends on prevalence? | No | Yes, heavily |
Bayes' Theorem: The Bridge
The denominator is the total probability of testing positive, which includes true positives and false positives. This is the Law of Total Probability:
The Probability Tree
Step-by-Step Approach
Example 1: Rare Disease
A disease affects 1% of the population. A screening test has sensitivity = 95% and specificity = 90%. If a person tests positive, what is \( P(D \mid +) \)?
Surprise: Only 8.8%?
Even with a "good" test (95% sensitivity, 90% specificity), a positive result means only about a 1-in-11 chance of truly having the disease. Why? Because the disease is rare: the 10% false positive rate generates many more false alarms than the 1% prevalence generates true cases.
Example 2: Fraud Detection
A bank's algorithm flags 2% fraud prevalence. It catches 98% of true fraud (sensitivity) and correctly clears 95% of legitimate transactions (specificity). What is \( P(\text{Fraud} \mid \text{Flagged}) \)?
Example 3: High Prevalence Changes Everything
Same test (sensitivity 95%, specificity 90%) but now prevalence is 20%. Recalculate \( P(D \mid +) \).
The 2 x 2 Contingency Table
| Disease (D) | No Disease (\( D^c \)) | Total | |
|---|---|---|---|
| Test + | TP | FP | TP + FP |
| Test - | FN | TN | FN + TN |
| Total | TP + FN | FP + TN | N |
Common Mistakes
Summary of Key Metrics
| Metric | Formula | Meaning |
|---|---|---|
| Sensitivity | \( \frac{TP}{TP+FN} \) | Catch rate for true cases |
| Specificity | \( \frac{TN}{FP+TN} \) | Clear rate for non-cases |
| PPV | \( \frac{TP}{TP+FP} \) | Reliability of a positive result |
| NPV | \( \frac{TN}{FN+TN} \) | Reliability of a negative result |
| FPR | \( \frac{FP}{FP+TN} \) | False alarm rate |
Question 1 of 5
A disease has prevalence 5%. A test has sensitivity 90% and specificity 80%. What is \( P(+) \), the total probability of testing positive?
Question 2 of 5
Using the same test (sensitivity 90%, specificity 80%, prevalence 5%), what is \( P(D \mid +) \)?
Question 3 of 5
Which factor has the greatest impact on Positive Predictive Value when sensitivity and specificity are held constant?
Question 4 of 5
In a population of 10,000 with 3% disease prevalence, sensitivity = 95%, specificity = 92%. How many false positives are expected?
Question 5 of 5
A company's drug test has specificity 99% and sensitivity 99%. Drug use prevalence is 0.5%. An employee tests positive. What is the approximate \( P(\text{User} \mid +) \)?