Home Back

Sensitivity and Specificity Calculator

Sensitivity and Specificity Formula

1. What is a Sensitivity and Specificity Calculator?

Definition: This calculator evaluates the performance of a diagnostic test using true positives, false positives, false negatives, true negatives, and prevalence.

Purpose: It assists in assessing the accuracy and reliability of medical or diagnostic tests.

2. How Does the Calculator Work?

The calculator uses the following formulas:

\( \text{Sensitivity} = \frac{TP}{TP + FN} \)
\( \text{Specificity} = \frac{TN}{TN + FP} \)
\( \text{LR+} = \frac{\text{Sensitivity}}{1 - \text{Specificity}} \)
\( \text{LR-} = \frac{1 - \text{Sensitivity}}{\text{Specificity}} \)
\( \text{PPV} = \frac{\text{Sensitivity} \times \text{Prevalence}}{(\text{Sensitivity} \times \text{Prevalence}) + ((1 - \text{Specificity}) \times (1 - \text{Prevalence}))} \)
\( \text{NPV} = \frac{\text{Specificity} \times (1 - \text{Prevalence})}{((1 - \text{Sensitivity}) \times \text{Prevalence}) + (\text{Specificity} \times (1 - \text{Prevalence}))} \)
\( \text{Accuracy} = \frac{TP + TN}{TP + TN + FP + FN} \)

Where:

  • \( TP \): True Positives.
  • \( FP \): False Positives.
  • \( FN \): False Negatives.
  • \( TN \): True Negatives.
  • \( \text{Prevalence} \): Proportion of the population with the condition (as a decimal).

Steps:

  • Input TP, FP, FN, TN, and prevalence.
  • Validate: All counts non-negative, total sample size positive, prevalence between 0% and 100%.
  • Calculate Sensitivity and Specificity from counts.
  • Compute PPV and NPV using prevalence-based formulas.
  • Calculate other metrics (LR+, LR-, Accuracy).
  • Display results as percentages (except likelihood ratios) rounded to 4 decimal places.

3. Importance of Sensitivity and Specificity Calculations

These calculations are key for:

  • Medical Diagnostics: Evaluating test performance.
  • Clinical Decision-Making: Guiding treatment based on test outcomes.
  • Research Validation: Assessing diagnostic tool reliability.

4. Using the Calculator

Examples (TP = 369, FP = 58, FN = 15, TN = 558, Prevalence = 40.66%):

  • Sensitivity: \( \frac{369}{369 + 15} \approx 0.9608 \) → 96.0800%.
  • Specificity: \( \frac{558}{558 + 58} \approx 0.9057 \) → 90.5700%.
  • Positive Likelihood Ratio: \( \frac{0.9608}{1 - 0.9057} \approx 10.2245 \).
  • Negative Likelihood Ratio: \( \frac{1 - 0.9608}{0.9057} \approx 0.0432 \).
  • PPV: \( \frac{0.9608 \times 0.4066}{(0.9608 \times 0.4066) + ((1 - 0.9057) \times (1 - 0.4066))} \approx 0.8662 \) → 86.6200%.
  • NPV: \( \frac{0.9057 \times (1 - 0.4066)}{((1 - 0.9608) \times 0.4066) + (0.9057 \times (1 - 0.4066))} \approx 0.9765 \) → 97.6500%.
  • Accuracy: \( \frac{369 + 558}{369 + 558 + 58 + 15} \approx 0.9406 \) → 94.0600%.

5. Frequently Asked Questions (FAQ)

Q: What if the total sample size is zero?
A: The calculation is invalid, and an error is displayed.

Q: How does prevalence affect PPV and NPV?
A: Higher prevalence increases PPV and decreases NPV.

Q: What do likelihood ratios indicate?
A: LR+ > 1 increases disease likelihood; LR- < 1 decreases it.

Sensitivity and Specificity Calculator© - All Rights Reserved 2025