Sensitivity, specificity, positive predictive value (PPV), and negative predictive value (NPV) are calculated from a 2 × 2 diagnostic table. Sensitivity measures how often a test correctly identifies people who have the condition, specificity measures how often it correctly identifies people who do not have it, PPV estimates the probability of disease after a positive result, and NPV estimates the probability of no disease after a negative result.
Author: Dr. Taimoor Asghar
Start With a 2 × 2 Diagnostic Table
To calculate these measures, compare the index test with a suitable reference standard. Each participant is classified by both the test result and the reference-standard result.
| Index test result | Condition present | Condition absent |
|---|---|---|
| Positive | True positive (TP) | False positive (FP) |
| Negative | False negative (FN) | True negative (TN) |
- True positive: the test is positive and the condition is present.
- False positive: the test is positive but the condition is absent.
- False negative: the test is negative but the condition is present.
- True negative: the test is negative and the condition is absent.
How to Calculate Sensitivity, Specificity, PPV, and NPV
Sensitivity formula
Sensitivity = TP ÷ (TP + FN)
Multiply the result by 100 to express it as a percentage. The denominator includes everyone who truly has the condition according to the reference standard.
Sensitivity answers: Among people who have the condition, what proportion tests positive?
Specificity formula
Specificity = TN ÷ (TN + FP)
The denominator includes everyone who does not have the condition.
Specificity answers: Among people who do not have the condition, what proportion tests negative?
Positive predictive value formula
PPV = TP ÷ (TP + FP)
The denominator includes everyone with a positive test result.
PPV answers: Among people who test positive, what proportion truly has the condition?
Negative predictive value formula
NPV = TN ÷ (TN + FN)
The denominator includes everyone with a negative test result.
NPV answers: Among people who test negative, what proportion truly does not have the condition?
Worked Example
Suppose a diagnostic study includes 1,000 people. The reference standard shows that 200 have the condition and 800 do not. The index test produces the following results:
| Index test result | Condition present | Condition absent | Total |
|---|---|---|---|
| Positive | 180 | 80 | 260 |
| Negative | 20 | 720 | 740 |
| Total | 200 | 800 | 1,000 |
Therefore:
- TP = 180
- FP = 80
- FN = 20
- TN = 720
Step 1: Calculate sensitivity
Sensitivity = 180 ÷ (180 + 20) = 180 ÷ 200 = 0.90
Sensitivity = 90%
The test detects 90% of the people who truly have the condition. It misses 10%, corresponding to the false-negative rate.
Step 2: Calculate specificity
Specificity = 720 ÷ (720 + 80) = 720 ÷ 800 = 0.90
Specificity = 90%
The test correctly returns a negative result for 90% of people who do not have the condition.
Step 3: Calculate PPV
PPV = 180 ÷ (180 + 80) = 180 ÷ 260 = 0.692
PPV ≈ 69.2%
Among those who test positive, approximately 69 in every 100 truly have the condition.
Step 4: Calculate NPV
NPV = 720 ÷ (720 + 20) = 720 ÷ 740 = 0.973
NPV ≈ 97.3%
Among those who test negative, approximately 97 in every 100 truly do not have the condition.
Quick Formula Table
| Measure | Formula | Main question answered |
|---|---|---|
| Sensitivity | TP ÷ (TP + FN) | How well does the test detect disease? |
| Specificity | TN ÷ (TN + FP) | How well does the test identify absence of disease? |
| PPV | TP ÷ (TP + FP) | How likely is disease after a positive result? |
| NPV | TN ÷ (TN + FN) | How likely is no disease after a negative result? |
Sensitivity and Specificity Versus Predictive Values
Sensitivity and specificity begin with the person’s true condition status. Predictive values begin with the observed test result. This difference determines how each measure should be interpreted.
- Sensitivity and specificity: commonly used to describe how a test performs against a reference standard.
- PPV and NPV: often more intuitive when counselling a patient because they describe what a positive or negative result means in the tested population.
However, none of these measures should be interpreted alone. Clinical usefulness also depends on the testing threshold, disease spectrum, quality of the reference standard, consequences of errors, and the population in which the test is used.
How Disease Prevalence Affects PPV and NPV
PPV and NPV depend strongly on the prevalence, or pre-test probability, of the condition in the tested population. When prevalence rises, PPV usually rises and NPV usually falls. When prevalence falls, PPV usually falls and NPV usually rises.
This explains why the same test may produce different predictive values in a specialist clinic, an emergency department, and a population-screening programme. Predictive values reported in one study should not be transferred automatically to a population with a substantially different disease prevalence.
Example of the prevalence effect
A highly accurate test used for a rare condition may still generate more false-positive than true-positive results. Conversely, a negative result can be especially reassuring in a low-prevalence population. The reverse pattern may occur in a high-prevalence referral population.
False-Positive and False-Negative Rates
Two related quantities can be calculated directly:
- False-negative rate = FN ÷ (TP + FN) = 1 − sensitivity
- False-positive rate = FP ÷ (TN + FP) = 1 − specificity
In the worked example, both rates are 10% because sensitivity and specificity are each 90%.
Common Calculation Mistakes
Using the wrong denominator
The numerator alone does not determine the measure. Sensitivity uses all people with the condition, specificity uses all people without it, PPV uses all positive tests, and NPV uses all negative tests.
Confusing sensitivity with PPV
Sensitivity is the probability of a positive test given that disease is present. PPV is the probability that disease is present given a positive test. Reversing the condition changes the meaning.
Ignoring an imperfect reference standard
Calculations assume that the reference standard classifies disease status adequately. If the reference standard is inaccurate or applied differently across participants, estimates of test performance may be biased.
Reporting percentages without counts
Whenever possible, report TP, FP, FN, and TN alongside percentages. A sensitivity of 90% based on 18 of 20 cases is less precise than 90% based on 900 of 1,000 cases. Confidence intervals should also be reported in formal diagnostic-accuracy studies.
Calculating PPV and NPV from a case-control sample
In a traditional case-control design, researchers deliberately choose the number of diseased and non-diseased participants. That artificial disease proportion may allow estimation of sensitivity and specificity, but directly calculated PPV and NPV may not represent the target clinical population.
Thresholds and the Sensitivity-Specificity Trade-Off
Many tests produce a continuous value that is converted into positive or negative using a threshold. Lowering the threshold often detects more true cases and increases sensitivity, but it may also increase false positives and reduce specificity. Raising the threshold often has the opposite effect.
The appropriate threshold depends on the consequences of missing disease versus incorrectly labelling someone as positive. Screening tests may prioritise sensitivity when missed cases are particularly harmful, while confirmatory tests may require high specificity. These are context-dependent principles rather than absolute rules.
How to Report Diagnostic Accuracy Clearly
A clear report should usually include:
- The clinical setting and participant-selection method.
- The index test and its positivity threshold.
- The reference standard and whether assessors were blinded.
- The complete 2 × 2 table.
- Sensitivity, specificity, PPV, and NPV with confidence intervals.
- Disease prevalence in the study sample.
- Any indeterminate, missing, or uninterpretable results.
The STARD reporting guideline provides a structured framework for transparent reporting of diagnostic-accuracy studies.
Practical Interpretation
A test with 95% sensitivity does not mean that a person with a positive result has a 95% chance of disease. That probability is closer to PPV and varies with pre-test probability. Similarly, a test with 95% specificity does not mean that a negative result is 95% reliable; that question relates more closely to NPV.
Diagnostic results should be interpreted with the clinical history, examination findings, pre-test probability, test threshold, and potential harms of false-positive and false-negative decisions. In many clinical situations, likelihood ratios and Bayesian reasoning provide a more transferable way to update probability than predictive values alone.
Conclusion
To calculate sensitivity, specificity, PPV, and NPV, first place the results in a correctly labelled 2 × 2 table. Use TP ÷ (TP + FN) for sensitivity, TN ÷ (TN + FP) for specificity, TP ÷ (TP + FP) for PPV, and TN ÷ (TN + FN) for NPV. Interpret PPV and NPV in relation to disease prevalence, and report the underlying counts and confidence intervals whenever diagnostic performance is formally evaluated.
Medical disclaimer: This article is for education and research support only. Diagnostic-test calculations do not replace clinical assessment, a validated reference standard, or decisions made by an appropriately qualified healthcare professional.
Key takeaways
- Sensitivity equals TP divided by TP plus FN, while specificity equals TN divided by TN plus FP.
- PPV equals TP divided by all positive tests, and NPV equals TN divided by all negative tests.
- PPV and NPV vary with disease prevalence and pre-test probability.
- A correctly labelled 2 × 2 table prevents denominator errors.
- Report the raw cell counts and confidence intervals, not percentages alone.
- Test results must be interpreted with clinical context and the quality of the reference standard.
Frequently asked questions
What is the formula for sensitivity?
What is the formula for specificity?
What is the difference between sensitivity and PPV?
Do PPV and NPV change with disease prevalence?
Can PPV and NPV be calculated reliably from a case-control study?
Should diagnostic accuracy measures include confidence intervals?
References
- Altman DG, Bland JM. Diagnostic tests 1: Sensitivity and specificity. BMJ. 1994;308(6943):1552. https://doi.org/10.1136/bmj.308.6943.1552
- Altman DG, Bland JM. Diagnostic tests 2: Predictive values. BMJ. 1994;309(6947):102. https://doi.org/10.1136/bmj.309.6947.102
- Akobeng AK. Understanding diagnostic tests 1: sensitivity, specificity and predictive values. Acta Paediatrica. 2007;96(3):338-341. https://pubmed.ncbi.nlm.nih.gov/17407452/
- Šimundić AM. Measures of diagnostic accuracy: basic definitions. EJIFCC. 2009;19(4):203-211. https://pmc.ncbi.nlm.nih.gov/articles/PMC4975285/
- Bossuyt PM, Reitsma JB, Bruns DE, et al. STARD 2015: An updated list of essential items for reporting diagnostic accuracy studies. BMJ. 2015;351:h5527. https://www.bmj.com/content/351/bmj.h5527