Understanding Diagnostic Tests

From Bayesian Math to Communicating Risk

The Math Basics of Diagnostic Testing

To evaluate a medical test, we start with its core properties. Click on each card to reveal the mathematical notation.

Prevalence

How common is the disease in the population? (The "prior probability").

$$P(D)$$

Sensitivity

If a person *has* the disease, how often is the test positive? (True Positive Rate).

$$P(T^+|D)$$

Specificity

If a person is healthy, how often is the test negative? (True Negative Rate).

$$P(T^-|D')$$

These properties don't answer the patient's crucial question: "I tested positive. What is the chance I actually have the disease?" That requires calculating the predictive values.

The Predictive Values

Positive Predictive Value (PPV)

Probability of disease, given a positive test.

$$PPV = P(D|T^+) = \frac{\text{TP}}{\text{TP} + \text{FP}}$$

Negative Predictive Value (NPV)

Probability of no disease, given a negative test.

$$NPV = P(D'|T^-) = \frac{\text{TN}}{\text{TN} + \text{FN}}$$

Now, let's explore how these values change in the Interactive Explorer.

Outcome and test characteristics

Results

Positive Predictive Value (PPV)

...%

Negative Predictive Value (NPV)

...%

Theater of 1000 People

TP: 0
FN: 0
FP: 0
TN: 0
Total: 1000

Scaled Venn Diagram

A Worked Example: Communicating Risk

This interactive example walks through a classic scenario from Gerd Gigerenzer's book, "Calculated Risks," using natural frequencies to make the math intuitive.

Theater of 1000 Women

Bayesian Methods: The Deeper Framework

The diagnostic test calculations you've been exploring are actually a specific application of Bayes' theorem—the fundamental framework for updating beliefs with evidence.

This appendix shows you how diagnostic testing fits into the broader landscape of Bayesian methods, helping you understand the deeper statistical principles at work.

Bayes' Theorem: The Connection

Diagnostic testing is just a specific case of Bayes' theorem. Click each card to see the mathematical relationship:

General Bayes' Formula

The fundamental framework for updating beliefs with evidence.

$$P(D|T^+) = \frac{P(T^+|D) \cdot P(D)}{P(T^+)}$$

Positive Predictive Value

What we want to know: probability of disease given a positive test.

$$PPV = P(D|T^+)$$

Test Characteristics

The performance properties of the diagnostic test.

$$P(T^+|D) = \text{Sensitivity}$$
$$P(T^-|D') = \text{Specificity}$$

Prior Probability

What we believe before seeing the test result.

$$P(D) = \text{Prevalence}$$

Sequential Testing

Using multiple tests to refine diagnosis over time.

$$P(D|T_1^+, T_2^+)$$

Yesterday's posterior = Today's prior

Test Comparison

Comparing diagnostic test performance.

$$\frac{P(T^+|D)_A}{P(T^+|D)_B}$$

Which test better identifies disease?

Updating Priors with Evidence

The key insight of Bayesian methods is prior updating: each piece of evidence transforms today's posterior probability into tomorrow's prior. This is exactly what happens when a patient gets multiple diagnostic tests.

The Updating Process

Step 1

Start with Prior: Initial prevalence (your belief before testing)

Step 2

Observe Evidence: Test result (positive or negative)

Step 3

Calculate Posterior: Updated probability using Bayes' theorem

Repeat

Use as New Prior: For the next test or decision

Prior Updating Explorer

Prior → Posterior Updates

Starting Prior: 1.0%

Further Reading

The worked example in this demonstration comes from Gerd Gigerenzer's excellent book on communicating statistical risk:

Calculated Risks: How to Know When Numbers Deceive You

by Gerd Gigerenzer

Essential reading for understanding how to communicate Bayesian reasoning clearly and effectively.