Tutorials › Introduction to Statistics › Common Denominator Errors in Bayes Problems

Conditional Probability and Bayes’ Rule · Tutorial 348 of 996

Common Denominator Errors in Bayes Problems

Use the evidence group—not just the true positives—to calculate the probability of disease after a positive test.

Beginner 9 min read

What You'll Learn

  • Distinguish sensitivity from positive predictive value.
  • Identify which conditional probability a question asks for.
  • Build the positive-test denominator from true positives and false positives.
  • Check Bayes calculations with natural frequencies.
  • Explain why a positive test does not by itself determine disease probability.

Why Bayes Denominator Errors Are So Common

A positive diagnostic test can be encouraging evidence of disease without being proof of disease. To find the probability that someone has the disease after a positive result, we must consider everyone who could have produced that result: people with the disease who test positive and people without the disease who test positive. Common errors arise when one of these groups is mistaken for the whole.

Three quantities are especially easy to confuse. Sensitivity is the probability of a positive test among people who have the disease. Specificity is the probability of a negative test among people who do not have the disease. Positive predictive value is the probability of disease among people who test positive. Sensitivity and positive predictive value condition on different groups; they are not interchangeable.

Definition: Let \(D\) denote the event that a person has the disease, and let \(+\) denote the event that the test result is positive. The sensitivity is \(P(+\mid D)\), the specificity is \(P(-\mid \text{not }D)\), and the positive predictive value (PPV) is \(P(D\mid +)\). The prevalence in the population being tested is \(P(D)\).

To calculate a PPV, suppose every person in the relevant population receives the same test and has a definite disease status and test result. The disease and no-disease groups partition the population, so positive results come from two sources: positive results among people with disease and positive results among people without disease. By the law of total probability,

$$ P(D\mid +) = \frac{P(D\cap +)}{P(+)} = \frac{P(+\mid D)P(D)} {P(+\mid D)P(D)+P(+\mid \text{not }D)P(\text{not }D)}. $$

The numerator is the probability of being both diseased and test-positive. The denominator is the probability of being test-positive, regardless of disease status. Since \(P(+\mid \text{not }D)=1-\text{specificity}\) and \(P(\text{not }D)=1-P(D)\), the same calculation can be written using prevalence, sensitivity, and specificity:

$$ \text{PPV} = \frac{\text{sensitivity}\times\text{prevalence}} {\text{sensitivity}\times\text{prevalence} +(1-\text{specificity})\times(1-\text{prevalence})}. $$

This formula is useful for diagnosing mistakes because it shows what belongs in each part. The numerator counts true positives as a share of the whole population. The denominator counts all positive results as a share of that population, including false positives.

Worked Example: Sensitivity Is Not the Positive Predictive Value

Worked Example: Sensitivity Is Not the Positive Predictive Value

Suppose a hypothetical disease affects 2% of the population. A test has 90% sensitivity and 95% specificity. Find the probability that a person has the disease given that the test is positive.

The requested probability is \(P(D\mid +)\), not \(P(+\mid D)\). The sensitivity, 90%, is \(P(+\mid D)\); it answers the different question, “Among people who have the disease, what proportion test positive?” We also need the false-positive rate, which is \(1-0.95=0.05\).

Substitute the values into the PPV formula:

$$ P(D\mid +) = \frac{0.90(0.02)} {0.90(0.02)+0.05(0.98)} = \frac{0.018}{0.018+0.049} = \frac{0.018}{0.067} \approx 0.2687. $$

Thus, under these assumptions, about 26.9% of people who test positive have the disease. It would be incorrect to report 90% as the probability of disease after a positive result: 90% is the probability of a positive result given disease, not the probability of disease given a positive result.

The same result is visible using a hypothetical group of 10,000 people. About 200 have the disease; of those, \(0.90(200)=180\) test positive. Of the 9,800 without disease, \(0.05(9,800)=490\) test positive. There are \(180+490=670\) positive results, of which 180 are true positives. Hence \(180/670\approx0.2687\).

Check the Direction of the Conditional Probability

The vertical bar in conditional probability identifies the group being restricted to. In \(P(+\mid D)\), the group consists of people with disease, and the question is what fraction of them test positive. In \(P(D\mid +)\), the group consists of people with positive results, and the question is what fraction of them have disease. These groups differ, so the two probabilities generally differ.

Worked Example: Reversing the Condition Gives a Different Answer

In a hypothetical population, 10% of people have a condition. A test has 80% sensitivity and 90% specificity. Find both \(P(+\mid D)\) and \(P(D\mid +)\), and explain why one cannot be substituted for the other.

By definition, sensitivity is \(P(+\mid D)=0.80\). For the predictive value, the false-positive rate is \(1-0.90=0.10\), and the proportion without the condition is \(1-0.10=0.90\). Therefore,

$$ P(D\mid +) = \frac{0.80(0.10)} {0.80(0.10)+0.10(0.90)} = \frac{0.08}{0.08+0.09} = \frac{0.08}{0.17} \approx 0.4706. $$

