Articles

How do you calculate PD from a logistic regression model?

A logistic regression credit model gives a probability of default in three exact steps, and each answer on the application can be read as an odds ratio rather than a change in percentage points.

To turn a logistic regression into a probability of default, add the intercept to each coefficient times the applicant's input, which gives the log-odds of default z, then take PD = 1 / (1 + e−z). On the small-business scorecard of Machine Learning for Finance, an applicant in construction with no county court judgment has z = −2.8324, so the PD is 5.56 per cent, a score of 568.85. Change one answer, a judgment in the last twelve months, and the same arithmetic gives 21.29 per cent.

Worked in full in Machine Learning for Finance by Julian R. Sterling, with every figure reproduced in a free workbook.See the book on Amazon →

Why the step is worth doing by hand

Every credit model eventually has to answer one applicant at a time: the credit committee asks why a case was declined, the validator asks for a reperformance, the regulator asks for an explanation in words. A logistic regression is the one model where that answer is an exact sum you can write on a page. The three things that go wrong are all in the last step: reading the odds as the probability, reading a coefficient as a change in PD, and forgetting which population the intercept belongs to.

The model and the applicant

The book's card has seven characteristics, each coded as a weight of evidence, WoE = ln(share of goods / share of bads), as worked in how to calculate weight of evidence and information value. The regression predicts the log-odds of default, so the coefficients on a WoE input come out close to −1: a bin with more goods than average pushes the log-odds of default down.

Intercept −2.69832; development sample of 6,000 loans, 379 bads
CharacteristicApplicant's binCoefficientWoECoef × WoE
Age of business24-47 months−1.00210.1013−0.1015
Debt service cover1.25-1.49−1.08900.1062−0.1157
Net debt / EBITDA2.50-3.49−0.99340.0574−0.0570
SectorConstruction−1.0810−0.28780.3111
Worst CCJNone−1.03510.2693−0.2788
Bank conduct score50-64−1.1475−0.07910.0908
Loan to value0.60-0.74−1.1686−0.01460.0171
Intercept plus the seven terms: log-odds of default, z−2.8324

The case and its 8,400 applications are fictional; the coefficients are the ones carried in the book's workbook.

The calculation, step by step

1. Linear predictor: z = −2.69832 − 0.1015 − 0.1157 − 0.0570 + 0.3111 − 0.2788 + 0.0908 + 0.0171 = −2.8324

2. Odds of default: ez = e−2.8324 = 0.0589, one bad for every 16.99 goods

3. Probability: PD = odds / (1 + odds) = 1 / (1 + e2.8324) = 5.56%

4. On the points scale (20 points to double the odds, 600 at 50 to 1): score = 487.1229 − 28.8539 × z = 568.85

Excel, with coefficients in B2:B8, the applicant's WoE in C2:C8 and the intercept in B1: =1/(1+EXP(-(B1+SUMPRODUCT(B2:B8,C2:C8))))

Step 4 is the same number in another unit: the scorecard is a linear rescaling of z, which is why the factor and offset let you go from points back to a PD and forth again without loss.

What one answer does to the PD

Change one bin at a time and the term for that characteristic moves by its coefficient times the change in WoE. That shift multiplies the odds by eΔz, the odds ratio. It does not add a fixed number of percentage points to the PD.

The same applicant, one characteristic changed
ChangeΔzOdds ratioPDChange, ptsScore
Base applicant01.0005.56%0.00568.85
Worst CCJ 12-36 months ago0.99502.70513.74%+8.18540.14
Worst CCJ under 12 months1.52474.59421.29%+15.73524.85
Debt service cover under 1.000.73162.07810.90%+5.34547.74
Debt service cover 2.00 or more−0.90270.4052.33%−3.23594.90
Sector: manufacturing−0.73820.4782.74%−2.82590.15

A recent judgment is the single heaviest answer on the card: it costs 43.99 points and multiplies the odds of default by 4.594. How many percentage points that is depends entirely on where the applicant starts.

The same odds ratio of 4.594 applied at different starting PDs
Starting PDPD after a recent CCJChange, pts
1%4.43%+3.43
2%8.57%+6.57
5%19.47%+14.47
10%33.79%+23.79
20%53.46%+33.46

A reason code that says "a recent CCJ added 15 points of PD" is true for this applicant only. The stable statement is in odds or in score points: 4.594 times the odds, 43.99 points, whoever the applicant is.

The common mistakes

Takeaway

The card is rebuilt from counts, and every applicant rescored row by row from the points table, in the free workbooks for this case, with the seven coefficients and the intercept in the blank set for your own card.

Questions readers ask

How do you convert log-odds to a probability?

Probability = 1 / (1 + e to the power of minus the log-odds). A log-odds of default of -2.8324 gives odds of 0.0589, one bad for every 16.99 goods, and a probability of 0.0589 / 1.0589 = 5.56 per cent. In Excel the conversion is =1/(1+EXP(-z)); exp(z) alone is the odds, not the probability.

What does a logistic regression coefficient mean in credit scoring?

It is the change in the log-odds of default for a one-unit change in the input. For a weight of evidence input it sits near -1. Its effect on the odds is e to the power of coefficient times the change: moving from no CCJ to one under 12 months shifts the log-odds by 1.5247, which multiplies the odds by 4.594 whatever the applicant.

Why is the intercept of a WoE logistic regression close to the bad rate?

Because a weight of evidence of zero means an average bin, so an applicant with every WoE at zero is an average applicant. In the illustrative card the intercept of -2.69832 gives a PD of 6.31 per cent, against a development bad rate of 6.32 per cent, 379 bads in 6,000 loans. Score a population that defaults at 12.625 per cent and the intercept needs recalibrating.

Read the whole case

This article is one calculation from Machine Learning for Finance. The book takes the same case from first principles to the decision, chapter by chapter, and every figure it prints is a live formula in the free companion workbooks.

Get the book on Amazon →Free companion files

Also on Amazon UK · Amazon Germany · Amazon France · Amazon Canada

Also on this site

Reading guide: corporate finance, valuation and markets → · All 1340 articles →

If this book helped, or didn’t, a few lines on Amazon are worth more than they look: they are what the next reader goes on. Write a review. The workbook stays free either way.