Technical document

The mathematics of the measurement

Everything the engine computes, written out. Every symbol below corresponds to a field you can see in the workspace, and every equation to a column in the month-by-month schedule that opens when you click a facility.

Contents
  1. Notation
  2. The measurement identity
  3. Staging and the measurement horizon
  4. Probability of default
  5. The forward-looking adjustment
  6. Loss given default
  7. Collateral
  8. Exposure at default
  9. Facilities already in default
  10. Scenario weighting and the overlay
  11. The estimators
  12. Properties the implementation guarantees

1. Notation

One facility i is measured at one reporting date over months m = 1, 2, … H. Every quantity below is per facility unless stated otherwise; the portfolio figure is the sum over facilities, never a rate applied to a total.

SymbolMeaningWhere it comes from
BDrawn balance at the reporting dateLoan book
UUndrawn commitmentLoan book
cCredit conversion factor, 0 ≤ c ≤ 1Loan book or assumption
E0Exposure at default at the reporting dateDerived
NRemaining contractual term in monthsLoan book
HMeasurement horizon in monthsDerived from the stage
rEffective interest rate, per annumLoan book
dDays past dueLoan book
h(m)Conditional (hazard) probability of default in month mPD term structure
S(m)Probability of surviving to the start of month mDerived from h
q(m)Marginal (unconditional) probability of defaulting in month mDerived
LLoss given default, after collateral and costsDerived
Unsecured loss rateAssumption or calibration
πsProbability weight of scenario sAssumption
αs, βsScenario multipliers on default probability and on loss rateFitted or assumption
ωManagement overlay rateAssumption, approved

2. The measurement identity

The expected credit loss on a facility under one scenario is the present value of the loss expected in each month, summed over the horizon. A loss occurs in month m only if the facility survives to that month and then defaults; the amount lost is the exposure at that point multiplied by the loss rate; and the amount is discounted back at the facility’s own effective interest rate.

Expected credit loss under scenario s ECLs = Σm=1..H   qs(m) · Ls · E(m) · D(m)

where qs(m) is the marginal probability of defaulting in month m, Ls the loss given default, E(m) the exposure outstanding in that month, and D(m) the discount factor.

Each term is defined below. The four are multiplied month by month and never in aggregate: multiplying an average default probability by an average exposure by an average loss rate gives a different — and generally smaller — answer than summing the products, because the three are correlated across the life of a facility.

Survival and the marginal probability

The PD term structure supplies a conditional probability: the chance of defaulting in month m given that the facility has not defaulted before it. Converting that into the unconditional chance of defaulting in month m requires the survival function.

Survival S(1) = 1     S(m+1) = S(m) · (1 − h(m))
Marginal probability of default q(m) = S(m) · h(m)

The marginals over the horizon sum to the cumulative probability of default, which is the quantity the twelve-month or lifetime PD refers to:

Cumulative probability of default over H months PD(H) = Σm=1..H q(m) = 1 − Πm=1..H (1 − h(m))

Discounting

Losses are discounted at the effective interest rate of the facility, converted to a monthly rate. IFRS 9 requires the original effective rate, which is the rate at which the asset is carried; using a market rate would recognise a valuation change that is not a credit loss.

Discount factor D(m) = (1 + r/12)−m

3. Staging and the measurement horizon

The stage decides the horizon, and the horizon is the only thing the stage changes in the arithmetic. There is no separate Stage 2 formula: the same identity is summed over more months.

Horizon H = min(12, N)   for Stage 1      H = N   for Stages 2 and 3

The stage itself is the highest stage among the rules that fire, with one exception for probation:

Stage assignment stage = max { g(t) : tT, t fires },   or 1 if none fires

where T is the set of active rules and g(t) is the stage that rule t assigns. If the result is Stage 1 but the facility cured within the probation period P, the stage is set to 2 instead.

The rules currently defined:

RuleFires whenAssigns
Default indicatorthe source record is flagged as in defaultStage 3
Written offthe facility has been written off in whole or partStage 3
Days past due — defaultdθD (default backstop)Stage 3
Days past due — significant increasedθS (significant-increase backstop)Stage 2
Restructuringthe facility has been restructured in distressStage 2
Watchlistan early-warning flag is setStage 2
Relative lifetime PDPDnow / PDoriginationkStage 2
The last two are defined but inactive: each needs a field the loan book does not carry. They are shown rather than removed, so the gap is visible and the rule works the day the data arrives. The relative-PD test is the primary test in the standard, of which the days-past-due backstop is only a rebuttable presumption — so operating without it means the presumption is carrying more weight than it was designed to.

Probation after cure

A facility that stops meeting the default criteria does not return immediately to a twelve-month basis. Writing u for months since cure and P for the probation period:

