Diagnostic Test Characteristics Calculator (2×2 Table + Disease Prevalence)

This calculator evaluates diagnostic test performance using a standard 2×2 contingency table. In addition to core diagnostic accuracy metrics, users may optionally enter an external disease prevalence to estimate predictive values and accuracy for a target population.

Enter values from a 2×2 diagnostic contingency table
True Positives (TP) Diseased patients correctly identified
False Positives (FP) Non-diseased patients incorrectly positive
False Negatives (FN) Diseased patients missed by the test
True Negatives (TN) Non-diseased patients correctly identified
Disease Prevalence (Optional)

If the ratio of cases in the Disease Present and Disease Absent groups does not reflect the disease prevalence, enter an external prevalence:

Disease prevalence (%)

If left blank, sample prevalence is used for PPV, NPV, and accuracy calculations.

Formulas

Notation

\( \text{TP} = a, \quad \text{FN} = b, \quad \text{FP} = c, \quad \text{TN} = d, \quad N = a + b + c + d \)

Core Prevalence-Independent Metrics

Sensitivity

\( \text{Sensitivity} = \frac{\text{TP}}{\text{TP} + \text{FN}} \)

Specificity

\( \text{Specificity} = \frac{\text{TN}}{\text{TN} + \text{FP}} \)

Positive Likelihood Ratio (LR+)

\( \text{LR+} = \frac{\text{Sensitivity}}{1 - \text{Specificity}} \)

Negative Likelihood Ratio (LR−)

\( \text{LR−} = \frac{1 - \text{Sensitivity}}{\text{Specificity}} \)

Prevalence

\( \text{Sample prevalence} = \frac{\text{TP} + \text{FN}}{N} \)
External prevalence = user-supplied

Prevalence-Dependent Metrics

Positive Predictive Value (PPV)

\( \text{PPV} = \frac{\text{Sensitivity} \times \text{Prevalence}}{(\text{Sensitivity} \times \text{Prevalence}) + ((1 - \text{Specificity}) \times (1 - \text{Prevalence}))} \)

Negative Predictive Value (NPV)

\( \text{NPV} = \frac{\text{Specificity} \times (1 - \text{Prevalence})}{((1 - \text{Sensitivity}) \times \text{Prevalence}) + (\text{Specificity} \times (1 - \text{Prevalence}))} \)

Accuracy

\( \text{Accuracy} = (\text{Sensitivity} \times \text{Prevalence}) + (\text{Specificity} \times (1 - \text{Prevalence})) \)

Understanding Diagnostic Test Characteristics

Sensitivity is the probability that a test is positive when disease is present (true positive rate).

Specificity is the probability that a test is negative when disease is absent (true negative rate).

Positive likelihood ratio (LR+) quantifies how much more likely a positive test result is in patients with disease compared with those without disease.

Negative likelihood ratio (LR−) quantifies how much less likely a negative test result is in patients with disease compared with those without disease.

Prevalence represents the proportion of the population with the disease.

Positive predictive value (PPV) is the probability that disease is present given a positive test result and depends on prevalence.

Negative predictive value (NPV) is the probability that disease is absent given a negative test result and depends on prevalence.

Accuracy is the proportion of correctly classified patients and also depends on prevalence.

Sensitivity and Specificity vs. Predictive Values (PPV and NPV)

Sensitivity and specificity describe how a test performs given disease status. They are intrinsic properties of a test and do not change when the test is applied to different populations.

Positive and negative predictive values (PPV and NPV) describe how a test performs given the test result. They answer the question clinicians actually care about: "Given this result, what is the probability the patient truly has (or does not have) the disease?" Unlike sensitivity and specificity, PPV and NPV depend directly on disease prevalence.

Sensitivity and specificity describe how a test behaves relative to disease status. They answer the question: if the disease is truly present or absent, how often does the test give the correct result? Because they are conditioned on disease status, these measures are intrinsic properties of the test itself and remain stable when the test is applied to different populations.

