# Sensitivity & Specificity Calculator

Calculate sensitivity, specificity, PPV, NPV, accuracy, F1 score, and likelihood ratios from a 2x2 contingency table for any diagnostic test.

## What this calculates

Enter the four cells of a 2x2 contingency table (true positives, false positives, false negatives, true negatives) to compute all major diagnostic test performance metrics.

## Inputs

- **True Positives (TP)** — min 0 — Test positive AND condition present.
- **False Positives (FP)** — min 0 — Test positive BUT condition absent.
- **False Negatives (FN)** — min 0 — Test negative BUT condition present.
- **True Negatives (TN)** — min 0 — Test negative AND condition absent.

## Outputs

- **Sensitivity (Recall/TPR)** — formatted as percentage — Proportion of actual positives correctly identified.
- **Specificity (TNR)** — formatted as percentage — Proportion of actual negatives correctly identified.
- **PPV (Precision)** — formatted as percentage — Positive Predictive Value: probability the condition is present given a positive test.
- **NPV** — formatted as percentage — Negative Predictive Value: probability the condition is absent given a negative test.
- **Accuracy** — formatted as percentage — Overall proportion of correct classifications.
- **Prevalence** — formatted as percentage — Proportion of the sample with the condition.
- **F1 Score** — Harmonic mean of precision and recall (0 to 1).
- **Likelihood Ratio (+)** — How much a positive test increases the odds of the condition.
- **Likelihood Ratio (-)** — How much a negative test decreases the odds of the condition.
- **Calculation** — formatted as text — Step-by-step breakdown.

## Details

**What is Sensitivity?**

Sensitivity (also called recall or true positive rate) measures how well a test detects the condition when it is actually present:

**Sensitivity = TP / (TP + FN)**

A highly sensitive test rarely misses true cases, making it useful for screening.

**What is Specificity?**

Specificity (true negative rate) measures how well a test correctly identifies those without the condition:

**Specificity = TN / (TN + FP)**

A highly specific test rarely produces false alarms, making it useful for confirmation.

**Predictive Values**

- **PPV (Positive Predictive Value)** = TP / (TP + FP) -- given a positive result, the probability the condition is truly present
- **NPV (Negative Predictive Value)** = TN / (TN + FN) -- given a negative result, the probability the condition is truly absent

PPV and NPV depend on prevalence: the same test performs differently in high-prevalence vs. low-prevalence populations.

**Likelihood Ratios**

- **LR+** = Sensitivity / (1 - Specificity): how much a positive test increases the odds
- **LR-** = (1 - Sensitivity) / Specificity: how much a negative test decreases the odds

An LR+ above 10 or LR- below 0.1 represents a strong diagnostic test.

## Frequently Asked Questions

**Q: What is the difference between sensitivity and specificity?**

A: Sensitivity tells you how good the test is at catching true positives (sick people correctly identified). Specificity tells you how good it is at catching true negatives (healthy people correctly identified). A perfect test would score 100% on both, but in practice there is usually a tradeoff.

**Q: Why do PPV and NPV change with prevalence?**

A: PPV and NPV depend on how common the condition is in the tested population. In a low-prevalence population, even a specific test produces many false positives relative to true positives, lowering PPV. That is why screening tests work best in populations where the condition is reasonably common.

**Q: What is the F1 score and when should I use it?**

A: The F1 score is the harmonic mean of precision (PPV) and recall (sensitivity). It ranges from 0 to 1 and is especially useful when you have imbalanced classes, since accuracy alone can be misleading when one class heavily outnumbers the other.

---

Source: https://vastcalc.com/calculators/statistics/sensitivity-specificity
Category: Statistics
Last updated: 2026-04-08