Probation if stage = 1 and u < P   then stage ← 2

Without this, a facility that cured on the last day of the reporting period would be measured on a twelve-month basis on that day, and the staged population would swing on the timing of a single payment.

4. Probability of default

The engine consumes a monthly hazard, not an annual rate. Two forms are supported.

A flat anchor

Where no curve has been fitted, an annual probability p is converted geometrically to a constant monthly hazard:

Flat anchor h(m) = 1 − (1 − p)1/12   for all m

This recompounds exactly: applying the identity above for twelve months returns p. But a constant hazard assigns the same probability to every facility in a group and to every month of its life, so it carries no information about when risk arises and cannot rank one facility against another. A book measured this way will show a Gini coefficient of zero — not because the statistic is broken, but because a flat rate has nothing to discriminate with. The workspace labels such a measurement as anchored rather than calibrated.

A fitted hazard

The alternative is to fit the shape from history. Default counts by months on book give an empirical hazard directly:

Empirical hazard ĥ(m) = Dm / Rm

where Dm is the number defaulting in month m on book and Rm the number still at risk at its start.

A parametric form is then fitted to that empirical curve so it can be extrapolated beyond the observed window. The Weibull hazard is used because it can rise or fall with age according to a single shape parameter:

Weibull hazard h(m) = (k/λ) · (m/λ)k−1

k < 1 gives a falling hazard — risk concentrated early in the life of a facility, the usual shape in development lending. k > 1 gives a rising hazard. k = 1 is the memoryless case, in which a term structure adds nothing over an anchor. Parameters are chosen to minimise the squared deviation from the empirical hazard.

5. The forward-looking adjustment

A loss allowance must reflect what is expected, not only what has happened. The link is estimated in two steps: fit the relationship between observed default behaviour and the economy, then evaluate it at a forecast.

Fitted relationship yt = β0 + β1 x1,t−ℓ + β2 x2,t + εt

yt is the observed default rate in month t; x1 and x2 are the economic drivers; is a lag, because default responds to the economy with a delay.

The multiplier applied under scenario s is the default rate the fitted relationship predicts at that scenario’s forecast, relative to the long-run average:

Scenario multiplier αs = ŷ(xs) / ȳ

and it is applied to the monthly hazard, not to an annual rate before conversion:

Adjusted hazard hs(m) = min( h(m) · αs,   0.999999 )
Where αs = 1 the two orders of operation are identical. Where it differs they differ in the second order, because scaling a hazard and then compounding is not the same as compounding and then scaling. Applying the multiplier to the hazard means the adjustment acts on the shape of the term structure rather than on a single summary number, which is the point of having a term structure at all.

6. Loss given default

The loss rate is estimated from what was actually recovered on facilities that did default. Recoveries arrive over a workout lasting years, so incomplete cohorts must be developed to their ultimate value before they can be compared with complete ones.

Development to ultimate

Let Ci,j be the cumulative recovery on cohort i after j development periods. The development factor from period j to j+1 is the volume-weighted ratio across every cohort observed at both:

Development factor fj = ( Σi Ci,j+1 ) / ( Σi Ci,j )
Ultimate recovery for an incomplete cohort Ĉi,∞ = Ci,j · Πk≥j fk

The loss rate

Ultimate recoveries are discounted back to the date of default at the original effective rate, and costs are applied separately so that the effect of security and the effect of cost can each be seen:

Workout loss given default L = [ E − Σ Rt (1 + r/12)−t + κ E ] / E

Rt is the recovery received t months after default and κ the total workout cost rate. Recovering the same cash later is a real loss: the discount term is what measures it.

7. Collateral

Security reduces the loss, but only what can be realised and only when it can be realised. For each item of security j with valuation Vj, haircut γj and expected months to realisation τj:

Recoverable from security G = Σj : enforceable Vj (1 − γj) (1 + r/12)−τj
Effective loss given default Ĝ = min(G, E0)    L = min( [ (E0Ĝ) · + κ E0 ] , E0 ) / E0

Three properties are enforced rather than assumed:

8. Exposure at default

Exposure at the reporting date E0 = max(B, 0) + max(U, 0) · c

A negative balance — a customer in credit — is floored at zero: a customer in credit carries no credit exposure. The original value is retained so the import rules can report it rather than have it silently disappear.

Exposure is then projected forward over the horizon. Where the loan book carries a contractual repayment schedule that schedule is used; where it does not, exposure amortises straight-line:

Exposure in month m E(m) = E0 · max(Nm + 1, 0) / N
Straight-line amortisation is a limitation of the data, not a modelling preference. An amortising loan repays principal more slowly at the start than a straight line implies, so this understates exposure in early months and overstates it later. Extending the extract to carry the repayment schedule removes the approximation entirely.

