
Section 07: Probability & Statistics
Test your understanding of Conditional Probability
If \(P(A) = 0.5\), \(P(B) = 0.4\), and \(P(A \cap B) = 0.2\), find \(P(A|B)\).
A bag has 4 red and 6 blue balls. Two are drawn without replacement. Find \(P(\text{both blue})\).
Given \(P(B|A) = 0.6\) and \(P(A) = 0.3\), find \(P(A \cap B)\).
If \(P(A|B) = P(A)\), what can we conclude about A and B?
Let’s clear up conditional probability before Bayes’ reversal.
Bayes’ Theorem appears on virtually every Feststellungsprüfung!
The problem: We often know \(P(B|A)\) but need \(P(A|B)\).
Example:
These are not the same! This is a common misconception.
Given \(P(B|A)\), we can compute \(P(A|B)\):
\[P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}\]
Since \(P(B)\) is often not directly known, we expand it using the law of total probability:
\[P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B|A) \cdot P(A) + P(B|A') \cdot P(A')}\]
\(A'\) is the complement of \(A\).
A common application is in medical testing:
| Formula Part | In a medical test example |
|---|---|
| \(P(A)\) | Probability of having the disease |
| \(P(B|A)\) | Probability of a positive test given disease |
| \(P(A|B)\) | Probability of disease given a positive test |
| \(P(B)\) | Overall probability of a positive test |
Let’s see Bayes in action with a simple example:
Question: An employee was promoted. What is the probability they have an MBA?
Let’s see Bayes in action with a simple example:
Let \(M\) = has MBA, \(P\) = promoted
\[P(M|P) = \frac{P(P|M) \cdot P(M)}{P(P|M) \cdot P(M) + P(P|M') \cdot P(M')}\]
\[= \frac{0.80 \times 0.30}{0.80 \times 0.30 + 0.40 \times 0.70} = \frac{0.24}{0.24 + 0.28} = \frac{0.24}{0.52} \approx 0.462\]
Makes sense, since 30% of employees have an MBA, and 70% don’t. The probability of being promoted is higher for those with an MBA, but not enough to outweigh the larger group without an MBA.

Read the joint probabilities from the tree, then divide to reverse the condition!
Medical tests are a classic application of Bayes’ Theorem, but the same logic applies to any binary classification problem.
| Metric | Formula | Meaning |
|---|---|---|
| True Positive Rate | \(P(+\|D)\) | Prob. of positive given condition |
| True Negative Rate | \(P(-\|D')\) | Prob. of negative given no condition |
| Base Rate | \(P(D)\) | Proportion with condition in population |
| Pos. Predictive Value | \(P(D\|+)\) | Prob. of condition given positive |
| Neg. Predictive Value | \(P(D'\|-)\) | Prob. of no condition given negative |
These metrics apply wherever you have a 2×2 contingency table — medical tests, fraud detection, spam filters, credit scoring, etc.
The same concepts have different names depending on the field. Here is the mapping:
| Formula | Statistics | Medicine | Machine Learning |
|---|---|---|---|
| \(P(+\|D)\) | True Positive Rate | Sensitivity | Recall |
| \(P(-\|D')\) | True Negative Rate | Specificity | — |
| \(P(D\|+)\) | Pos. Predictive Value | — | Precision |
| \(P(+\|D')\) | False Positive Rate | 1 − Specificity | Fall-out |
| \(P(D)\) | Base Rate | Prevalence | Prior |
In this course, we use the statistics column. When you encounter synonyms in textbooks or online, map them back to this table.
Every test or prediction has four possible outcomes:
A rapid COVID test has:
Question: If you test positive, what’s the probability you actually have COVID?
Calculate \(P(+)\) using law of total probability:
Apply Bayes:
Only about 49% of positive tests are true positives when the base rate is low!

Work individually
A test has a true positive rate of 80% and a true negative rate of 90%. The base rate is 10%. Write Bayes’ formula for the Positive Predictive Value (do not compute).
If \(P(A)=0.3\), \(P(B|A)=0.7\), and \(P(B|A')=0.2\), compute \(P(B)\).
In one sentence: why is \(P(D|+)\) usually much lower than \(P(+|D)\) when the base rate is low?
Bayes’ Theorem Strategy
A screening test for a disease has:
Find:
Find the positive predictive value:
\[P(D|+) = \frac{P(+|D) \cdot P(D)}{P(+|D) \cdot P(D) + P(+|D') \cdot P(D')}\]
Given values:
Find the positive predictive value:
\[P(D|+) = \frac{0.90 \times 0.01}{0.90 \times 0.01 + 0.05 \times 0.99}\]
\[= \frac{0.009}{0.009 + 0.0495} = \frac{0.009}{0.0585} \approx 0.154\]
The Positive Predictive Value is only 15.4%!
Find the negative predictive value:
\[P(D'|-) = \frac{P(-|D') \cdot P(D')}{P(-)}\]
Calculate \(P(-)\):
\[P(-) = P(-|D) \cdot P(D) + P(-|D') \cdot P(D') = 0.9415\]
\[P(D'|-) = \frac{0.95 \times 0.99}{0.9415} = \frac{0.9405}{0.9415} \approx 0.999\]
The Positive Predictive Value is only 15.4%, but the Negative Predictive Value is 99.9%!

The Positive Predictive Value depends heavily on the base rate. Even a very accurate test produces many false positives when the condition is rare!
Do Not Mix Up These Three Probabilities:
They answer different questions and usually have very different values!
Use a hypothetical population (e.g., 10,000 people):
| Condition (+) | Condition (−) | Total | |
|---|---|---|---|
| Predicted + | 90 | 495 | 585 |
| Predicted − | 10 | 9,405 | 9,415 |
| Total | 100 | 9,900 | 10,000 |
Read directly:
Both methods are valid, but the table method is often easier:
| Formula Method | Table Method |
|---|---|
| Faster for single probability | Better when multiple values needed |
| Direct plug-in | Visual and intuitive |
| Preferred for “show your work” | Good for checking answers |
| Easy to make arithmetic errors | Harder to lose track of numbers |
On the exam, use the contingency table to verify your Bayes formula result!
Bayes’ Theorem applies whenever you need to reverse a conditional probability!
Question: What are some other applications of Bayes’ Theorem?
An email filter classifies messages. Historical data shows:
Question: If an email is flagged as spam, what is the probability it’s actually spam?
\[P(S|F) = \frac{P(F|S) \cdot P(S)}{P(F|S) \cdot P(S) + P(F|S') \cdot P(S')}\]
About 89% of flagged emails are truly spam.
A factory has three machines producing bolts:
Question: A bolt is defective. Which machine most likely produced it?
\[P(D) = 0.02(0.50) + 0.03(0.30) + 0.05(0.20) = 0.029\]
Machine I and III are equally likely — even though III has a higher defect rate, I produces more!
Work in pairs
A factory has two machines:
If a randomly selected item is defective, what’s the probability it came from Machine A?
Work in pairs
A medical test has a true positive rate of 85% and a true negative rate of 90%.
In a population with a 5% base rate:
Work in pairs
In a newborn screening program, “98.9% of all hearing-impaired newborns are recognized by the test” and “4.8% of healthy newborns test positive.”
Let \(D\) = hearing impaired, \(+\) = positive test.
Work in pairs
A company’s customer base consists of 70% regular customers and 30% new customers. Among regular customers, 15% make a return. Among new customers, 25% make a return.
Work individually, then compare
A test has a true positive rate of \(0.90\), a false positive rate of \(0.08\), and a base rate of \(0.04\).
Think individually (2 min), then work in groups of 3-4
A test has a true positive rate of \(0.92\) and a true negative rate of \(0.94\).
Two populations are considered:
Think individually, then work in groups
An insurance company flags claims using an automated system:
Think individually, then work in groups
A tech company hires through two channels:
After one year, 60% of portal hires and 85% of referral hires are rated “high performer.”
Work individually
Homework
Complete Tasks 07-05 — especially the medical testing and business application problems!
Session 07-05 - Bayes’ Theorem | Dr. Nikolai Heinrichs & Dr. Tobias Vlćek | Home