Tutorials › Introduction to Statistics › Sensitivity, Specificity, and Predictive Values

Conditional Probability and Bayes’ Rule · Tutorial 340 of 996

Sensitivity, Specificity, and Predictive Values

Learn to define and interpret the four central diagnostic-test measures by identifying exactly which group forms each denominator.

Beginner 9 min read

What You'll Learn

  • Define sensitivity and specificity as probabilities conditional on true disease status.
  • Define positive and negative predictive values as probabilities conditional on test result.
  • Identify true positives, false positives, true negatives, and false negatives in a diagnostic table.
  • Calculate sensitivity and specificity from hypothetical test data.
  • Explain why predictive values depend on disease prevalence in the tested population.
  • Distinguish the probability of a test result given a patient’s condition from the probability of the condition given the result.

Two Different Questions About a Diagnostic Test

A diagnostic test can be evaluated by asking how often it gives a particular result for people whose disease status is already known. It can also be used to ask how likely a patient is to have a disease after receiving a particular result. These sound like similar questions, but they condition on different information, so they have different answers.

For example, “Among patients who have the disease, what fraction test positive?” describes a test’s ability to detect disease. “Among patients who test positive, what fraction have the disease?” describes what a positive result means for a patient. Keeping the denominator in view is the most reliable way to distinguish these measures.

Definition: Let \(D+\) mean that a person has the disease according to an accepted reference standard, and let \(D-\) mean that the person does not. Let \(T+\) and \(T-\) denote a positive and negative test result. Sensitivity is \(P(T+\mid D+)\); specificity is \(P(T-\mid D-)\); positive predictive value (PPV) is \(P(D+\mid T+)\); and negative predictive value (NPV) is \(P(D-\mid T-)\).

The reference standard is the method used to classify disease status for evaluating the test. In a diagnostic table, a true positive (TP) is a positive test result for someone classified as having the disease; a false negative (FN) is a negative result for someone with the disease. A true negative (TN) is a negative result for someone without the disease; a false positive (FP) is a positive result for someone without the disease. “True” and “false” describe whether the test result agrees with the reference classification.

Disease present (\(D+\))Disease absent (\(D-\))
Test positive (\(T+\))True positive (TP)False positive (FP)
Test negative (\(T-\))False negative (FN)True negative (TN)

Which Group Is the Denominator?

Sensitivity and specificity begin with disease status and ask what the test reports. For sensitivity, restrict attention to people with the disease, then count the fraction who test positive. For specificity, restrict attention to people without the disease, then count the fraction who test negative. These are probabilities of test outcomes conditional on disease status.

Predictive values begin with the test result and ask about disease status. For PPV, restrict attention to people who tested positive, then count the fraction who have the disease. For NPV, restrict attention to people who tested negative, then count the fraction who do not have the disease. These are probabilities of disease status conditional on the test result.

Key distinction: Sensitivity and specificity describe test outcomes within groups defined by disease status. PPV and NPV describe disease status within groups defined by test outcome. Reversing the condition reverses the question: \(P(T+\mid D+)\) is not generally the same as \(P(D+\mid T+)\).

The formulas follow directly from conditional probability. In each fraction, the denominator is the group named after the vertical bar, and the numerator counts members of that group who also satisfy the event before the bar.

$$ \begin{aligned} \text{Sensitivity} &= P(T+\mid D+) = \frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FN}},\\ \text{Specificity} &= P(T-\mid D-) = \frac{\mathrm{TN}}{\mathrm{TN}+\mathrm{FP}},\\ \text{PPV} &= P(D+\mid T+) = \frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FP}},\\ \text{NPV} &= P(D-\mid T-) = \frac{\mathrm{TN}}{\mathrm{TN}+\mathrm{FN}}. \end{aligned} $$

For instance, the sensitivity denominator is \(\mathrm{TP}+\mathrm{FN}\), the total number classified as diseased, because sensitivity asks about the test results within that group. The PPV denominator is \(\mathrm{TP}+\mathrm{FP}\), the total number who tested positive, because PPV asks how many of those positive results correspond to disease. The same true positives appear in both numerators, but the denominators differ.

Worked Example: Choose the Measure That Matches the Question

Worked Example: Choose the Measure That Matches the Question

A hypothetical clinic evaluates a screening test against a reference standard. Identify the appropriate measure for each question: (a) among patients with the disease, what fraction test positive? (b) among patients without the disease, what fraction test negative? (c) among patients who test positive, what fraction have the disease? (d) among patients who test negative, what fraction are disease-free?

(a) The group is defined by disease status, \(D+\), and the outcome of interest is a positive test, \(T+\). The conditional probability is \(P(T+\mid D+)\), so the measure is sensitivity.

(b) The group is defined by absence of disease, \(D-\), and the outcome is a negative test, \(T-\). This is \(P(T-\mid D-)\), or specificity.

(c) The group is defined by a positive test, \(T+\), and the question is whether disease is present. This is \(P(D+\mid T+)\), or PPV.

(d) The group is defined by a negative test, \(T-\), and the question is whether disease is absent. This is \(P(D-\mid T-)\), or NPV.

The phrases “among patients with the disease” and “among patients who test positive” identify different denominators. That difference, not the positive or negative wording alone, determines which measure applies.

Calculating Sensitivity and Specificity From a Table