9. Facilities already in default

For a credit-impaired facility the loss is not in doubt — only its timing. The schedule collapses to a single certain loss discounted over the expected recovery lag λ:

Stage 3 ECL = E0 · L · (1 + r/12)−λ

with h(m) = 1: the probability of default on a facility that has already defaulted is one, and the workspace checks that this is so on every such facility rather than assuming it.

10. Scenario weighting and the overlay

The whole book is measured under each scenario and the results are probability-weighted. Weighting happens after each facility has been capped at its own exposure, so a facility cannot be pushed above its balance by the downside.

Probability-weighted expected credit loss ECLmodelled = Σs πs · ECLs     with Σs πs = 1
Reported allowance ECL = ECLmodelled · (1 + ω)

The weights must total exactly one; the measurement refuses to validate otherwise. The overlay ω is zero unless positively decided, and a run that applies one without a named approver fails its checks.

This is also why sensitivity is a re-measurement, never a scaling. The identity is not linear in its inputs: exposure caps, collateral caps and stage-dependent horizons all bind. Scaling a reported figure by a stressed rate gives the wrong answer precisely in the scenarios that matter.

11. The estimators

Every estimate carries the diagnostics that say whether it should be used.

Ordinary least squares, with the tests that matter

Coefficients and their standard errors β̂ = (XX)−1 Xy     Var(β̂) = σ̂2 (XX)−1

Discrimination

Area under the curve, by ranks AUC = ( Σi ∈ bad rank(i) − nbad(nbad+1)/2 ) / ( nbad · ngood )     Gini = 2·AUC − 1

Ties take the average rank, so a model that assigns the same score to everything scores 0.5 — which is the correct answer for a model that does not discriminate, and is exactly what a flat PD anchor produces.

Calibration

Brier score, decomposed BS = (1/n) Σ (ioi)2 = reliability − resolution + uncertainty

reliability is calibration error and is better small; resolution is discriminating power and is better large; uncertainty is ō(1 − ō), a property of the sample and not of the model. The skill score is 1 − BS / uncertainty.

The decomposition matters. A Brier score computed against the sample’s own mean instead of against the predictions collapses to ō(1 − ō) — 0.25 at a 50% default rate, the metric’s maximum — and reports it as though it were a result. Comparing predictions to outcomes, and decomposing, is what makes the number mean anything.

Population stability

Population stability index PSI = Σb ( abeb ) · ln( ab / eb )

Below 0.10 no material shift; 0.10 to 0.25 moderate; above 0.25 the model is being applied to a different population from the one it was fitted on.

Segmentation

Weight of evidence and information value WoEb = ln( gb / bb )     IV = Σb ( gbbb ) · WoEb

gb and bb are the shares of performing and defaulted facilities in bucket b. Below 0.02 a variable carries no signal; above 0.5 it is worth asking whether it is restating the answer.

Variance decomposition of a grouping R2 = SSbetween / ( SSbetween + SSwithin )

A grouping earns its place by explaining variation in outcome between groups while leaving little unexplained within them. Grouping by delinquency scores highly on the first and tells you nothing, because delinquency is most of the definition of default: the groups are being defined by the answer.

12. Properties the implementation guarantees

These are not conventions. Each is enforced by the code and checked on every run.

PropertyWhy it mattersHow it is enforced
The engine is a pure function of its argumentsA figure that depends on a clock, a database or a configuration file cannot be re-derived laterThe measurement layer imports no framework and can reach no external state
Facilities are immutable once constructedTwo facilities with the same values are the same facility, and nothing can change one after it is measuredFrozen value objects with invariants enforced at construction
Row order cannot change the answerThe same book presented in a different order must fingerprint and measure identicallyFacilities are sorted by identifier before measurement; the fingerprint sorts before hashing
The fingerprint covers every field that can affect the resultA hash over a subset lets a materially different book look identicalThe field list is derived from the object definition, so a new field is covered automatically
Assumption sets are versioned and immutableA run’s stated assumptions must not be able to change after the runSaving over an existing version is refused; every change makes a new version
A run can be re-derived from its own inputsA figure that cannot be reproduced must not be the reported figureThe book is re-measured from the stored inputs and compared facility by facility to the last digit
A conclusion is derived from checks that ranA validation that reports a pass without executing anything is worse than noneA run with no checks reports not validated; the conclusion is computed from the results
A period locks only on three signatures and a reproductionSegregation of duties, and a figure proven re-derivable before it is fixedThree different people, three roles, and a successful reproduction are all required

Open the workspace   See it applied in the working paper