TapCub is live — analytics, insights and live chat, free on one platform
Glossary

True Positive Rate (Sensitivity): Formula and Confusion Matrix Example

The true positive rate is the share of actual positives a classifier catches: TP ÷ (TP + FN). A bot-detection confusion matrix, how TPR trades off against false positives, and why it equals statistical power.

Lucas Hayes Reviewed by Chen Yu Also called sensitivity Last updated Nov 28, 2026 Glossary

Quick answer

The true positive rate (TPR), also called sensitivity or recall, is the share of actual positive cases a classifier or test correctly identifies: TP ÷ (TP + FN). It shows how much is caught but not how many negatives are wrongly flagged, so it is read with the false positive rate or precision.

Formula: TPR = TP ÷ (TP + FN), where TP = true positives and FN = false negatives; false negative rate = 1 − TPR

What is the true positive rate?

The true positive rate (TPR) is the share of actual positive cases that a classifier or test correctly flags as positive. If 200 sessions really are bots and a detector catches 170 of them, its TPR is 170 ÷ 200 = 85%. The same quantity is called sensitivity in medicine, recall in machine learning, the hit rate or probability of detection in signal detection, and statistical power when the "classifier" is a hypothesis test.

TPR answers one question only: of the cases that are really positive, how many did we catch? It says nothing about how many negatives were wrongly flagged, which is why it is always read next to the false positive rate or precision.

How is the true positive rate calculated?

Every prediction from a yes/no classifier falls into one of four cells of a confusion matrix:

Predicted positivePredicted negative
Actually positiveTrue positive (TP)False negative (FN)
Actually negativeFalse positive (FP)True negative (TN)

The true positive rate uses only the top row:

TPR = TP ÷ (TP + FN)

The denominator is every actual positive, whether caught or missed. Its complement is the false negative rate, FN ÷ (TP + FN) = 1 − TPR. Google's machine learning course defines recall the same way: the proportion of all actual positives that were classified correctly as positives.

Worked example: bot detection on 1,000 sessions

Sample data. An analytics team checks its bot filter against 1,000 sessions whose true status it has verified by hand: 200 are bots (positive) and 800 are humans (negative). The filter flags 180 sessions as bots.

Flagged as botCounted as humanTotal
Actually botTP = 170FN = 30200
Actually humanFP = 10TN = 790800
Total1808201,000

From this one table:

  • True positive rate (recall, sensitivity) = 170 ÷ 200 = 85.0%. The filter catches 85% of bots.
  • False negative rate = 30 ÷ 200 = 15.0%. These 30 bots stay in the human reports.
  • False positive rate = FP ÷ (FP + TN) = 10 ÷ 800 = 1.25%. Ten real visitors are hidden from the human reports.
  • Specificity (true negative rate) = 790 ÷ 800 = 98.75%.
  • Precision = TP ÷ (TP + FP) = 170 ÷ 180 = 94.4%. Of sessions labelled as bots, 94.4% really are.
  • Accuracy = (170 + 790) ÷ 1,000 = 96.0%.

What the reader of an analytics report feels is the effect on the human count. The report shows 820 human sessions (790 real humans plus 30 missed bots) instead of the true 800, a 2.5% overcount. If 40 of the real humans converted, the true conversion rate is 40 ÷ 800 = 5.00%, but the report shows 40 ÷ 820 = 4.88%. Raising the TPR shrinks that gap; raising it by flagging more aggressively would also raise the false positive rate and hide more real visitors. For how bots distort other metrics, see bot traffic.

How is TPR different from FPR, precision and specificity?

MetricFormulaQuestion it answersExample value
True positive rate (recall, sensitivity)TP ÷ (TP + FN)Of real positives, how many did we catch?85.0%
False negative rateFN ÷ (TP + FN)Of real positives, how many did we miss?15.0%
False positive rateFP ÷ (FP + TN)Of real negatives, how many did we wrongly flag?1.25%
Specificity (true negative rate)TN ÷ (TN + FP)Of real negatives, how many did we correctly clear?98.75%
Precision (positive predictive value)TP ÷ (TP + FP)Of everything we flagged, how much was right?94.4%
Accuracy(TP + TN) ÷ totalOf everything, how much was right?96.0%

Two pairs are easy to confuse. TPR and precision share the numerator but not the denominator: TPR divides by actual positives, precision by predicted positives. TPR and FPR are the two axes of the ROC curve and move together when you change the threshold.

Accuracy alone is misleading when positives are rare. Google's course gives the extreme case: on a dataset where 1% of cases are positive, a model that always predicts negative scores 99% accuracy while catching nothing, a TPR of 0%.

