Statistics · Unit 2 · Week 5 · Lesson 15 · 12 minute reading

Bayes' Theorem and the Base-Rate Trap

Why a test can be highly accurate and still produce many false alarms.

By the end of this lesson, you should be able to

  • Calculate a conditional probability using Bayes' theorem.
  • Distinguish sensitivity from positive predictive value.
  • Explain why the prevalence of an event changes the meaning of new evidence.

A medical screening test is described as “90 percent accurate.” Is a positive result a 90 percent chance that you have the condition?

Not necessarily. In fact, that inference can be wrong by a remarkable amount. The trouble is that there are two different conditional probabilities, and reversing them changes the question.

We will use a fictional test and hypothetical numbers rather than make any claims about a real disease.

Conditional probability changes the sample space

For events AA and BB with P(B)>0P(B)>0,

P(A∣B)=P(A∩B)P(B).P(A\mid B)=\frac{P(A\cap B)}{P(B)}.

Read this as “the probability of AA, given that BB occurred.”

A conditional probability does not simply tell us that two things are related. It says we are restricting attention to cases where the condition is known to hold.

For a diagnostic test, consider two distinct probabilities:

  • Sensitivity: P(+∣D)P(+\mid D), the probability of a positive test given that the condition is present.
  • Positive predictive value: P(D∣+)P(D\mid +), the probability of the condition given a positive test.

These are not the same fraction.

Enter Bayes

Bayes’ theorem gives us a way to reverse a conditional probability while accounting for how common the underlying condition is:

P(D∣+)=P(+∣D) P(D)P(+∣D) P(D)+P(+∣Dc) P(Dc).P(D\mid +)= \frac{P(+\mid D)\,P(D)} {P(+\mid D)\,P(D)+P(+\mid D^c)\,P(D^c)}.

Here P(D)P(D) is prevalence, and P(+∣Dc)P(+\mid D^c) is the false-positive rate, which equals 1−specificity1-\text{specificity}.

Suppose the hypothetical condition affects 1 percent of people. The fictional test has 90 percent sensitivity and 95 percent specificity.

Out of 10,000 screened people, we expect approximately 100 to have the condition. Around 90 of those would test positive. Of the 9,900 without the condition, about 495 would test positive anyway.

Therefore, among expected positive results,

P(D∣+)=9090+495≈0.15385.P(D\mid +)=\frac{90}{90+495}\approx 0.15385.

Just 15.4 percent, not 90 percent.

The test hasn’t failed to achieve the assumed sensitivity or specificity. The low prevalence means that even a relatively small false-positive rate generates many positives among the much larger group without the condition.

Why the base rate matters

This is the base-rate problem. The same evidence can carry a different meaning in populations where the underlying condition is more or less common.

Change the prevalence in the laboratory below while leaving sensitivity and specificity untouched. Notice how the positive predictive value moves.

This is equally relevant to fraud detection, spam filtering, equipment fault monitoring, and other settings where we attempt to detect rare events.

What this example does not imply

The example does not recommend screening, diagnosis, or treatment for anyone. Real tests have different characteristics in different populations and settings. Sampling, verification, selection, and measurement also matter.

The lesson is narrower and more general: when interpreting evidence, remember how probable the underlying event was before the evidence arrived.

Exercise

  1. For a hypothetical test with 80 percent sensitivity, 90 percent specificity, and 10 percent prevalence, find P(D∣+)P(D\mid +).
  2. Is a 99 percent specificity equivalent to a 99 percent positive predictive value?
  3. Why might the same positive test have different predictive values in two populations?
Worked answers
  1. The true-positive portion is .1(.8)=.08.1(.8)=.08, and the false-positive portion is .9(.1)=.09.9(.1)=.09. Thus .08/(.08+.09)≈.4706.08/(.08+.09)\approx.4706, or 47.1 percent.

  2. No. Specificity is P(−∣Dc)P(-\mid D^c), whereas positive predictive value is P(D∣+)P(D\mid +).

  3. Prevalence changes the relative numbers of true and false positives, even if sensitivity and specificity remain the same.

Read further

See the probability material in OpenStax Introductory Statistics 2e and the current ASA GAISE teaching recommendations.

Likelihood ratios update odds

For condition D and evidence E, Bayes can be written

P(D∣E)P(Dc∣E)=P(D)P(Dc)P(E∣D)P(E∣Dc).\frac{P(D\mid E)}{P(D^c\mid E)} =\frac{P(D)}{P(D^c)}\frac{P(E\mid D)}{P(E\mid D^c)}.

The last factor is the likelihood ratio. For a positive screening result with sensitivity 0.90 and specificity 0.95, it is 0.90/0.05=180.90/0.05=18. At prevalence 0.01, prior odds are 1/991/99, so posterior odds are 18/99=2/1118/99=2/11 and posterior probability is (2/11)/(1+2/11)=2/13≈0.153846(2/11)/(1+2/11)=2/13\approx0.153846.

A hypothetical population of 10,000 makes the denominators tangible: 100 have the condition, with 90 expected positive results. Among 9,900 without it, 495 expected results are positive. Thus 90 of 585 expected positives correspond to the condition. These are model-based expected counts, not guaranteed realized counts or a report about a particular medical test.

Repeated positive results cannot automatically be treated as independent evidence. Multiplying the same likelihood ratio twice assumes the second test is conditionally independent of the first given condition status, or otherwise has the specified conditional evidence ratio. Shared specimen contamination or correlated errors can violate that assumption. An apparently stronger posterior can therefore be a consequence of an unjustified dependence model.

Additional practice

  1. With prevalence 0.10 and the same sensitivity and specificity, calculate positive predictive value.
  2. If prior odds are 1/41/4 and the evidence likelihood ratio is 3, calculate posterior probability.
  3. Why is this worked probability model not individualized medical advice?
Worked additional solutions
  1. 0.09/[0.09+0.05(0.9)]=2/30.09/[0.09+0.05(0.9)]=2/3.
  2. Posterior odds 3/43/4, so probability 3/73/7.
  3. The inputs are hypothetical and omit clinical context, uncertainty in accuracy, and dependence. The example teaches conditional probability, not a decision for an actual patient.
Interactive laboratory 06

A positive test is not a diagnosis

Experiment with a hypothetical screening test. Adjust how common the condition is, how often the test detects it, and how often it correctly rejects people without it. All counts below are expected counts in 10,000 screenings—not actual patients.

Positive predictive value—
Expected true positives—
Expected false positives—
Expected outcomes per 10,000 screenings
ResultCondition presentCondition absent
Test positive——
Test negative——

This is a mathematical probability model, not medical guidance. Sensitivity and specificity can vary by context; real screening programs also face selection, measurement, and verification bias.

Your study progress · Optional

Keep your place

Mark this lesson complete after you've read it, attempted its exercises, and explained its central idea in your own words.

Progress is not saved unless you choose to mark the lesson complete.

Saved only in this browser's local storage. No required account, server transmission, or analytics. You can reset your saved progress on the course page. Clearing browser data also clears the record.