Predictive values answer a different and more clinically intuitive question: given this test result, what is the probability the patient actually has (or does not have) the disease? Positive and negative predictive values are conditioned on the test result, not on disease status. As a result, they change substantially depending on how common the disease is in the population being tested.

This distinction becomes most apparent when considering disease prevalence. In low-prevalence populations, such as screening settings, even well-performing tests tend to have a low positive predictive value. When disease is uncommon, false positives may outnumber true positives, meaning that many patients with positive test results do not actually have the disease. At the same time, the negative predictive value is typically very high, so a negative test result is highly reassuring. In these settings, diagnostic tests are most useful for ruling out disease, while positive results generally require confirmation with a more definitive test.

The same test behaves very differently in high-prevalence populations, such as referral clinics or intensive care units. When disease is common, the positive predictive value increases, and a positive test result is much more likely to represent true disease. Conversely, the negative predictive value decreases, and a negative result may no longer be sufficient to exclude the diagnosis. In these settings, tests are often most useful for ruling in disease, and negative results must be interpreted cautiously in the context of the overall clinical picture.

For these reasons, sensitivity and specificity alone are not sufficient for clinical decision-making. Two tests with identical sensitivity and specificity can lead to very different conclusions when applied to populations with different baseline risk. This is why screening programs emphasize high sensitivity and high negative predictive value, while diagnostic confirmation often relies on high specificity, high positive predictive value, or likelihood ratios. Predictive values should always be interpreted in the context of pre-test probability or disease prevalence, rather than in isolation.

Assumptions & Limitations

  • Assumes binary test outcomes
  • Requires an appropriate reference standard, which is often imperfect
  • Sensitivity and specificity do not incorporate disease prevalence
  • PPV, NPV, and accuracy vary substantially with prevalence
  • Does not account for clinical consequences of false positives or false negatives
  • Likelihood ratio confidence intervals may be unstable with small cell counts

Illustrative Example

Example 2×2 Table

a = 80, b = 20, c = 30, d = 170

N = 300

Sample prevalence = 100 / 300 = 33.3%

Results Using Sample Prevalence

Sensitivity = 80 / 100 = 0.800 (80.0%)

Specificity = 170 / 200 = 0.850 (85.0%)

LR+ = 0.800 / (1 − 0.850) = 5.33

LR− = (1 − 0.800) / 0.850 = 0.235

PPV = 80 / (80 + 30) = 0.727 (72.7%)

NPV = 170 / (170 + 20) = 0.895 (89.5%)

Accuracy = (80 + 170) / 300 = 0.833 (83.3%)

Override Prevalence (External Prevalence = 10%)

PPV = (0.8 × 0.1) / [(0.8 × 0.1) + (0.15 × 0.9)] = 0.372 (37.2%)

NPV = (0.85 × 0.9) / [(0.2 × 0.1) + (0.85 × 0.9)] = 0.975 (97.5%)

Accuracy = (0.8 × 0.1) + (0.85 × 0.9) = 0.845 (84.5%)

This demonstrates that PPV, NPV, and accuracy change with prevalence, while sensitivity, specificity, and likelihood ratios remain unchanged.

Formula Reference

Diagnostic test metrics follow standard epidemiologic definitions used in STARD reporting guidelines and clinical epidemiology texts. For more reading, see this StatPearls article on Sensitivity and Specificity.

Related Calculators

Simplify Your Entire Manuscript Workflow with Livewrite

Livewrite works directly inside Microsoft Word to support every stage of manuscript preparation—from first draft to final submission.

Why Livewrite

  • Write and edit in Word with structured, journal-aware assistance that improves clarity, flow, and scientific rigor.
  • Cite as you write by searching 240+ million publications that match any sentence or paragraph, previewing the most relevant citations, and inserting them instantly—fully compatible with Zotero and Mendeley.
  • Instantly format your manuscript for any journal, including title pages, abstracts, headings, tables, figures, and references. (premium subscription)
  • Automated peer review before submission to flag missing requirements, reporting guideline gaps, and common reviewer concerns—helping prevent avoidable delays and desk rejections.

Draft, edit, cite, review, and format—without leaving Word.