What is the trade-off between TPR and the false positive rate?

Most classifiers output a score, and a threshold turns the score into yes or no. Lowering the threshold flags more cases, which raises TPR and FPR together. Plotting TPR against FPR for every threshold gives the ROC curve; Fawcett's widely cited introduction to ROC analysis describes it as the trade-off between benefits (true positives) and costs (false positives).

Sample data: a churn model scores 1,000 subscribers, 100 of whom actually cancel the next month.

ThresholdFlaggedTPFPTPRFPRPrecision
0.32658518085%20%32.1%
0.5160709070%10%43.8%
0.772452745%3%62.5%

Which row is right depends on the cost of each error. If the retention offer is a cheap email, the 0.3 threshold catches 85% of churners and the 180 false alarms cost little. If it is a 30% discount, the 0.7 threshold avoids giving it to 153 customers who would have stayed anyway, at the price of missing more than half the churners. Choosing the threshold is a business decision; TPR only describes one side of it. Model-building choices for this case are covered in customer churn prediction.

How does the true positive rate relate to statistical power?

A hypothesis test is a classifier too: it labels each result "effect" (reject the null) or "no effect". When a real effect exists, the probability that the test detects it is the test's statistical power, which is exactly its true positive rate. The significance level α is its false positive rate.

Classifier termHypothesis-test term
True positive ratePower (1 − β)
False negative rateType II error rate (β)
False positive rateType I error rate (α)
Specificity1 − α

So "80% power" means: if ten tests each have a real effect of the planned size, about eight will come out significant and two will be missed. Raising power (TPR) at a fixed α needs a larger sample or a larger effect. The two error types are compared in type I vs type II error.

What mistakes do people make with the true positive rate?

  • Reporting TPR alone. A filter that flags every session as a bot has 100% TPR and is useless. Always pair it with FPR or precision.
  • Confusing TPR with precision. "85% of bots caught" and "85% of flagged sessions are bots" are different claims with different denominators.
  • Using accuracy on imbalanced data. With rare positives, accuracy is dominated by true negatives.
  • Measuring on a non-representative sample. TPR measured only on known, easy bots overstates performance on new ones.
  • Ignoring base rates. The same TPR and FPR give very different precision when positives are 1% rather than 20% of cases.

Bot detection in TapCub

The bot example maps directly onto how TapCub separates bots from people. TapCub doesn't publish a TPR figure for its detection, and what you can see is how the two kinds of error show up:

  1. Positives go to their own report. New projects default to Detect and report separately: recognised bots appear only in Web analytics › Bots and don't enter human visitors, sessions or pageviews. Each bot row shows the detection layers it matched and a trust level (verified, suspected or unknown). How the layers work is in how bot detection works.
  2. False positives can be reported. If a row is a real person or your own monitoring tool flagged wrongly, report it as a false positive for a platform admin to review: report a bot false positive.
  3. False negatives need a check from your side. A bot that isn't recognised stays in the human reports, like the 30 missed bots in the example. A sudden spike of very short, single-page sessions from one source or location in Web analytics › Sessions is worth a closer look.
  4. Coverage depends on collection. With only the page script, TapCub sees bots that execute JavaScript; crawlers that don't run scripts need server records or log import to appear at all.

Sources

Was this explanation clear?

We use your answers to fix and expand this page.

Lucas Hayes

Data Engineer

Writes about event design, data quality, and collection workflows, with verifiable implementation methods for reliable analytics.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is the true positive rate in simple terms?

It is the share of real positives that get caught. If 200 sessions are bots and a filter flags 170 of them, the true positive rate is 170 ÷ 200 = 85%. The other 15% are false negatives that slip through as if they were humans.

Is true positive rate the same as recall and sensitivity?

Yes. Recall is the machine-learning name, sensitivity the medical one, and hit rate or probability of detection the signal-detection one. All are TP ÷ (TP + FN). In hypothesis testing the same quantity is called statistical power.

What is the difference between true positive rate and precision?

They share the numerator but not the denominator. TPR divides true positives by all actual positives (how many were caught); precision divides them by all predicted positives (how many flags were right). In the bot example TPR is 85.0% and precision is 94.4%.

What is a good true positive rate?

It depends on the cost of misses versus false alarms. A cheap retention email can tolerate a low threshold with high TPR and many false positives; an expensive discount needs a higher threshold, lower TPR and higher precision. Judge TPR together with the false positive rate at the chosen threshold.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics