Cal11 calculator

Calculating True Positive From Contingency Table

Reviewed by Calculator Editorial Team

In statistical analysis, a true positive is a critical measure of test accuracy. This guide explains how to calculate true positives from a contingency table, with practical examples and an interactive calculator.

What is a True Positive?

A true positive occurs when a test correctly identifies a condition or attribute. In medical testing, for example, a true positive means the test accurately detects a disease in a patient who actually has it. In machine learning, it represents correctly classified positive instances.

True positives are one of four possible outcomes in a binary classification system:

  • True Positive (TP): Correctly identified positive cases
  • False Positive (FP): Incorrectly identified positive cases
  • True Negative (TN): Correctly identified negative cases
  • False Negative (FN): Incorrectly identified negative cases

In medical testing, false negatives can be particularly dangerous as they may lead to missed diagnoses.

Understanding Contingency Tables

A contingency table (also called a confusion matrix) organizes the outcomes of a test or classification system. It's a 2×2 table that shows how many cases fall into each of the four categories:

Predicted Positive Predicted Negative
Actual Positive True Positive (TP) False Negative (FN)
Actual Negative False Positive (FP) True Negative (TN)

This table provides a complete picture of classification performance by showing both correct and incorrect predictions.

How to Calculate True Positive

The true positive count is simply the number of cases where both the prediction and the actual outcome were positive. It's directly observable from the contingency table.

True Positive (TP) = Number of cases where both prediction and actual outcome are positive

To calculate the true positive rate (sensitivity), you would divide the true positive count by the total actual positives (TP + FN).

True Positive Rate (Sensitivity) = TP / (TP + FN)

Worked Example

Consider a medical test for a disease with these results:

Test Positive Test Negative
Disease Present 80 (TP) 20 (FN)
Disease Absent 10 (FP) 90 (TN)

In this case, the true positive count is 80. The true positive rate would be 80/(80+20) = 0.8 or 80%.

Interpreting Results

The true positive count provides several important insights:

  • It shows how many cases were correctly identified
  • When combined with other metrics, it helps assess test reliability
  • It's particularly important in fields where false negatives have serious consequences

For example, in cancer screening, a high true positive count indicates the test effectively identifies cancer cases.

Frequently Asked Questions

What is the difference between true positive and true positive rate?

The true positive is the count of correctly identified positive cases, while the true positive rate is the proportion of actual positives that were correctly identified (TP/(TP+FN)).

How do I calculate true positives from a contingency table?

Look for the cell where both the prediction and actual outcome are positive. The number in that cell is your true positive count.

Why are true positives important in medical testing?

True positives indicate the test's ability to correctly identify cases with the condition, which is crucial for proper diagnosis and treatment planning.