Opens in a new tab

CALCULATOR · CLINICAL RESEARCH

Diagnostic Accuracy Calculator Sensitivity, Specificity, PPV, NPV and Likelihood Ratios

A sensitivity and specificity calculator for a test against its reference standard: enter the true positives, false positives, false negatives and true negatives. Each accuracy measure with its confidence interval and the post-test probability at the prevalence you choose update as you type. Nothing you enter leaves your browser.

Runs in your browser. No data is sent or stored.

Method reviewed by an in-house statistician · Last checked November 2026

In Short

A sensitivity and specificity calculator summarizes a 2 × 2 table of test results against a reference standard: sensitivity and specificity describe the test, while the predictive values and likelihood ratios describe what a result means for a patient. Predictive values depend on prevalence, so this calculator reports them at the sample prevalence and lets you recalculate at another one. Every proportion carries a Wilson confidence interval and each likelihood ratio an interval on the log scale, so the precision of the study is visible beside the estimate.

How It Is Calculated

From the four counts the calculator computes five proportions:

FORMULA

Se = TP / (TP + FN) Sp = TN / (TN + FP) PPV = TP / (TP + FP) NPV = TN / (TN + FN) accuracy = (TP + TN) / N

TP = true positives · FP = false positives · FN = false negatives · TN = true negatives · N = all participants.

Each proportion x/n receives a Wilson score interval, never the Wald interval (Newcombe, 1998a):

FORMULA

center = (p + z²/2n) / (1 + z²/n) half-width = z · √( p(1 − p)/n + z²/4n² ) / (1 + z²/n)

p = x/n · z = standard normal quantile for the chosen confidence level.

The likelihood ratios and their intervals use the log scale (Simel et al., 1991; Deeks & Altman, 2004):

FORMULA

LR+ = Se / (1 − Sp) LR− = (1 − Se) / Sp
SE(ln LR+) = √( 1/TP − 1/(TP + FN) + 1/FP − 1/(FP + TN) )
SE(ln LR−) = √( 1/FN − 1/(TP + FN) + 1/TN − 1/(FP + TN) )
CI = exp( ln LR ± z · SE )

To move to another prevalence π, the calculator converts the likelihood ratio into a post-test probability:

FORMULA

pre-test odds = π / (1 − π) post-test odds = pre-test odds × LR probability = odds / (1 + odds)

The calculator labels four quantities separately. At the chosen prevalence, the PPV is the probability of disease after a positive result. The NPV is the probability of no disease after a negative result, which is 1 minus the post-test probability of disease after a negative result, so the two are not the same number.

When a cell is zero, the uncorrected likelihood ratio is reported first in words with its actual status, for example infinite when FP is zero with TP above zero, and a corrected estimate with 0.5 added to every cell is shown separately and labeled as a convention.

Assumptions and When Not to Use It

  • One 2 × 2 table against a reference standard. Sensitivity and specificity are only as valid as the reference standard that defines disease. A test compared with a flawed reference is measured against that flaw.
  • Independent subjects. Each participant contributes one result. Several readings or lesions per participant need an analysis that accounts for the clustering.
  • Transportable sensitivity and specificity. The prevalence slider assumes the test performs the same at the new prevalence. If the spectrum of patients differs, that assumption fails.
  • Predictive values belong to a prevalence. PPV and NPV from a sample hold for that sample’s prevalence. For predictive values at another prevalence and the likelihood ratios behind them, see Sensitivity & Specificity (Diagnostic Accuracy).
  • Both groups must be present. The table needs at least one diseased and one non-diseased participant. Otherwise the calculator returns a message, not a number.
  • Sparse tables. A zero cell makes a likelihood ratio infinite, zero or undefined before correction. The corrected value is a convention.

Worked Example (Hypothetical Values)

A new test is compared with a reference standard in 200 participants: 90 true positives, 20 false positives, 10 false negatives and 80 true negatives. The prevalence slider is then set to 0.10 to see what the result means in a lower-prevalence setting.

