Tutorials › Exam PA - Predictive Analytics › Separating Ranking Quality From Threshold Decisions

Exam PA · Comparative Modeling and Diagnosis · Tutorial 923 of 966

Separating Ranking Quality From Threshold Decisions

Learn to compare ranking performance separately from decisions at a threshold, and evaluate how prevalence and error costs affect which model is useful.

Advanced 10 min read

What You'll Learn

  • Calculate empirical ROC AUC by comparing event and non-event score pairs, including ties.
  • Build and interpret a confusion matrix at a stated score threshold.
  • Explain why AUC and threshold-based measures answer different questions.
  • Recalculate expected false-positive and false-negative counts under a different prevalence.
  • Compare models using an explicit cost for each type of classification error.

Why Ranking and Decisions Must Be Separated

A classification model can assign a score or estimated event probability to each case. Ranking asks whether cases that experience the event tend to receive higher scores than cases that do not. A threshold decision instead turns each score into a predicted class: scores at or above a chosen cutoff are called positive, and scores below it are called negative. These are related but distinct evaluations. A model can rank cases well yet perform poorly at a particular threshold, or a model with weaker overall ranking can be preferable at an operating threshold that better suits the decision.

This distinction matters when comparing hypothetical models that flag insurance applications for review, identify accounts likely to lapse, or predict whether a claim will require further investigation. The threshold reflects a decision rule; it is not automatically supplied by the model or by the data. A defensible comparison therefore states both the ranking measure and the threshold-based objective. The discussion below is aligned with the SOA Exam PA (Predictive Analytics) syllabus.

Definition: Let \(Y=1\) denote an event and \(Y=0\) a non-event, and let \(s\) be a model score for which larger values indicate greater predicted event risk. At threshold \(t\), predict positive when \(s\ge t\) and negative when \(s<t\). A true positive (TP) is an event predicted positive; a false negative (FN) is an event predicted negative; a false positive (FP) is a non-event predicted positive; and a true negative (TN) is a non-event predicted negative.

Ranking Quality: ROC AUC

The receiver operating characteristic (ROC) curve displays the true-positive rate against the false-positive rate as the threshold varies. At any threshold, the true-positive rate is \(TP/(TP+FN)\), and the false-positive rate is \(FP/(FP+TN)\). The area under the ROC curve, or AUC, summarizes ranking over the range of thresholds. It does not select a threshold or assign different consequences to the two types of error.

Definition: For a validation sample with \(n_+\) events and \(n_-\) non-events, empirical AUC is the proportion of event–non-event score pairs in which the event has the higher score, counting a tied pair as one-half:
$$ \mathrm{AUC} = \frac{\text{number of event scores greater than non-event scores} +0.5(\text{number of tied pairs})} {n_+n_-}. $$

Thus AUC can be interpreted as the probability that a randomly selected event receives a higher score than a randomly selected non-event, with half credit for a tie. An AUC of 0.5 corresponds to chance-level pairwise ranking in this interpretation; an AUC of 1 means every event–non-event pair is correctly ordered. AUC is not the fraction of observations classified correctly at a particular cutoff.

Worked Example: Comparing AUC With Decisions at One Threshold

In a hypothetical validation sample, four cases experienced an event and four did not. Model A assigned event scores \(0.95, 0.80, 0.70, 0.40\), while the non-event scores were \(0.85, 0.60, 0.30, 0.20\). Model B assigned event scores \(0.90, 0.75, 0.55, 0.35\), and the same four non-event scores. Calculate both AUCs, then compare decisions at threshold \(t=0.70\). Scores equal to the threshold are classified positive.

Method: count event–non-event pairs. Each model has \(4\times4=16\) pairs. For Model A, the event score \(0.95\) exceeds all four non-event scores, giving 4 wins. The score \(0.80\) exceeds \(0.60,0.30,0.20\), but not \(0.85\), giving 3 wins. The score \(0.70\) also exceeds \(0.60,0.30,0.20\), giving 3 wins. The score \(0.40\) exceeds \(0.30,0.20\), giving 2 wins. There are no ties, so the total is \(4+3+3+2=12\) wins and \(\mathrm{AUC}_A=12/16=0.75\).

For Model B, \(0.90\) exceeds all four non-event scores, giving 4 wins; \(0.75\) exceeds three, giving 3; \(0.55\) exceeds \(0.30,0.20\), giving 2; and \(0.35\) exceeds \(0.20\), giving 1. Therefore, there are \(4+3+2+1=10\) wins and \(\mathrm{AUC}_B=10/16=0.625\). Model A has the stronger pairwise ranking in this sample.

Now apply the threshold. For Model A, three event scores (\(0.95,0.80,0.70\)) are at least \(0.70\), so TP \(=3\) and FN \(=1\). Of the non-events, only \(0.85\) reaches the threshold, so FP \(=1\) and TN \(=3\). For Model B, two event scores (\(0.90,0.75\)) reach the threshold, so TP \(=2\), FN \(=2\); again only the non-event score \(0.85\) reaches it, so FP \(=1\), TN \(=3\). At this threshold, Model A finds one more event with the same number of false alarms. The common mistake is to treat the AUC itself as a threshold decision or as accuracy; it is neither.

