Correct credit model PDs after oversampling

Enter the sample and population bad rates to correct a model PD, the logistic intercept and scorecard points. Correct a whole score column from a CSV, too.

Your model

The sample bad rate is the share of bads in the data used to train the model after oversampling. The population bad rate is the share expected in the applications or loans it will score.

Correct a score column

The file is read in this browser and never sent anywhere.

Higher scores mean lower risk, as on a scorecard scaled with points to double the odds, and the page adds the points above to each score.

Corrected PD1.75%
Corrected intercept−3.578
Points to add+91.7

A PD of 30% from a model trained at a bad rate of 50% is 1.75% in a population with a bad rate of 4%.

The correction moves every log-odds by −3.178, the same amount for every case, so the ranking and the Gini stay as they were. On the scorecard, it is +91.7 points added to every score.

Your numbers

a = ln(4% ÷ 96%) − ln(50% ÷ 50%) = −3.178
ln(PD ÷ (1 − PD)) = ln(30% ÷ 70%) = −0.847
PD = 1 ÷ (1 + e^(4.025)) = 1.75%
b0 = −0.400 + (−3.178) = −3.578
20 ÷ ln 2 × (3.178) = +91.7

Model PD and corrected PD

Correction No correction Your PD

When the sample has more bads than the population, every PD comes down, with small PDs coming down the most in relative terms. The order of the cases stays as it was.

Corrected PDs

Model PDCorrected PD
1%0.042%
2%0.085%
5%0.219%
10%0.461%
20%1.03%
30%1.75%
40%2.70%
50%4%
70%8.86%
90%27.27%

Correction method

Oversampling the bads changes only the model's intercept. The correction is one number added to every log-odds, worked out from the two bad rates.

r1 = Population bad rate, r0 = Sample bad rate
Shift: a = ln[r1 ÷ (1 − r1)] − ln[r0 ÷ (1 − r0)]
PD = 1 ÷ (1 + e^−(ln(PD ÷ (1 − PD)) + a))
b0 = b0 + a
PDO = Points to double odds
Points per doubling = PDO ÷ ln 2
Points to add = −(PDO ÷ ln 2) × a

The correction applies to a logistic regression or scorecard trained on a sample where bads and goods were each kept at random at different rates. If the sample was chosen by another factor, such as a period or product, calibrate its PDs on the population instead.

Adjust probabilities for oversampling

Oversampling changes the share of bads in the data used to train a model. Enter the sample bad rate, the population bad rate and a model PD to calculate the corrected PD.

The correction also gives the adjusted intercept and the points to add to every score on a scorecard. Use the results to put the model's PDs on the population bad rate when the sample was formed by keeping bads and goods at random at different rates.

Common questions

How do I adjust probabilities for oversampling?

Use the sample and population bad rates to calculate a shift in log-odds. Add that shift to the model's log-odds to get the corrected PD.

How do I correct a logistic regression intercept after oversampling?

Calculate the shift from the sample and population bad rates. Add it to the model's intercept.

Why are my model's PDs too high after oversampling?

Oversampling changes the share of bads in the training sample. When bads were kept at a higher rate than goods, the model's PDs can be too high for the population it scores.

What is prior probability correction?

It adjusts a model's PDs from the sample bad rate to the population bad rate. For random sampling of bads and goods at different rates, the correction shifts every log-odds by the same amount.

How do I calculate a scorecard offset after oversampling?

First calculate the log-odds shift from the two bad rates. Convert it to score points using the scorecard's points to double the odds, then add those points to every score.