Diagnostic test bench: sensitivity, specificity and predictive values
NAVLEBCSESet prevalence, sensitivity and specificity and watch a herd of 1,000 animals sort into true and false results. See why predictive values change with prevalence, and compare testing in series and in parallel.
The herd: 1,000 animals, one dot each
Set the disease and the test
Counts are rounded to whole animals. Percentages use the exact formulas, so they can differ slightly from the rounded counts in very small groups.
Move the cut-off: trade sensitivity for specificity
Most tests give a number (a titer, an optical density, a skin thickness). Healthy and diseased animals overlap, so someone must pick a cut-off. Here a result at or above the cut-off is called positive. Simplified model: two bell-shaped curves with equal spread.
Sends the cut-off's sensitivity and specificity to test A (kept within the 50 to 100% slider range).
Two tests: in series or in parallel
Series: the animal is called positive only if both tests are positive (in practice, only the positives on test A are retested with test B). Parallel: the animal is called positive if either test is positive.
| Strategy | Se | Sp | PPV | NPV |
|---|
Assumption: the two tests are independent (the error of one tells you nothing about the error of the other, in diseased and in healthy animals). Real tests that measure the same thing, such as two antibody tests, make some of the same mistakes, so the real gain is smaller than shown here.
Live 2×2 table
| Diseased | Healthy | Total | |
|---|---|---|---|
| Test + | 0 | ||
| Test − | 0 | ||
| Total | 0 | 0 | 0 |
Predictive values against prevalence
Apparent prevalence is the share that tests positive (TP + FP). True prevalence is the share that is diseased (TP + FN). LR+ = Se ÷ (1 − Sp); LR− = (1 − Se) ÷ Sp. Prevalence axis is stretched at the low end (log scale).
Sensitivity, specificity and prevalence values in these problems are illustrative round numbers chosen to show the principle. They are not the published performance of any real test kit.
Starting point
Prevalence 10%, sensitivity 90%, specificity 90%. Move one slider at a time and watch which numbers move. Prevalence changes PPV and NPV but never sensitivity or specificity.
Herd level: will a sample find the disease?
You test n animals from a herd. If the disease is present at prevalence p, the chance that at least one sampled animal tests positive is 1 − (1 − p × Se)n.
Uses the sensitivity of test A (90%). Sample size for 95% confidence: n = ln(0.05) ÷ ln(1 − p × Se), rounded up. This simple formula assumes a large herd (sampling a few animals does not change the prevalence in the rest), a random sample, and perfect specificity (every positive is treated as a true positive). In a small herd, fewer animals are needed than the formula gives.
Numbers and formulas to know
| Term | Formula | In words |
|---|---|---|
| Sensitivity (Se) | TP ÷ (TP + FN) | Of the diseased, the share that test positive |
| Specificity (Sp) | TN ÷ (TN + FP) | Of the healthy, the share that test negative |
| Positive predictive value (PPV) | TP ÷ (TP + FP) | Of the test positives, the share that are diseased |
| Negative predictive value (NPV) | TN ÷ (TN + FN) | Of the test negatives, the share that are healthy |
| PPV from Se, Sp and prevalence p | Se·p ÷ [Se·p + (1−Sp)(1−p)] | Bayes' theorem; falls as p falls |
| NPV from Se, Sp and p | Sp(1−p) ÷ [Sp(1−p) + (1−Se)·p] | Rises as p falls |
| True prevalence | (TP + FN) ÷ N | Share truly diseased |
| Apparent prevalence | (TP + FP) ÷ N | Share that test positive = Se·p + (1−Sp)(1−p) |
| True from apparent prevalence (AP) | (AP + Sp − 1) ÷ (Se + Sp − 1) | Rogan-Gladen estimate |
| Accuracy (of a test) | (TP + TN) ÷ N | Share of all results that are correct |
| Likelihood ratio positive (LR+) | Se ÷ (1 − Sp) | How much a positive raises the odds of disease |
| Likelihood ratio negative (LR−) | (1 − Se) ÷ Sp | How much a negative lowers the odds of disease |
| Post-test odds | pre-test odds × LR | Odds = p ÷ (1 − p) |
| Series (both positive), independent tests | Se = SeA·SeB Sp = 1 − (1−SpA)(1−SpB) | Sp and PPV rise, Se falls |
| Parallel (either positive), independent tests | Se = 1 − (1−SeA)(1−SeB) Sp = SpA·SpB | Se and NPV rise, Sp falls |
| Chance of at least 1 positive in n sampled | 1 − (1 − p·Se)n | Herd-level sensitivity; large herd, perfect Sp |
| Sample size to detect disease, 95% confidence | ln(0.05) ÷ ln(1 − p·Se) | About 3 ÷ (p·Se) when p is small |
| Area under the ROC curve | 0.5 to 1.0 | 0.5 = no better than chance; 1.0 = perfect |
Pairs that get mixed up
Accuracy vs precision (of a measurement)
Accuracy is how close a result is to the true value. Precision is how close repeated results are to each other (repeatability). A badly calibrated analyzer can be precise and wrong every time. In the 2×2 table, "accuracy" has a second meaning: the share of all animals classified correctly.
Incidence vs prevalence
Incidence counts new cases that start during a period, divided by the animals at risk: the 4 blue bars begin inside the year. Prevalence counts all existing cases at one point in time, divided by the population: 3 bars cross the red survey line. Long-lasting diseases build up, so prevalence is roughly incidence × average duration. Predictive values depend on prevalence.
Memory hooks
- SnNout: with a highly Sensitive test, a Negative rules disease out.
- SpPin: with a highly Specific test, a Positive rules disease in.
- Predictive values travel with prevalence. Sensitivity and specificity do not.
- Rare disease: doubt the positive. Common disease: doubt the negative.
- Screen with a sensitive test, confirm with a specific test.
- Series = "and" = more specific. Parallel = "or" = more sensitive.
- Sensitivity and specificity read down the columns of the 2×2 table (by disease). Predictive values read across the rows (by test result).
- Lower the cut-off: catch more disease, raise more false alarms. You cannot improve both with the cut-off alone.
- Rule of three: to find a disease present in a share p of a large herd, sample about 3 ÷ p animals for 95% confidence.
Exam check
For exam study only. Simplified teaching models: do not use these tools to make decisions for real patients. Last reviewed November 2026.
More free tools in the Vet Lab
ECG Rhythm Bench Acid-Base and Blood Gas Interpreter Fluid Plan and CRI Builder Pharmacokinetics BenchPractice NAVLE and BCSE questions with full explanations.