Why AUC Is a Pairwise Ranking Measure

The pair-count formula follows from the way the ROC curve accumulates correct ordering as the threshold moves downward. A non-event contributes a false-positive step when its score is passed; an event contributes a true-positive step. The area under the resulting staircase, using the usual half-step treatment of ties, is equivalent to counting the fraction of event–non-event pairs ordered correctly. Each of the \(n_+n_-\) pairs has equal weight, which gives the denominator in the empirical formula.

For example, if every event score is greater than every non-event score, all \(n_+n_-\) pairs are wins and AUC is 1. If every event score is lower, there are no wins and AUC is 0. If event and non-event scores are indistinguishable in their ordering, the expected fraction of wins, counting ties halfway, is 0.5. This justification also clarifies why changing a classification cutoff does not change AUC: AUC evaluates all score orderings, not just the decisions at one cutoff.

AUC does not directly use event prevalence: its pair comparisons are between event and non-event cases. In a population with unchanged event and non-event score distributions, a change in prevalence alone does not alter the population AUC. In finite validation samples, however, AUC estimates can vary because the numbers and composition of observed cases change. More importantly for decisions, prevalence affects how many positive and negative cases a fixed sensitivity and specificity produce.

Threshold Measures Depend on the Decision Setting

At a specified threshold, the confusion counts can be summarized with measures such as sensitivity, specificity, precision, and accuracy. Sensitivity is \(TP/(TP+FN)\); specificity is \(TN/(TN+FP)\); precision is \(TP/(TP+FP)\); and accuracy is \((TP+TN)/(TP+FP+FN+TN)\). Sensitivity and specificity describe performance conditional on the actual class. Precision and accuracy depend on the mix of events and non-events, as well as on the threshold.

A useful way to see the prevalence effect is to project a model's sensitivity and specificity to a population of size \(N\) with event prevalence \(\pi\). Assuming those conditional rates remain the same in the population, the expected counts are:

$$ TP=N\pi\,\mathrm{sensitivity},\qquad FN=N\pi(1-\mathrm{sensitivity}), $$
$$ TN=N(1-\pi)\,\mathrm{specificity},\qquad FP=N(1-\pi)(1-\mathrm{specificity}). $$

These are projections, not guarantees: they require the sensitivity and specificity to transport to the new population at the chosen threshold. In particular, a change in population or data collection can alter model performance, so the assumption should not be made silently.

Worked Example: Prevalence Changes the Threshold-Based Preference

Two hypothetical review rules are evaluated at fixed thresholds. Rule A has sensitivity \(0.80\) and specificity \(0.90\); Rule B has sensitivity \(0.70\) and specificity \(0.96\). Suppose each is applied to \(10{,}000\) cases, with these rates assumed to hold at both prevalences. A false positive has cost 1 unit and a false negative cost 10 units. Compare their expected error costs when prevalence is \(0.02\) and when it is \(0.20\).

At prevalence \(0.02\). There are \(10{,}000(0.02)=200\) events and \(9{,}800\) non-events. Rule A has \(TP=200(0.80)=160\), \(FN=200-160=40\), \(TN=9{,}800(0.90)=8{,}820\), and \(FP=9{,}800-8{,}820=980\). Its cost is \(980(1)+40(10)=1{,}380\) units.

Rule B has \(TP=200(0.70)=140\), \(FN=200-140=60\), \(TN=9{,}800(0.96)=9{,}408\), and \(FP=9{,}800-9{,}408=392\). Its cost is \(392(1)+60(10)=992\) units. At this low prevalence, Rule B has the lower projected cost.

At prevalence \(0.20\). There are \(2{,}000\) events and \(8{,}000\) non-events. Rule A has \(TP=2{,}000(0.80)=1{,}600\), \(FN=400\), \(TN=8{,}000(0.90)=7{,}200\), and \(FP=800\). Its cost is \(800+400(10)=4{,}800\) units. Rule B has \(TP=1{,}400\), \(FN=600\), \(TN=7{,}680\), and \(FP=320\). Its cost is \(320+600(10)=6{,}320\) units. At the higher prevalence, Rule A has the lower cost. The rates did not change, but the number of events did, changing the balance of missed events and unnecessary reviews.

The comparison is conditional on the stated cost units and stable rates. It does not establish which rule has higher AUC: sensitivity and specificity at one threshold are insufficient to determine ranking across all possible thresholds.

Error Costs Can Change the Preferred Model

Prevalence is only one part of the decision. If a false negative is much more consequential than a false positive, a rule with higher sensitivity may be preferred, even if it creates more false alarms. If the operational burden of a false positive is large, the reverse may hold. Define \(c_{FP}\) as the cost assigned to a false positive and \(c_{FN}\) as the cost assigned to a false negative. For a validation or projected population, the total error cost is