Here is a short derivation of the count formulas. By the definition of conditional probability, \(P(A\mid B)=P(A\cap B)/P(B)\), provided \(P(B)>0\). In a finite group of tested people, the probabilities can be represented by corresponding proportions. Among those classified as diseased, the people who test positive are the true positives, and everyone classified as diseased is either a true positive or a false negative. Therefore sensitivity is \(\mathrm{TP}/(\mathrm{TP}+\mathrm{FN})\). Among those without disease, the true negatives are the negative results and the full group consists of true negatives and false positives. Therefore specificity is \(\mathrm{TN}/(\mathrm{TN}+\mathrm{FP})\).

Worked Example: Computing Sensitivity and Specificity

In a hypothetical evaluation, a reference standard classifies 80 people as having a condition and 120 as not having it. Of the 80 with the condition, 68 test positive and 12 test negative. Of the 120 without the condition, 108 test negative and 12 test positive. Calculate sensitivity and specificity.

The table entries are \(\mathrm{TP}=68\), \(\mathrm{FN}=12\), \(\mathrm{TN}=108\), and \(\mathrm{FP}=12\). The disease-positive group has \(68+12=80\) people, so sensitivity is

$$ \text{Sensitivity} = \frac{\mathrm{TP}}{\mathrm{TP}+\mathrm{FN}} = \frac{68}{68+12} = \frac{68}{80} = 0.850 = 85.0\%. $$

Thus, in this hypothetical evaluation, 85.0% of people classified as having the condition tested positive. This describes test results among people with the condition; it does not say that 85.0% of all positive results are correct.

The disease-negative group has \(108+12=120\) people, so specificity is

$$ \text{Specificity} = \frac{\mathrm{TN}}{\mathrm{TN}+\mathrm{FP}} = \frac{108}{108+12} = \frac{108}{120} = 0.900 = 90.0\%. $$

In this evaluation, 90.0% of people classified as not having the condition tested negative. The denominators are the totals within the two disease-status groups, not the total number of positive or negative test results.

Predictive Values: What a Result Says About Disease Status

PPV and NPV answer questions that are often central to an individual patient. PPV is the fraction of positive results that occur in people who have the disease; NPV is the fraction of negative results that occur in people who do not. Their denominators are all positive results and all negative results, respectively. They are therefore not interchangeable with sensitivity and specificity.

Predictive values depend on how common the disease is in the population being tested, as well as on test performance. To see why, consider positive results: they can arise from people with disease who test positive, and from people without disease who test positive. If disease is uncommon in the tested population, the group without disease may be large enough that false positives make up a substantial share of all positive results, even when specificity is high. If disease is more common, true positives may make up a larger share. The corresponding pattern for negative results affects NPV.

Sensitivity and specificity are often called test characteristics because they condition on disease status; PPV and NPV condition on the result and describe the composition of result groups in a particular tested population. The distinction does not mean sensitivity and specificity are guaranteed to remain identical in every setting: patient mix, disease severity, test procedures, and the reference standard can affect observed performance. Predictive values especially should not be transferred from one population to another without considering the prevalence in each.

Worked Example: Interpreting Reported Measures in Context

Suppose a hypothetical evaluation reports sensitivity of 92%, specificity of 96%, PPV of 35%, and NPV of 99% for a test in a particular screened population. State what each percentage means, and identify which values directly answer questions about a patient’s disease status after a result.

Sensitivity, 92%: among people in the evaluated population who have the disease according to the reference standard, 92% tested positive. It is a conditional probability of a test result given disease.

Specificity, 96%: among people in the evaluated population who do not have the disease, 96% tested negative. It is a conditional probability of a test result given absence of disease.

PPV, 35%: among people in this screened population who tested positive, 35% had the disease according to the reference standard. This is the measure that answers how often a positive result corresponded to disease in this population.

NPV, 99%: among people in this screened population who tested negative, 99% did not have the disease according to the reference standard. This is the measure that answers how often a negative result corresponded to absence of disease in this population.

The PPV and NPV are explicitly tied to the screened population. They should not be interpreted as universal properties of the test, nor as a guarantee about any one patient.

Complements and Common Mistakes

Sensitivity and specificity also have useful complementary interpretations. Among people with the disease, the fraction who test negative is the false-negative rate, \(1-\text{sensitivity}\). Among people without the disease, the fraction who test positive is the false-positive rate, \(1-\text{specificity}\). These complements still condition on disease status; they are not the probability that a patient has or does not have disease after receiving a result.

  • Reversing a conditional probability. “Sensitivity is the chance of having disease after a positive test” uses \(P(D+\mid T+)\), which is PPV. Sensitivity is \(P(T+\mid D+)\).
  • Using all tested people as the denominator. Sensitivity uses only the disease-positive group; specificity uses only the disease-negative group.
  • Treating a high sensitivity as a high PPV. A high sensitivity means few diseased people test negative. It does not by itself tell what fraction of positive results come from diseased people.
  • Reporting predictive values without the population context. PPV and NPV describe result groups in the population where they were assessed and can change when prevalence changes.
Key takeaway: Read every diagnostic measure as a conditional probability and name its denominator. Sensitivity and specificity condition on known disease status; PPV and NPV condition on the test result.

Check Your Understanding

For each question, identify the relevant measure or explain the distinction.

  1. Among people without a disease, what fraction test positive? Which measure describes this probability, and how is it related to specificity?
  2. A report states that 88% of people with a disease test positive. Is this sensitivity or PPV? Explain the conditioning group.
  3. In a diagnostic table, which two cells form the denominator for NPV? Why are those cells included?
  4. Explain why a test’s PPV may differ between two populations even when the test procedure is unchanged.
  5. What is the difference between \(P(T-\mid D-)\) and \(P(D-\mid T-)\) in words?