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






