Lesson 9.3: Building an early warning score and trigger rules
Build an early warning score: define the target, fit a logistic model, convert it to points, read a gains table and compare cut-offs with trigger rules.
By the end of this lesson you will be able to define the target and the observation window for an early warning score, fit a logistic regression on account signals, read its odds ratios, turn the model into a points table that a collections officer can use, evaluate it with a gains table, and compare score cut-offs with simple trigger rules in terms of how many accounts they flag, how many defaults they catch and how many of the flags are right. You should have read Lessons 6.1 and 6.2 (logistic regression and score points), Lesson 7.1 (precision and recall) and Lesson 9.1 (signals). The arithmetic is logistic regression results, counts and percentages, and every figure comes from the synthetic book of 20,000 performing accounts introduced in Lesson 9.1.
Lesson 9.1 found signals, and Lesson 9.2 showed where stress builds in a portfolio. A lender cannot read seven signals on each of tens of thousands of accounts every month. It needs a score that combines them into one number per account, and rules that say which accounts need action. This lesson builds both, using the same tools as the application scorecard of Module 6, with some differences that come from the purpose: the population is existing borrowers, the outcome is near, and the cost of a false alarm and of a missed case are very different.
Step 1: Define the target and the window
An early warning score predicts something, and a precise definition comes first. Four choices need to be written down.
The population. Accounts that are performing at the observation date: not yet in default. Here, all 20,000 accounts are live, up to 30 days past due.
The observation date. The date at which the signals are measured. Each signal is measured over the last three months before this date.
The outcome window. The period after the observation date in which default is counted. Here it is six months: the target is "became more than 90 days past due within six months".
The target. A yes or no flag for each account. In the synthetic book, 992 of the 20,000 accounts, 4.96 per cent, had the flag.
Two guards against error apply. The signals must come only from before the observation date, or the score will learn from information it will not have when it is used. And the accounts that are already in default or already in collections at the observation date should be excluded, or treated separately, since there is nothing to warn about.
The window is a design choice. A short window (three months) gives sharper signals and fewer defaults to learn from. A long window (twelve months) gives more defaults but a blurrier relation. Six months gives time to act and enough events.
The 20,000 accounts were split at random: 14,000 to build the score and 6,000 to test it. The test set has 291 defaults, a default rate of 4.85 per cent.
Step 2: Three ways to combine the signals
There are three common approaches, from simplest to most flexible.
1. Count the signals. Add up how many of the seven signals an account shows. Simple and transparent, and the count of signals in Lesson 9.1 already separates well.
2. Weight the signals. Give each signal its own weight, found by a logistic regression, so that a salary stop counts for more than a minimum-due payment.
3. A flexible model. A boosted tree or a neural net, as in Lesson 6.3, which can find interactions and non-linear effects.
How do they compare on the test sample of 6,000 accounts? As in Lesson 7.2, the measure of how well the score ranks accounts is the AUC.
Score · AUC on the test sampleBest single signal (utilisation rise) · 0.666
Worst single signal (being past due) · 0.610
Count of signals · 0.876
Logistic regression on the seven signals · 0.880
Two lessons come from this table. Combining signals matters far more than any one signal. A single signal, even a strong one, ranks accounts only a little better than chance: its AUC is below 0.67 because it divides accounts into just two groups. The AUC of the count is 0.876. And a weighted score adds little to a simple count here, because the seven signals have similar strengths. In other data sets the weights would differ more, and the logistic score would earn its keep. In practice, many lenders start with a count, which collections staff can understand at once, and move to weights when the data support them. The rest of the lesson uses the logistic score because it also gives probabilities.
Step 3: The logistic early warning model
The model is the same as that of Lesson 6.1, with signals in place of weights of evidence. It predicts the log odds of default in the next six months as a sum:
> Log odds of default = intercept + b₁ × (signal 1) + b₂ × (signal 2) + … + b₇ × (signal 7)
where each signal is 1 if present and 0 if absent. Fitted on the 14,000 development accounts:
Term · Coefficient · Standard error · z-value · Odds ratioIntercept · −4.982 · 0.092 · −54.3 · 0.01
Bounce · 1.853 · 0.109 · 17.0 · 6.4
Utilisation rise · 1.574 · 0.098 · 16.0 · 4.8
Salary stop · 2.221 · 0.118 · 18.8 · 9.2
Minimum due only · 1.446 · 0.102 · 14.1 · 4.2
Enquiries · 1.512 · 0.105 · 14.4 · 4.5
Past due 1 to 30 days · 1.864 · 0.127 · 14.7 · 6.5
Other lender delinquent · 1.419 · 0.126 · 11.3 · 4.1
The odds ratio is e raised to the coefficient. It says by how many times the odds of default are multiplied when the signal is present and the other signals are held fixed. For the salary stop, the odds multiply by 9.2, and for the other lender delinquency by 4.1. All seven coefficients are positive and highly significant (z above 11), as they should be. The intercept of −4.982 corresponds to odds of 0.007, or a default probability of 0.7 per cent for an account with no signal at all, which matches the 0.7 per cent in the table of Lesson 9.1.
A subtle point lies in the difference between the odds ratios here and the lifts of Lesson 9.1. A bounce had a lift of 4.5 on its own, meaning that accounts with a bounce default 22.4 per cent of the time. But an account whose only signal is a bounce has a predicted default probability of just 4.2 per cent, about the book average. The reason is that bounces usually come with other signals. Accounts with one signal and no more defaulted at only 3.3 per cent, which is below the book average of 4.96. The danger lies in the combination. This is a main reason for building a score.
Predict first: an account shows a salary stop and a past-due status, and no other signal. Without computing, would you expect its probability of default to be closer to 6 per cent, 30 per cent or 70 per cent? Think about the odds ratios before reading on.
The log odds are −4.982 + 2.221 + 1.864 = −0.897, and the probability is 1 ÷ (1 + e^0.897) = 29.0 per cent. Two strong signals together lift the risk from a baseline of 0.7 per cent to 29 per cent, about 40 times the baseline, and nearly six times the book average of 4.96 per cent. Add a bounce and the figure is 72.2 per cent.
Step 4: A points table
A collections officer does not compute a logistic function. A lender turns the model into a table of points, in the way of Lesson 6.2. A simple version uses ten points for each 1.0 of log odds, so each signal's points are its coefficient times ten, rounded.
Signal · PointsSalary stop · 22
Bounce · 19
Past due 1 to 30 days · 19
Utilisation rise · 16
Enquiries · 15
Minimum due only · 14
Other lender delinquent · 14
The probability of default from a total of P points is 1 ÷ (1 + e^(4.982 − P ÷ 10)). Some totals:
Total points · Probability of default in six months0 · 0.7%
14 · 2.7%
19 · 4.4%
30 · 12.1%
40 · 27.2%
49 · 48.0%
60 · 73.5%
70 · 88.3%
An account with a bounce, a utilisation rise and minimum-due-only payments has 19 + 16 + 14 = 49 points and a default probability of about 48 per cent. (The exact model, with unrounded coefficients, gives 47.3 per cent.) An officer can add the points in her head, look up the row and decide.
Step 5: Evaluating the score with a gains table
The AUC is a single number. A lender wants to know what happens at the cut-offs it might use. A gains table shows, as accounts are ranked from the highest score downwards and flagged in groups, how many defaults are caught.
For the 6,000 test accounts, ranked by the model's probability and cut into tenths of 600 accounts:
Group of accounts · Defaults · Default rate in the group · Cumulative share of all defaults caughtTop 10% · 193 · 32.2% · 66.3%
10% to 20% · 35 · 5.8% · 78.4%
20% to 30% · 16 · 2.7% · 83.8%
30% to 40% · 14 · 2.3% · 88.7%
40% to 50% · 12 · 2.0% · 92.8%
50% to 60% · 4 · 0.7% · 94.2%
60% to 70% · 2 · 0.3% · 94.8%
70% to 80% · 4 · 0.7% · 96.2%
80% to 90% · 6 · 1.0% · 98.3%
90% to 100% · 5 · 0.8% · 100.0%
The defaults add to 291. The riskiest tenth of accounts contains 193 of them: 66.3 per cent of all defaults, with a default rate of 32.2 per cent, which is 6.6 times the average of 4.85 per cent. The lowest five tenths together have a default rate under 1 per cent. (Because the score takes only a limited number of distinct values, many accounts tie, particularly the large group with no signals, and the tenths in the lower half are not sharply distinguished.)
What matters operationally is the trade-off at each cut-off. If the lender flags the highest-scoring share of accounts, then for each share:
Share of accounts flagged · Accounts · Defaults caught · Precision (share of flags that default) · Recall (share of defaults caught) · Score threshold2% · 120 · 90 · 75.0% · 30.9% · 49% or more
3% · 180 · 121 · 67.2% · 41.6% · 39% or more
5% · 300 · 154 · 51.3% · 52.9% · 18% or more
10% · 600 · 193 · 32.2% · 66.3% · 12% or more
15% · 900 · 218 · 24.2% · 74.9% · 4% or more
20% · 1,200 · 228 · 19.0% · 78.4% · 4% or more
30% · 1,800 · 244 · 13.6% · 83.8% · 3% or more
The curves show the unavoidable trade-off of any alert system: recall rises and precision falls as the net widens. Lesson 9.4 picks the point on the curve by economics. Note that even at the 30 per cent level, recall is 83.8 per cent, not 100, because 8.4 per cent of defaults showed no signal at all and others show one that scores low.
Step 6: Rules compared with scores
Many lenders run on rules, not scores: "flag any account that bounces", "flag accounts with two or more risk signals". Rules are transparent and quick to put in place. It is worth comparing a few with the score on the same test sample.
Rule · Accounts flagged · Share of accounts · Defaults caught · Precision · RecallAny one signal · 2,537 · 42.3% · 266 · 10.5% · 91.4%
Two or more signals · 711 · 11.8% · 208 · 29.3% · 71.5%
Three or more signals · 195 · 3.3% · 127 · 65.1% · 43.6%
Past due or bounce · 707 · 11.8% · 144 · 20.4% · 49.5%
Salary stop or utilisation rise · 1,045 · 17.4% · 168 · 16.1% · 57.7%
Past due only · 315 · 5.3% · 76 · 24.1% · 26.1%
Score probability of 15% or more · 459 · 7.6% · 179 · 39.0% · 61.5%
Score probability of 10% or more · 711 · 11.8% · 208 · 29.3% · 71.5%
Study the comparison, because it teaches several things.
"Past due only", the standard rule in collections, flags 5.3 per cent of accounts and catches just 26.1 per cent of defaults. Its precision is fair (24.1 per cent), but it catches less than a third of the problem, and late, as Lesson 9.1 showed (median lead of one month).
"Any one signal" catches 91.4 per cent of defaults and flags 2,537 accounts, 42.3 per cent of the book. Only 10.5 per cent of those flags default. For a team that can review a few hundred accounts a month, this is a flood.
"Two or more signals" is a good middle: 11.8 per cent of accounts, 71.5 per cent of defaults and 29.3 per cent precision. It is identical in outcome to a score threshold of 10 per cent, since in this synthetic book an account with two or more signals gets a probability above 10 per cent and an account with one signal does not.
"Three or more signals" is sharp, with 65.1 per cent precision, and catches 43.6 per cent.
The score at 15 per cent catches 61.5 per cent of defaults at 39.0 per cent precision, a better balance than "past due or bounce" (49.5 per cent caught at 20.4 per cent precision).
Where the weights of the signals differ greatly, a score beats a count-based rule, because it can separate "one very strong signal" from "two weak ones". In this book the difference is small, and the simple rules do nearly as well. A pragmatic design uses the score for ranking and tiering and a few override rules for cases that must always be seen: for example, any account that is past due and has also stopped receiving salary, whatever its total.
Designing the trigger rules
A trigger rule says when an account is flagged and what happens. A good set has these features.
Tiers, not one threshold. Different probabilities call for different responses. Lesson 9.4 sets them out.
Hard overrides. A few events that always trigger action, such as a restructuring request, a returned cheque on the main account or a delinquency report from a major lender.
Suppression. Do not flag again an account that was reviewed last month and cleared, or one that is already in collections, unless something new has happened. Otherwise, the same accounts clog the queue.
Cooling-off and persistence. A one-month blip may not matter, and persistence over two months can raise a tier.
Capacity. The number of accounts flagged each month should fit the team's capacity, with some room for surges.
Review. Rules and weights are revisited at least yearly, with a record of why each was set.
Validation and refresh
An early warning score needs the same checks as any model.
1. Out-of-sample performance. The test sample's AUC of 0.880 is close to the development sample's 0.882, so there is no sign of overfitting. An out-of-time test on a later period is better.
2. Calibration. Do the predicted probabilities match the observed default rates in each band? (Lesson 7.5.)
3. Stability. Are the signals present at similar rates over time, by the CSI of Lesson 8.2?
4. Fairness. Do the signals or the score disadvantage any group for reasons unrelated to credit risk?
5. Drift. A signal's strength changes with the economy and with borrower behaviour. Refresh the weights at least annually, and sooner if monitoring shows a fall in precision.
6. Feedback. The act of intervening changes outcomes. An account that is rescued by early action is recorded as a non-default, and this can make the signals look weaker over time. Keep a control group that is flagged but not acted on, so that the score is measured on untreated outcomes (Lesson 9.4).
Building it in Python
The score, the points, the gains table and the rule comparison are short.
python
import numpy as np
import pandas as pd
import statsmodels.api as sm
from sklearn.metrics import rocaucscore
acc = pd.readcsv("accounts.csv") # seven 0/1 signals and default6m
signals = ["bounce", "utilrise", "salary", "mindue", "enq", "dpd", "other"]
train = acc.sample(frac=0.7, randomstate=1)
test = acc.drop(train.index)
X = sm.addconstant(train[signals])
model = sm.Logit(train["default6m"], X).fit(disp=0)
print(model.summary().tables[1])
print("odds ratios:\n", np.exp(model.params).round(1))
test = test.copy()
test["p"] = model.predict(sm.addconstant(test[signals]))
test["points"] = (test[signals] (model.params[signals] 10).round()).sum(axis=1)
test["count"] = test[signals].sum(axis=1)
print("AUC logistic", round(rocaucscore(test["default6m"], test["p"]), 3),
"count", round(rocaucscore(test["default6m"], test["count"]), 3))
gains table for the top k per cent
test = test.sortvalues("p", ascending=False).resetindex(drop=True)
totald = test["default6m"].sum()
for k in (0.02, 0.03, 0.05, 0.10, 0.15, 0.20, 0.30):
m = int(len(test) k)
caught = test["default6m"].iloc[:m].sum()
print(f"top {k:.0%}: flagged {m}, caught {caught}, precision {caught/m:.1%}, recall {caught/totald:.1%}")
rules
rules = {
"any one signal": test["count"] >= 1,
"two or more": test["count"] >= 2,
"three or more": test["count"] >= 3,
"past due only": test["dpd"] == 1,
"score >= 15%": test["p"] >= 0.15,
}
for name, flag in rules.items():
caught = test.loc[flag, "default6m"].sum()
print(f"{name}: flagged {flag.sum()} ({flag.mean():.1%}), precision {caught/flag.sum():.1%}, recall {caught/totald:.1%}")
Two points of care. Sorting by probability with many ties makes the "top k" depend on the order of ties, so for sharper comparisons use thresholds on the probability, or break ties at random. And always fit on the development sample and report on the test sample.
A worked example: choosing between a rule and a score
The head of collections has capacity to review 600 accounts a month in a book of 6,000, which is 10 per cent. She is offered three ways to pick them.
1. "Two or more signals". Flags 711 accounts, 111 more than capacity. Catches 208 defaults at 29.3 per cent precision. She would have to cut 111 accounts arbitrarily or add staff.
2. "Past due or bounce". Flags 707 accounts, also over capacity, and catches only 144 defaults at 20.4 per cent precision.
3. The top 10 per cent by score. Flags exactly 600, catches 193 defaults at 32.2 per cent precision.
Compare the first and third on 600 accounts: the score catches 193 defaults. Taking 600 of the 711 flagged by "two or more" at random would catch about 208 × (600 ÷ 711) = 175. The score is better by about 18 defaults, roughly 10 per cent more, for the same effort. And the score gives an order inside the list, so the team can work from the top and stop when time runs out. She chooses the score for ranking, with two overrides: any account with both "past due" and "salary stop", and any account that has asked for a restructuring, always goes to the top of the queue.
The decision did not hinge on the AUC. It hinged on what happens at her capacity.
Common mistakes
Using signals measured after the observation date. The score would learn from information it will not have.
Judging a signal in isolation. An account with one signal had a default rate of 3.3 per cent, below the average. The risk is in combinations.
Defining the window carelessly. State the population, the observation date and the outcome window.
Choosing rules without comparing them. Compare the flagged share, precision and recall of each.
Setting thresholds without regard to capacity. The number of flags must fit the team.
Forgetting suppression. The same accounts will otherwise reappear every month.
Not keeping a control group. Without untreated outcomes, success of the intervention hides the strength of the score.
Never refreshing. Signals drift. Re-fit and re-check at least annually.
Key takeaways
An early warning score predicts default in a fixed window (six months here) for performing accounts, from signals measured before the observation date.
Combining signals matters most. The best single signal had an AUC of 0.666, a count of signals 0.876 and a logistic score 0.880.
The logistic model gives odds ratios (salary stop 9.2, past due 6.5, bounce 6.4) and a points table that staff can use: 49 points corresponds to about 48 per cent probability of default.
Isolated signals are weak. The default rate was 3.3 per cent with exactly one signal, 15.8 per cent with two and 50.5 per cent with three.
A gains table shows the trade-off. Flagging the top 5 per cent catches 52.9 per cent of defaults at 51.3 per cent precision, and the top 10 per cent catches 66.3 per cent at 32.2 per cent.
Simple rules do well. "Two or more signals" flagged 11.8 per cent of accounts and caught 71.5 per cent of defaults, while "past due only" caught 26.1 per cent.
Use the score to rank and tier, add a few override rules, suppress repeat flags and fit the number of flags to capacity.
Check yourself
1. An account has an early warning log odds of −2.0. What is its probability of default?
1 ÷ (1 + e^2.0) = 1 ÷ 8.39 = 11.9 per cent.
2. A rule flags 500 of 5,000 accounts. 80 of the 250 defaults in the book are among them. What are its precision and recall?
Precision 80 ÷ 500 = 16 per cent. Recall 80 ÷ 250 = 32 per cent.
3. Why can an account with one strong signal have a modest predicted probability?
Signals tend to come together. Accounts whose only signal is one of them are different from those that show several, and their risk is lower than the lift of the signal alone suggests.
4. A collections team can review 300 accounts a month. How would you use the score?
Rank accounts by score and take the top 300 each month, adding any override cases, rather than using a rule that flags more accounts than can be handled.
5. Why keep a control group of flagged accounts that receive no action?
Successful interventions prevent defaults and so weaken the observed link between the score and default. An untreated group lets you keep measuring the score's true predictive power and the effect of the action.
Try this
Build a small early warning score. Set aside fifty to sixty minutes.
1. Take the book you built for Lesson 9.1, or invent one with at least 10,000 accounts, five to seven yes-or-no signals and a six-month default flag of about 5 per cent. Split 70 and 30.
2. Write the definitions of the population, observation date, signal window, outcome window and target in five lines.
3. Compute the AUC of each single signal, of the count of signals and of a logistic regression on the test sample. Draw a bar chart.
4. Print the odds ratios and convert the coefficients into points, ten points per unit of log odds. Compute the probability for three example accounts by hand and with the simulator.
5. Build the gains table for the top 2, 5, 10, 20 and 30 per cent, with precision and recall. Draw the two lines.
6. Compare at least four rules (any signal, two or more, past due only, a score threshold) on the share flagged, precision and recall.
7. Write a five-sentence recommendation: your tiering approach, the two override rules you would add, the number of accounts flagged at your assumed capacity, the share of defaults it would catch and one check to run before launch.
A good result is a score with odds ratios and points, a gains table, a rule comparison and a recommendation fitted to a stated capacity. Lesson 9.4 completes the module by turning the score into watchlists and tiers, and deciding how many accounts to flag by their economics.
Tags: Credit Risk Analytics Early Warning Score Trigger Rules Logistic Regression Gains Table