Input or result Value
TP, FP, FN, TN 90, 20, 10, 80
Sensitivity (95% CI) 0.900 (0.826 to 0.945)
Specificity (95% CI) 0.800 (0.711 to 0.867)
PPV at the sample prevalence (95% CI) 0.818 (0.736 to 0.879)
NPV at the sample prevalence (95% CI) 0.889 (0.807 to 0.939)
LR+ (95% CI) 4.50 (3.02 to 6.70)
LR− (95% CI) 0.125 (0.069 to 0.227)
Prevalence 0.10: disease probability after a positive result (= PPV) 0.3333
Prevalence 0.10: disease probability after a negative result 0.0137
Prevalence 0.10: NPV (1 − 0.0137) 0.9863

At a prevalence of 0.10, a positive result raises the probability of disease to 0.3333, well below the PPV at the sample prevalence. Press “Load the worked example” under the calculator and these values fill the fields. HYPOTHETICAL VALUES.

What the Result Still Needs

  1. 1
    A reference standard you can defend. The protocol names it, states how it was applied to every participant and says whether the test result was masked from those reading it.
  2. 2
    A representative spectrum. The participants resemble the people in whom the test will be used, since sensitivity and specificity shift with case mix.
  3. 3
    Intervals reported with every estimate. A sensitivity without its confidence interval hides how few diseased participants contributed.
  4. 4
    A prevalence stated for the predictive values. The PPV and NPV are reported together with the prevalence they refer to.
  5. 5
    The reporting guideline followed. A diagnostic accuracy study has its own reporting checklist, which the manuscript is expected to follow.
Have the result reported correctly

A statistician checks the table and the reference standard against your design, confirms the measures and intervals, and writes the results text for your manuscript.

Results Reporting & Interpretation
Already have a calculation?

Independent Statistical Review confirms an analysis prepared by you, a colleague or an AI tool before it goes to a committee or a journal.

Independent Statistical Review

Frequently Asked Questions

At a chosen prevalence, yes: the PPV equals the probability of disease after a positive result. The NPV is different: it is the probability of no disease after a negative result, which is 1 minus the post-test probability of disease after a negative result. The calculator never equates the negative post-test disease probability with the NPV.

Sensitivity and specificity describe the test, but the predictive values also depend on how common the disease is among those tested. In the worked example, a prevalence of 0.10 gives a disease probability of 0.3333 after a positive result. State the prevalence beside every predictive value you report.

The likelihood ratio can be infinite, zero or undefined before correction: LR+ is infinite when FP is zero with TP above zero, and LR− is zero when FN is zero with TN above zero. The calculator names the status in words and then shows an estimate with 0.5 added to every cell. The correction is a convention, not a better estimate.

The Wald interval behaves poorly near 0 and 1, where sensitivity and specificity often sit, and with small numbers of diseased or non-diseased participants. The Wilson score interval keeps the coverage close to the stated level. The calculator uses Wilson for every proportion.

Only if the test performs the same way there. The prevalence slider assumes that sensitivity and specificity are transportable, but they can change with the spectrum of disease and the setting. Treat a recalculated predictive value as a scenario, not a measurement.

References

  1. Deeks, J. J., & Altman, D. G. (2004). Diagnostic tests 4: Likelihood ratios. BMJ, 329(7458), 168-169. https://doi.org/10.1136/bmj.329.7458.168
  2. Newcombe, R. G. (1998a). Two-sided confidence intervals for the single proportion: Comparison of seven methods. Statistics in Medicine, 17(8), 857-872. https://doi.org/10.1002/(SICI)1097-0258(19980430)17:8<857::AID-SIM777>3.0.CO;2-E
  3. Simel, D. L., Samsa, G. P., & Matchar, D. B. (1991). Likelihood ratios with confidence: Sample size estimation for diagnostic test studies. Journal of Clinical Epidemiology, 44(8), 763-770. https://doi.org/10.1016/0895-4356(91)90128-V
i

Method reviewed by an in-house statistician · Last checked November 2026 · Test cases and boundary cases verified before release

Found an error or have a suggestion? Write to info@onlinespss.com with the calculator name and the inputs you used. Every report is checked by a statistician.

Have a Statistician Check Your Diagnostic Accuracy Results

Share the study aim, the reference standard and the table or the source of your numbers. A statistically trained Research Coordinator reviews the request, and the scope and one fixed project fee are confirmed before work begins.

No Commitment Required

Strictly Confidential

Fixed Project Fee

In-House PhD-Level Statisticians

Same-Day Response