$$ C=c_{FP}FP+c_{FN}FN. $$

This calculation assumes that the specified costs are appropriate and that TP and TN have no additional cost in the comparison. If true-positive or true-negative outcomes also carry different benefits or expenses, those should be included in the decision objective. Threshold selection should follow the intended objective, rather than relying on a conventional cutoff without justification.

Worked Example: Error Costs Reverse the Preferred Rule

At a fixed prevalence of \(0.10\), compare the same hypothetical rules: A has sensitivity \(0.80\), specificity \(0.90\); B has sensitivity \(0.70\), specificity \(0.96\). There are 1,000 cases, and assume both rules' rates apply. Calculate their expected counts and compare them under two cost schemes.

There are \(1{,}000(0.10)=100\) events and 900 non-events. For A, \(TP=100(0.80)=80\), \(FN=100-80=20\), \(TN=900(0.90)=810\), and \(FP=900-810=90\). For B, \(TP=100(0.70)=70\), \(FN=30\), \(TN=900(0.96)=864\), and \(FP=36\).

Scheme 1: let \(c_{FP}=1\) and \(c_{FN}=10\). Then \(C_A=90(1)+20(10)=290\), while \(C_B=36(1)+30(10)=336\). Rule A is preferred because its higher sensitivity avoids enough costly false negatives to offset its additional false positives.

Scheme 2: let \(c_{FP}=1\) and \(c_{FN}=4\). Then \(C_A=90+20(4)=170\), while \(C_B=36+30(4)=156\). Rule B is now preferred. In general, A is less costly when \(90c_{FP}+20c_{FN}<36c_{FP}+30c_{FN}\), which simplifies to \(54c_{FP}<10c_{FN}\), or \(c_{FN}/c_{FP}>5.4\). At the first cost ratio, \(10>5.4\); at the second, \(4<5.4\). The threshold rules and prevalence are unchanged, but the cost assumptions reverse the decision.

Practical Comparison Sequence and Common Traps

1
Compare ranking on matched validation cases.
Use the same event definition and validation observations for each model. Report AUC as evidence about ordering, not as an operating decision.
2
State the threshold and its direction.
Specify whether scores at the threshold are positive. Recalculate TP, FN, FP, and TN from the actual scores or stated rates.
3
Translate rates to the relevant population.
Use the prevalence and population size to project counts, making the stability assumption explicit.
4
Apply the decision objective.
Compare costs or other stated consequences of the threshold-based outcomes. Do not infer those consequences from AUC alone.
  • Trap: calling AUC accuracy. AUC summarizes pairwise ranking across thresholds; accuracy is a classification proportion at a particular threshold.
  • Trap: overlooking prevalence. Even if sensitivity and specificity stay fixed, false-positive and false-negative counts, and therefore precision and total cost, can change with prevalence.
  • Trap: comparing costs without their units or assumptions. State the costs, population, prevalence, and whether the rates are treated as stable before recommending a rule.
  • Trap: treating a better AUC as an automatic decision winner. AUC does not encode the costs of errors, review capacity, or the chosen threshold. Those are separate parts of the decision.
Key takeaway: Ranking quality answers whether events tend to receive higher scores than non-events. A threshold decision answers which cases are classified positive and what consequences follow. Report and reason about these questions separately.

Check Your Understanding

For each problem, distinguish the requested ranking or threshold calculation and use the stated assumptions.

  1. A model gives scores \(0.80\) and \(0.50\) to two events, and \(0.70\) and \(0.20\) to two non-events. With no tied pairs, calculate empirical AUC. (Answer: \(3/4=0.7500\))
  2. In 500 cases, event prevalence is \(0.08\). A rule has sensitivity \(0.75\) and specificity \(0.90\). Calculate TP, FN, TN, FP, accuracy, and precision. (Answer: TP \(=30\), FN \(=10\), TN \(=414\), FP \(=46\), accuracy \(=444/500=0.8880\), precision \(=30/76=0.3947\))
  3. Two rules are applied to 1,000 cases with 10% prevalence. Rule A has sensitivity \(0.80\), specificity \(0.90\); Rule B has sensitivity \(0.70\), specificity \(0.96\). With false-positive cost 1 and false-negative cost 6, which has lower error cost? (Answer: A costs \(90+20(6)=210\); B costs \(36+30(6)=216\), so A is lower by 6 units.)
  4. Two event scores are \(0.90,0.60\), and two non-event scores are \(0.90,0.40\). Count a tied pair as one-half. What is empirical AUC? (Answer: \((0.5+1+1+0)/4=0.6250\))
  5. A rule has sensitivity \(0.80\) and specificity \(0.95\). Assuming these rates remain stable, project its confusion counts for 2,000 cases at prevalence \(0.05\). (Answer: TP \(=80\), FN \(=20\), TN \(=1{,}805\), FP \(=95\))
Clinical Biostats