Tutorials › Introduction to Statistics › Prevalence and the Base-Rate Effect

Conditional Probability and Bayes’ Rule · Tutorial 339 of 996

Prevalence and the Base-Rate Effect

Learn why the same positive test can mean different things in populations with different disease prevalence.

Beginner 9 min read

What You'll Learn

  • Define prevalence as the probability that a randomly selected person in a population has the disease.
  • Calculate disease probability after a positive test using Bayes’ Rule.
  • Compare positive-test probabilities across populations with different prevalence.
  • Explain why false positives can outnumber true positives when prevalence is low.
  • Identify the assumption needed to compare test results across populations.
  • Avoid confusing the probability of a positive result among people with disease with the probability of disease after a positive result.

Why Prevalence Changes What a Positive Test Means

A positive medical test is evidence about disease, but it is not the same thing as a diagnosis that is certainly correct. To understand what a positive result means, we need to consider both how the test behaves and how common the disease is in the population being tested. The same test can therefore produce different probabilities of disease after a positive result in two populations.

This effect is sometimes called the base-rate effect: the background rate, or prevalence, of a condition affects how we interpret new evidence. A positive result from a highly accurate test may be more convincing in a population where the disease is common than in a population where it is rare. The test’s performance need not have changed; the mix of people taking it has.

Definition: Let \(D\) denote the event that a randomly selected person in a specified population has a disease, and let \(+\) denote a positive test result. The prevalence is \(p=P(D)\). The probability of disease after a positive result is \(P(D\mid +)\). These are different probabilities: prevalence describes disease before using the test result, while \(P(D\mid +)\) describes disease among people who tested positive.

To compare populations, we also need to describe the test’s performance conditional on disease status. We use \(P(+\mid D)\) for the probability of a positive result among people who have the disease, and \(P(-\mid D^c)\) for the probability of a negative result among people who do not have it. These are commonly called the test’s sensitivity and specificity, respectively. Here, they are treated as fixed while prevalence changes.

That “fixed” condition is an assumption for the comparison, not a guarantee about every real test. The test procedure, interpretation threshold, and relevant patient characteristics must be sufficiently similar across populations for the conditional probabilities to be comparable. If these features differ, a change in \(P(D\mid +)\) might reflect changed test performance as well as changed prevalence.

The Probability After a Positive Result

A positive result can occur in two ways: the person has the disease and tests positive, or the person does not have the disease and nevertheless tests positive. The total probability of a positive result is the sum of these two disjoint possibilities. Bayes’ Rule then gives the probability of disease among those who tested positive.

$$ P(D\mid +) = \frac{P(+\mid D)P(D)} {P(+\mid D)P(D)+P(+\mid D^c)P(D^c)} $$

Since \(P(D)=p\) and \(P(D^c)=1-p\), and since \(P(+\mid D^c)=1-P(-\mid D^c)\), the expression can also be written using sensitivity and specificity:

$$ P(D\mid +) = \frac{\mathrm{Se}\,p} {\mathrm{Se}\,p+(1-\mathrm{Sp})(1-p)} $$

The numerator is the proportion of the whole population expected to have both the disease and a positive result. The denominator is the proportion expected to test positive, including both true positives and false positives. This denominator is essential: a positive test can come from either group.

Key result: With \(P(+\mid D)\) and \(P(+\mid D^c)\) held fixed, \(P(D\mid +)\) generally increases as prevalence \(p\) increases. A positive result is more likely to correspond to a person with disease when disease is more common in the population being tested.

Worked Examples Across Different Prevalence Levels

Worked Example: A Rare Disease in a Large Screening Group

Suppose a hypothetical screening test has \(P(+\mid D)=0.90\) and \(P(-\mid D^c)=0.95\). In a population of 10,000 people, assume disease prevalence is 1%. What proportion of those with a positive test have the disease?

The population contains \(0.01(10{,}000)=100\) people with disease and \(9{,}900\) without disease. Of the 100 with disease, the expected number testing positive is \(0.90(100)=90\). Since specificity is 0.95, the probability of a positive result among people without disease is \(1-0.95=0.05\). The expected number of false positives is therefore \(0.05(9{,}900)=495\).

There are \(90+495=585\) positive results in total, of which 90 are from people with disease. Thus,

$$ P(D\mid +)=\frac{90}{585} =\frac{0.90(0.01)} {0.90(0.01)+0.05(0.99)} \approx 0.1538 $$

Under these assumptions, about 15.4% of positive results correspond to people with disease. This is not a claim that the test is only 15.4% sensitive: the probability of a positive result among people with disease is 90%. The two percentages answer different conditional-probability questions.

Worked Example: The Same Test in a Higher-Prevalence Population

Keep the test performance from the previous calculation fixed: \(P(+\mid D)=0.90\) and \(P(-\mid D^c)=0.95\). Now suppose prevalence is 10% in a different population of 10,000 people. Find the probability of disease after a positive result.

There are \(0.10(10{,}000)=1{,}000\) people with disease and 9,000 without disease. The expected true positives number \(0.90(1{,}000)=900\). The false-positive probability remains 0.05, so the expected false positives number \(0.05(9{,}000)=450\). The total number of positive results is \(900+450=1{,}350\).

