STAT 101
M03 · L03
Module 3

Bayes’ Theorem in Practice

From formula to real decisions. Medical tests, spam filters, A/B experiments — all powered by Bayesian reasoning.

01 / 13
STAT 101
M03 · L03
Medical test vocabulary

Sensitivity & Specificity

Sensitivity
P(+ | Disease)
True positive rate
Specificity
P(− | Healthy)
True negative rate

These describe the test. What patients want is the reverse: P(Disease | +)

02 / 13
STAT 101
M03 · L03
The clinically relevant quantity

Positive Predictive Value

PPV = P(Disease | positive test). Computed via Bayes’ theorem — and it depends on prevalence.

PPV
PPV = \dfrac{P(+\mid D)\,P(D)}{P(+\mid D)\,P(D)+P(+\mid\bar{D})\,P(\bar{D})}
03 / 13
STAT 101
M03 · L03
The most common probability mistake

The Base Rate Fallacy

  • Ignoring prevalence when interpreting a positive test
  • Focusing on accuracy, forgetting how rare the disease is
  • Most positive results from a rare-disease test are false positives
  • Bayes’ theorem forces you to weight accuracy by base rate
04 / 13
STAT 101
M03 · L03
Rare disease screening

The Surprising Result

Prevalence 0.1%, sensitivity 99%, specificity 99%. You test positive.

Calculation
PPV = 0.99×0.001 / (0.99×0.001 + 0.01×0.999)
= 0.00099 / 0.01098 ≈ 9%
05 / 13
STAT 101
M03 · L03
Why 9%? Think in populations

The Population View

In 100,000 people: 100 sick (99 test positive) and 99,900 healthy (999 false positives). The false positives outnumber true positives ~10 to 1.

True Positives
99
False Positives
999
06 / 13
STAT 101
M03 · L03
Sequential reasoning

Bayesian Updating

Today’s posterior is tomorrow’s prior. Each new piece of evidence refines your belief.

Two independent positive tests
Prior 0.1% → After test 1: ~9% → After test 2: ~91%
07 / 13
STAT 101
M03 · L03
Naïve Bayes classifier

Spam Filtering

  • Each word is independent evidence of spam (naïve assumption)
  • Train on labeled spam / ham emails to get P(word | spam)
  • For new email: P(spam | words) ∝ P(spam) × ∏ P(wi | spam)
  • Fast, interpretable, competitive with complex models
08 / 13
STAT 101
M03 · L03
Bayesian vs. frequentist

Bayesian A/B Testing

Instead of a p-value, get a direct answer: P(B better than A | data). Start with a prior belief about each rate, then update it with every conversion.

Frequentist
p < 0.05?
Bayesian
P(B>A) = 94%
09 / 13
STAT 101
M03 · L03
Bayes in machine learning

Bayes & ML

  • MAP estimation = MLE + prior = regularization
  • L2 reg ↔ Gaussian prior; L1 reg ↔ Laplace prior
  • Bayesian neural nets: full posterior over weights
  • Gaussian processes: Bayesian models over functions
10 / 13
STAT 101
M03 · L03
The Bayesian worldview

Always Ask: What’s the Prior?

  • A “99% accurate” test means nothing without the base rate
  • Uncertainty is first-class: models should know what they don’t know
  • Learning is updating: every observation refines beliefs
  • Prior knowledge is data — domain expertise enters naturally
11 / 13
STAT 101
Knowledge Check

Check what stuck

Four questions from this lesson. Answer to see why — the explanation appears whether you were right or wrong. Nothing is scored or saved.

Question 1 of 0
Score 0/0

12 / 13
STAT 101
Summary
Recap

What you learned

Sensitivity & specificity, PPV, the base rate fallacy, Bayesian updating, naïve Bayes spam filters, Bayesian A/B testing, and Bayes’ role in machine learning — the engine of rational belief revision.

Module 3 Complete
Module 4: Random Variables →
13 / 13