Skip to content

How to Calculate Sensitivity, Specificity, PPV, and NPV

Table of contents

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 resultCondition presentCondition absent
PositiveTrue positive (TP)False positive (FP)
NegativeFalse 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 resultCondition presentCondition absentTotal
Positive18080260
Negative20720740
Total2008001,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

MeasureFormulaMain question answered
SensitivityTP ÷ (TP + FN)How well does the test detect disease?
SpecificityTN ÷ (TN + FP)How well does the test identify absence of disease?
PPVTP ÷ (TP + FP)How likely is disease after a positive result?
NPVTN ÷ (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:

  1. The clinical setting and participant-selection method.
  2. The index test and its positivity threshold.
  3. The reference standard and whether assessors were blinded.
  4. The complete 2 × 2 table.
  5. Sensitivity, specificity, PPV, and NPV with confidence intervals.
  6. Disease prevalence in the study sample.
  7. 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?
Sensitivity is TP divided by TP plus FN. It is the proportion of people with the condition who receive a positive test result.
What is the formula for specificity?
Specificity is TN divided by TN plus FP. It is the proportion of people without the condition who receive a negative test result.
What is the difference between sensitivity and PPV?
Sensitivity starts with people who truly have the condition and asks how many test positive. PPV starts with positive test results and asks how many are true positives.
Do PPV and NPV change with disease prevalence?
Yes. PPV generally increases as prevalence rises, while NPV generally decreases. In lower-prevalence populations, PPV tends to fall and NPV tends to rise.
Can PPV and NPV be calculated reliably from a case-control study?
Not usually for direct application to the target population, because the investigator-selected proportion of cases and controls may not reflect real disease prevalence.
Should diagnostic accuracy measures include confidence intervals?
Yes. Confidence intervals show the precision of sensitivity, specificity, PPV, and NPV estimates and are especially important when the sample or number of disease cases is small.

References

  1. Altman DG, Bland JM. Diagnostic tests 1: Sensitivity and specificity. BMJ. 1994;308(6943):1552. https://doi.org/10.1136/bmj.308.6943.1552
  2. Altman DG, Bland JM. Diagnostic tests 2: Predictive values. BMJ. 1994;309(6947):102. https://doi.org/10.1136/bmj.309.6947.102
  3. 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/
  4. Šimundić AM. Measures of diagnostic accuracy: basic definitions. EJIFCC. 2009;19(4):203-211. https://pmc.ncbi.nlm.nih.gov/articles/PMC4975285/
  5. 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

Advertisement

References

  1. [1] Replace with the first reference. Include title, authors, journal/source, year, and DOI or URL.
  2. [2] Replace with the second reference.
  3. [3] Replace with the third reference.

[aw_author_credentials]

Previous post
Next post