The test is positive for 80% of people who have the condition, but only about 47.1% of positive results come from people who have it. The first percentage uses people with the condition as its denominator; the second uses all people with positive results. Reversing the condition changes the question and the denominator.

A frequency check confirms the distinction. Among 1,000 people, 100 have the condition, and 80 of them test positive. Of the 900 without the condition, 90 test positive. Thus \(P(+\mid D)=80/100=0.80\), while \(P(D\mid +)=80/(80+90)\approx0.4706\).

Do Not Leave False Positives Out of the Evidence

A denominator error often appears as a correct numerator divided by only the true positives. But the evidence in a PPV question is a positive test, not a true-positive test. A person without disease can also test positive, so false positives belong in the positive-result group. Leaving them out makes the denominator too small and the calculated PPV too large.

Worked Example: Including Every Positive Result

Suppose a hypothetical condition has prevalence 1%. A test has 95% sensitivity and 90% specificity. Calculate the probability of the condition after a positive test, and compare it with the answer obtained by omitting false positives.

The false-positive rate is \(1-0.90=0.10\), and 99% of the population does not have the condition. The correct denominator includes both sources of positive results:

$$ P(D\mid +) = \frac{0.95(0.01)} {0.95(0.01)+0.10(0.99)} = \frac{0.0095}{0.0095+0.099} = \frac{0.0095}{0.1085} \approx 0.08756. $$

The PPV is about 8.76%. For a frequency check, consider 10,000 people: about 100 have the condition, and 95 test positive. Of the 9,900 without it, \(0.10(9,900)=990\) test positive. The full positive group has \(95+990=1,085\) people, so \(95/1,085\approx0.08756\).

If false positives were omitted, the calculation would divide the 95 true positives by the 95 true positives alone and produce \(95/95=1\), or 100%. That is not the probability of disease among all positive results; it is the result of redefining the denominator to exclude positive results from people without disease.

A Reliable Denominator Check

Before calculating a predictive value, state the evidence group in words. For a positive predictive value, it is everyone with a positive result. Then list every mutually exclusive way a person in that group can arise. In the basic two-status, two-outcome setting, those ways are:

  • has disease and tests positive (a true positive);
  • does not have disease and tests positive (a false positive).

The numerator for \(P(D\mid +)\) is only the first group. The denominator is the sum of both groups. This distinction between numerator and denominator is not a special adjustment; it follows directly from the definition of conditional probability, \(P(D\mid +)=P(D\cap +)/P(+)\).

A short derivation makes the denominator explicit. Because disease and no disease are disjoint and cover the population, the positive-result event can be split into two disjoint parts:

$$ += (+\cap D)\ \cup\ (+\cap \text{not }D), \qquad P(+)=P(+\cap D)+P(+\cap \text{not }D). $$

Using \(P(A\cap B)=P(A\mid B)P(B)\) for each part gives

$$ P(+)=P(+\mid D)P(D)+P(+\mid \text{not }D)P(\text{not }D). $$

Dividing the joint probability \(P(D\cap +)=P(+\mid D)P(D)\) by this full positive-result probability yields the PPV formula. The false-positive term is therefore required by the probability of the evidence, not an optional correction.

Common Mistakes and Practical Checks

  • Using sensitivity as the PPV. Sensitivity conditions on disease; PPV conditions on a positive test. Write the requested conditional probability with its conditioning event before inserting numbers.
  • Reversing the conditional. \(P(+\mid D)\) and \(P(D\mid +)\) describe different proportions. Do not assume they are equal; calculate the probability asked for.
  • Counting only true positives in the denominator. The denominator \(P(+)\) includes every positive result, including false positives. Add the positive-result contributions from both disease groups.
  • Using specificity as though it were the false-positive rate. Specificity is \(P(-\mid\text{not }D)\); the false-positive rate is \(P(+\mid\text{not }D)=1-\text{specificity}\).
  • Ignoring the population prevalence. Sensitivity and specificity alone do not determine PPV. The prevalence of disease in the tested population also enters the numerator and denominator.

Natural frequencies provide a useful independent check. Choose a convenient population size, multiply each disease-status group by its test-result rate, and count all positive results before forming the fraction. The resulting count ratio should agree with the probability formula, apart from rounding. If it does not, check which group the conditional probability is based on and whether any false positives were left out.

Key takeaway: For a positive predictive value, divide true positives by all positive results: true positives plus false positives. Sensitivity asks how often the test is positive among people with disease; PPV asks how often disease is present among people with a positive test.

Check Your Understanding

For each question, identify the conditioning group before calculating or explaining.

  1. A test has 97% sensitivity. In words, what conditional probability does this describe, and what group forms its denominator?
  2. A disease affects 5% of a population. A test has 80% sensitivity and 95% specificity. Write the expression for the PPV, including both terms in its denominator.
  3. Explain why \(P(D\mid +)\) is not generally equal to \(P(+\mid D)\).
  4. For a PPV calculation, what kinds of people contribute to the denominator? Which contribute to the numerator?
  5. A person says, “Specificity is 92%, so the false-positive rate is 92%.” Identify and correct the error.