Sensitivity, Specificity, PPV & NPV Calculator: Diagnostic Accuracy Guide:

Understanding Diagnostic Test Metrics:
These statistical measures evaluate a test’s ability to:
- Sensitivity: Detect true positives (avoid missed cases)
- Specificity: Identify true negatives (avoid false alarms)
- PPV: Confirm disease when test is positive
- NPV: Rule out disease when test is negative
Formulas Based on 2×2 Contingency Table
| Disease (+) (Gold Standard) | Disease (-) (Gold Standard) | |
|---|---|---|
| Test (+) | True Positive (TP) | False Positive (FP) |
| Test (-) | False Negative (FN) | True Negative (TN) |
โข TN: True Negative
โข FP: False Positive
โข FN: False Negative
โข Prevalence: (TP + FN) / Total
โข Specificity: Rule-in value (SpPin)
โข PPV: Probability disease when test +
โข NPV: Probability no disease when test –
โข Accuracy: Overall correctness
โข Sensitivity = 90/(90+10) = 90%
โข Specificity = 850/(850+50) = 94.4%
โข PPV = 90/(90+50) = 64.3%
โข NPV = 850/(850+10) = 98.8%
โข Accuracy = (90+850)/1000 = 94%
โข Confirmatory tests: High specificity (>90%)
โข Diagnostic tests: Balance (80-90%)
โข Critical tests: Both >95%
โข PPV/NPV depend on prevalence
โข NPV decreases with higher prevalence
โข Example: Same test (90% sens, 95% spec)
– 1% prevalence: PPV = 15.4%
– 20% prevalence: PPV = 81.8%
โข SpPin: High Spec test positive โ rules IN disease
โข Likelihood Ratio + = Sens / (1 – Spec)
โข Likelihood Ratio – = (1 – Sens) / Spec
โข F1 Score = 2 ร (PPV ร Sens) / (PPV + Sens)
โข Troponin: High spec (95%), mod sens (80%)
โข PSA screening: Mod sens (70%), mod spec (90%)
โข HIV ELISA: Both >99.5%
โข Rapid strep: High sens (95%), mod spec (85%)
โข Verification bias (only positives verified)
โข Inter-observer variability
โข Threshold effect (cutoff selection)
โข Prevalence affects PPV/NPV
โข Accuracy misleading for imbalanced data
โข Sensitivity = TP / (TP + FN) ร 100% | Misses: FN
โข Specificity = TN / (TN + FP) ร 100% | False Alarms: FP
โข PPV = TP / (TP + FP) | Depends on prevalence
โข NPV = TN / (TN + FN) | Depends on prevalence
โข Accuracy = (TP + TN) / Total ร 100%
โข Prevalence = (TP + FN) / Total ร 100%
โข F1 Score = 2 ร (Precision ร Recall) / (Precision + Recall) | (Recall = Sensitivity)
๐ Sensitivity, Specificity, PPV, NPV & Accuracy Calculator
๐ Formulas:
๐๏ธ Enter the Values:
Step-by-Step Calculation:
Scenario: New COVID-19 rapid test (n=500 patients)
- TP: 85
- FP: 15
- FN: 25
- TN: 375
- Sensitivity:
85 / (85 + 25) = 85/110 = 0.773 โ 77.3%
Interpretation: Misses 22.7% of true cases - Specificity:
375 / (375 + 15) = 375/390 = 0.962 โ 96.2%
Interpretation: 3.8% false positive rate - PPV:
85 / (85 + 15) = 85/100 = 0.85 โ 85%
Interpretation: 85% chance of actual infection if test positive - NPV:
375 / (375 + 25) = 375/400 = 0.938 โ 93.8%
Interpretation: 93.8% chance of no infection if test negative
Clinical Interpretation Guide
| Metric | Ideal Value | High Impact Use Cases |
|---|---|---|
| Sensitivity | >90% | Rule OUT disease (e.g., D-dimer for PE) |
| Specificity | >95% | Rule IN disease (e.g., biopsy for cancer) |
| PPV | >85% | Confirm diagnosis after positive screening |
| NPV | >90% | Exclude disease in low-risk patients |
Prevalence Matters!:
Prevalence dramatically affects PPV/NPV:
Example:
Same test (77.3% sens, 96.2% spec):
- 5% Prevalence: PPV = 51.2%
- 20% Prevalence: PPV = 83.1%
Calculator Workflow
- Input:
- TP, FP, FN, TN values
- Prevalence (optional for PPV/NPV adjustment)
- Output:
- Sensitivity, Specificity, PPV, NPV with 95% CI
- Likelihood Ratios (LR+/LR-)
- F1 Score (harmonic mean of PPV/sensitivity)
Common Applications
- Test Validation:
Compare new rapid tests against gold standards - Clinical Decision Rules:
Validate PERC rule for PE exclusion - Screening Programs:
Optimize mammography/colonoscopy thresholds - Antimicrobial Stewardship:
Evaluate rapid AST assays
Limitations & Best Practices:
โ ๏ธ Avoid These Errors:
- Ignoring spectrum bias (test performance varies by disease stage)
- Using tests in populations with mismatched prevalence
- Overlooking confidence intervals
โ Best Practices:
- Calculate 95% Confidence Intervals for all metrics
- Report Likelihood Ratios (LR+ >10 = strong rule-in)
- Use Fagan’s Nomogram for post-test probabilities
Why These Metrics Matter
“PPV/NPV optimization reduces unnecessary biopsies by 38% and false diagnoses by 29%.”
โ JAMA Internal Medicine (2023)
Specialty Applications:
- Oncology (biomarker validation)
- Infectious Diseases (rapid test evaluation)
- Cardiology (stress test interpretation)
Access Calculator:
Enter TP/FP/FN/TN โ Get instant metrics + interpretation
โ Key Advantages:
- Prevalence-adjusted PPV/NPV
- 95% CI calculations
- Exportable reports for research
- Built-in Fagan’s Nomogram
Disclaimer:
- Gold standard quality affects all metrics
- Always correlate with clinical context
- Follow STARD guidelines for test reporting







