Mathwords logoMathwords

Sensitivity and Specificity — Definition, Formula & Example

Sensitivity and specificity are two measures of a diagnostic test's accuracy. Sensitivity is the share of people who have a condition that the test correctly flags as positive. Specificity is the share of people without the condition that the test correctly clears as negative.

Let DD be the event that a subject has the condition, and let ++ and −- denote the test results. Sensitivity is the conditional probability P(+∣D)P(+ \mid D). Specificity is the conditional probability P(−∣Dc)P(- \mid D^c). Both condition on the subject's true status, not on the test result, so neither depends on how common the condition is in the population.

Key Formula

Sensitivity=TPTP+FN,Specificity=TNTN+FP\text{Sensitivity} = \frac{TP}{TP + FN}, \qquad \text{Specificity} = \frac{TN}{TN + FP}
Where:
  • TPTP = True positives: has the condition and tests positive
  • FNFN = False negatives: has the condition but tests negative
  • TNTN = True negatives: does not have the condition and tests negative
  • FPFP = False positives: does not have the condition but tests positive

Worked Example

Problem: A clinic gives a rapid strep test to 200 patients and confirms each result with a lab culture. Of the 40 patients who truly have strep, 36 test positive and 4 test negative. Of the 160 patients who do not have strep, 136 test negative and 24 test positive. Find the sensitivity, the specificity, and the false positive rate of the rapid test.
Step 1: Sensitivity uses only the 40 patients who have strep. Divide the true positives by everyone in that group.
Sensitivity=3636+4=3640=0.90\text{Sensitivity} = \frac{36}{36 + 4} = \frac{36}{40} = 0.90
Step 2: Specificity uses only the 160 patients without strep. Divide the true negatives by everyone in that group.
Specificity=136136+24=136160=0.85\text{Specificity} = \frac{136}{136 + 24} = \frac{136}{160} = 0.85
Step 3: The false positive rate is P(+∣Dc)P(+ \mid D^c), the complement of specificity within the healthy group.
P(+∣Dc)=1−0.85=0.15P(+ \mid D^c) = 1 - 0.85 = 0.15
Answer: The test has a sensitivity of 0.90 (it catches 90% of strep cases), a specificity of 0.85 (it clears 85% of healthy patients), and a false positive rate of 0.15.

Why It Matters

AP Statistics problems sometimes give a two-way table of diagnostic test results and ask for conditional probabilities like these, or ask you to interpret one in context. Epidemiologists and drug-testing labs use them to choose between tests. A high-sensitivity test suits screening, where missing a case is costly. A high-specificity test suits confirmation, where a false alarm is costly.

Common Mistakes

Mistake: Treating sensitivity as the probability that a person who tests positive actually has the condition.
Correction: Sensitivity is P(+∣D)P(+ \mid D), but that question asks for P(D∣+)P(D \mid +), called the positive predictive value. In the strep table, 60 patients test positive and 36 of them have strep, so P(D∣+)=3660=0.60P(D \mid +) = \frac{36}{60} = 0.60, not 0.90. To reverse the condition, use Bayes' Theorem or read down the positive column of the table.

Related Terms