$$ P(D\mid +) = \frac{900}{1{,}350} = \frac{0.90(0.10)} {0.90(0.10)+0.05(0.90)} = \frac{0.09}{0.135} \approx 0.6667 $$

About 66.7% of positive results correspond to people with disease. The test’s conditional performance has not changed from the first example. The increase from about 15.4% to 66.7% occurs because there are more people with disease among those tested, and therefore more opportunities for true-positive results.

Worked Example: Comparing Two Populations Directly

A hypothetical test has \(P(+\mid D)=0.95\) and \(P(-\mid D^c)=0.90\). Compare the probability of disease after a positive result in two populations, one with 2% prevalence and one with 20% prevalence. Assume the test’s conditional probabilities are the same in both.

For the population with 2% prevalence, \(p=0.02\), and the false-positive probability is \(1-0.90=0.10\). Therefore,

$$ P(D\mid +) = \frac{0.95(0.02)} {0.95(0.02)+0.10(0.98)} = \frac{0.019}{0.117} \approx 0.1624 $$

About 16.2% of positive results correspond to people with disease in this population. For the population with 20% prevalence, \(p=0.20\):

$$ P(D\mid +) = \frac{0.95(0.20)} {0.95(0.20)+0.10(0.80)} = \frac{0.19}{0.27} \approx 0.7037 $$

About 70.4% of positive results correspond to people with disease in the higher-prevalence population. The comparison depends on the stated assumption that the test has the same conditional probabilities in both populations. It does not show that prevalence changes the test’s sensitivity or specificity.

Why the Probability Rises With Prevalence

The direction of the effect can be justified directly from the formula. Write \(a=P(+\mid D)\) and \(b=P(+\mid D^c)\), and suppose \(a>0\) and \(b>0\) are fixed. Then

$$ f(p)=P(D\mid +)=\frac{ap}{ap+b(1-p)} =\frac{ap}{b+(a-b)p} $$

Differentiating with respect to \(p\) gives

$$ f'(p) = \frac{a[b+(a-b)p]-ap(a-b)} {[b+(a-b)p]^2} = \frac{ab}{[b+(a-b)p]^2} >0 $$

The denominator is a square and is positive, while \(a\) and \(b\) are positive. Thus the derivative is positive: under these fixed test probabilities, the probability of disease after a positive result increases as prevalence increases. This is a comparison of probabilities, not a claim about cause. The population’s prevalence does not make the test result positive; it changes how much disease is represented among the positive results.

If \(b=0\), there are no positive results among people without disease. Provided positive results occur, every positive corresponds to disease and \(P(D\mid +)=1\). That special case also shows why the general formula’s interpretation depends on whether positive results can occur in people without disease.

Natural Frequencies and the Base-Rate Effect

The examples used counts because counts make the denominator visible. When disease prevalence is low, the much larger group without disease can produce many positive results even if the false-positive probability is small. For example, a 5% false-positive probability applied to 99,000 people without disease yields \(0.05(99{,}000)=4{,}950\) false positives. A test can therefore have a low false-positive rate while false positives still form a substantial share of all positive results.

Natural frequencies also help distinguish two conditional probabilities. \(P(+\mid D)\) starts with people who have disease and asks how many test positive. \(P(D\mid +)\) starts with positive test results and asks how many of those people have disease. Reversing which group forms the denominator changes the question and generally changes the answer.

Common Mistake: Ignoring the Base Rate

A common error is to say, “The test is 90% sensitive, so a person with a positive result has a 90% chance of disease.” This switches \(P(+\mid D)\) with \(P(D\mid +)\). Sensitivity begins with people who have disease; the probability after a positive begins with people who tested positive. Bayes’ Rule relates the two, but they are not interchangeable.

Another error is to report only the test’s sensitivity and leave out the probability of positive results among people without disease. Those results also belong in the total number of positive results. To calculate the probability of disease after a positive test, state the prevalence and account for both sources of positive results.

1
State the population and prevalence.
Use \(p=P(D)\) for the population being tested; do not substitute a rate from a different population without justification.
2
Record both routes to a positive result.
Use \(P(+\mid D)\) for true positives and \(P(+\mid D^c)\) for false positives.
3
Divide true positives by all positives.
Apply Bayes’ Rule, or use counts with the same numerator and denominator structure.
Key takeaway: A positive result does not have one universal probability of indicating disease. When test performance is held fixed, the probability of disease among positive results is higher in populations with higher disease prevalence. Always identify the population, the prevalence, and both ways a positive result can occur.

Check Your Understanding

For each question, identify the conditional probability being discussed and explain how prevalence enters the calculation.

  1. A test has \(P(+\mid D)=0.80\). In words, what does this probability mean, and why is it not automatically \(P(D\mid +)\)?
  2. A test has \(P(+\mid D)=0.90\), \(P(-\mid D^c)=0.95\), and disease prevalence is 5%. Write the Bayes’ Rule expression for \(P(D\mid +)\), without evaluating it.
  3. With test performance fixed, which population should have the higher \(P(D\mid +)\): one with 1% prevalence or one with 15% prevalence? Explain using the base-rate effect.
  4. Why must positive results among people without disease be included in the denominator when calculating \(P(D\mid +)\)?
  5. What assumption is needed before attributing a difference in \(P(D\mid +)\) across populations to a difference in prevalence alone?