Sensitivity & Specificity Calculator

Evaluate the performance of a diagnostic test by calculating key accuracy metrics.

Enter the number of True Positives, False Positives, True Negatives, and False Negatives to compute sensitivity, specificity, and more.

Examples

Explore different scenarios to understand how sensitivity and specificity work.

Medical Diagnostic Test

Medical Diagnosis

Evaluating a new screening test for a specific disease in a population of 1000 people.

TP: 90, FP: 50

TN: 850, FN: 10

Spam Email Filter

Machine Learning

Assessing the performance of a machine learning model designed to detect spam emails.

TP: 250, FP: 20

TN: 1700, FN: 30

Manufacturing Quality Control

Quality Control

A test to identify defective products on an assembly line.

TP: 48, FP: 5

TN: 940, FN: 7

High Specificity Scenario

Research Scenario

A confirmatory test that must be very good at correctly identifying negative cases to avoid false alarms.

TP: 150, FP: 5

TN: 995, FN: 30

Other Titles
Understanding Sensitivity and Specificity: A Comprehensive Guide
Dive deep into the core concepts of diagnostic test accuracy, their calculation, and real-world importance.

What are Sensitivity and Specificity?

  • Defining the Core Concepts
  • The Confusion Matrix
  • Why Both Metrics Matter
Sensitivity and Specificity are statistical measures used to evaluate the performance of a binary classification test, which is a test that determines the presence or absence of a condition, disease, or characteristic. They are fundamental concepts in fields like medicine, machine learning, and quality control.
Sensitivity (True Positive Rate)
Sensitivity, also known as the True Positive Rate (TPR) or recall, measures the ability of a test to correctly identify individuals who have the condition. A test with high sensitivity will catch most of the true positive cases, minimizing false negatives. The formula is: Sensitivity = TP / (TP + FN)
Specificity (True Negative Rate)
Specificity, or the True Negative Rate (TNR), measures the ability of a test to correctly identify individuals who do not have the condition. A test with high specificity will correctly rule out most of the true negative cases, minimizing false positives. The formula is: Specificity = TN / (TN + FP)

Simple Analogy

  • Think of a fishing net. A net with a very large mesh (high sensitivity) will catch all the big fish but also a lot of unwanted small fish and debris (low specificity). A net with a very small mesh (high specificity) will only catch the target big fish but might miss some of them (low sensitivity).

Step-by-Step Guide to Using the Calculator

  • Inputting Your Data Correctly
  • Interpreting the Primary Results
  • Understanding Advanced Metrics
This calculator simplifies the process of evaluating test accuracy. Follow these steps to get your results.
1. Gather Your Data
You need four key values from your test results, often organized in a 2x2 table called a confusion matrix:
True Positives (TP): The number of 'positive' results that are actually positive.
False Positives (FP): The number of 'positive' results that are actually negative.
True Negatives (TN): The number of 'negative' results that are actually negative.
False Negatives (FN): The number of 'negative' results that are actually positive.
2. Enter the Values
Input each of the four values into the corresponding fields in the calculator.
3. Analyze the Output
The calculator will automatically compute Sensitivity, Specificity, Positive Predictive Value (PPV), Negative Predictive Value (NPV), and other related metrics. High percentages for these values generally indicate a more accurate test.

Interpreting Results

  • A Sensitivity of 90% means the test correctly identifies 90% of people with the disease.
  • A Specificity of 95% means the test correctly identifies 95% of people without the disease.

Real-World Applications

  • Medical Diagnosis and Screening
  • Machine Learning and AI
  • Industrial Quality Control
Medical Diagnosis
This is the most common application. For example, evaluating an ELISA test for HIV. High sensitivity is crucial for screening tests to avoid missing any cases. High specificity is vital for confirmatory tests to avoid misdiagnosing a healthy person.
Spam Filtering
In machine learning, a spam filter's performance can be measured. A 'positive' result is an email being classified as spam. High sensitivity means catching most spam emails (low FN). High specificity means not marking important emails as spam (low FP).
Manufacturing
Automated systems test products for defects. A 'positive' result is a defective product. High sensitivity ensures most faulty items are caught before shipping. High specificity ensures that good products are not unnecessarily discarded.

Application Focus

  • For cancer screening, a high-sensitivity test is preferred to ensure no case is missed, even if it leads to more false positives who will get a follow-up confirmatory test.
  • For a legal system, a test to determine guilt must have extremely high specificity to avoid convicting innocent people (minimize false positives).

Beyond Sensitivity & Specificity

  • Predictive Values (PPV and NPV)
  • Likelihood Ratios
  • The Accuracy Paradox
Positive and Negative Predictive Values (PPV & NPV)
While sensitivity and specificity are properties of the test itself, predictive values depend on the prevalence of the condition in the population being tested. PPV is the probability that a positive test result is a true positive. NPV is the probability that a negative test result is a true negative.
Likelihood Ratios (LR)
Likelihood ratios tell you how much a positive or negative test result changes the likelihood that a patient has the disease. The Positive LR (+LR) tells you how much to increase the probability of disease given a positive result. The Negative LR (-LR) tells you how much to decrease it given a negative result.
The Accuracy Paradox
Overall accuracy can be a misleading metric, especially with imbalanced datasets (e.g., rare diseases). A test can have high accuracy simply by classifying every case as negative. This is why a combination of metrics like sensitivity, specificity, and F1-score is more informative.

Why Other Metrics Matter

  • A test with 99% accuracy sounds great, but if a disease's prevalence is 1 in 10,000, a model that always predicts 'negative' will be 99.99% accurate but is completely useless. This highlights the Accuracy Paradox.

Mathematical Derivations and Formulas

  • Core Formulas
  • Relationship between Metrics
  • Worked Example
Primary Formulas
Sensitivity = TP / (TP + FN)
Specificity = TN / (TN + FP)
Accuracy = (TP + TN) / (TP + FP + TN + FN)
Predictive Value Formulas
Precision (PPV) = TP / (TP + FP)
Negative Predictive Value (NPV) = TN / (TN + FN)
Other Key Formulas
F1-Score = 2 (Precision Sensitivity) / (Precision + Sensitivity)
Positive Likelihood Ratio (+LR) = Sensitivity / (1 - Specificity)
Negative Likelihood Ratio (-LR) = (1 - Sensitivity) / Specificity

Example Calculation

  • Given: TP=80, FP=10, TN=900, FN=20. Total=1010.
  • Sensitivity = 80 / (80 + 20) = 80 / 100 = 80%
  • Specificity = 900 / (900 + 10) = 900 / 910 = 98.9%
  • PPV = 80 / (80 + 10) = 80 / 90 = 88.9%