You've built the scorecard. Here's the thing — the coefficients look clean. The AUC is sitting pretty at 0.78. Now someone — maybe your boss, maybe a regulator — asks the question that actually matters: "So what's the probability this borrower defaults?
That's where the formula lives. Not in the model summary. In practice, not in the ROC curve. In the actual translation from log-odds to a number a credit committee can stare at.
Let's walk through it properly.
What Is the Logistic Regression Probability of Default Formula
At its core, logistic regression doesn't predict default directly. It predicts the log-odds of default. That's a crucial distinction Most people skip this — try not to..
The formula you'll see in every textbook:
P(default) = 1 / (1 + e^(-z))
Where z = β₀ + β₁x₁ + β₂x₂ + ... + βₙxₙ
That's it. That's the whole thing. The rest is just plumbing Simple, but easy to overlook..
But here's what trips people up: z isn't a probability. It's the linear predictor — the weighted sum of your features plus the intercept. Consider this: it lives on the real number line, from negative infinity to positive infinity. The logistic function (that S-shaped curve) squashes it into the [0, 1] interval. That's your probability.
The logit link, in plain English
The logit is just the log of the odds:
log(p / (1-p)) = z
So when you exponentiate both sides, you get the odds:
p / (1-p) = e^z
Rearrange for p, and you're back to the first formula. Also, same math. Different lens.
In credit risk, we usually work with the log-odds because they're additive. 5 ≈ 1.Practically speaking, 5 to the log-odds. The probability? 65. Here's the thing — each feature shifts the log-odds by its coefficient. 4" means that flag adds 0.And 5 coefficient on "debt-to-income > 0. That said, multiply the odds by e^0. A 0.That depends on where you started.
Why It Matters / Why People Care
You might think: I have the score. Why do I need the formula?
Because scores aren't probabilities. A score of 620 means nothing to a loan pricing engine. Even so, it means nothing to IFRS 9 staging. It means nothing to a capital model that needs a 12-month PD.
Regulatory reality
Under Basel III, banks need point-in-time (PIT) probabilities of default — not through-the-cycle averages, not scores. Consider this: iFRS 9 and CECL require forward-looking, macro-conditioned PDs for expected credit loss calculations. Logistic regression gives you a clean, interpretable mapping from borrower characteristics to a calibrated probability.
But only if you actually calibrate it Worth keeping that in mind..
Portfolio decisions live on probabilities
- Pricing: Risk-based pricing needs a marginal PD to set spread
- Provisioning: Stage 1 vs Stage 2 hinges on lifetime PD shifts
- Capital: RWAs under IRB depend on calibrated PD, LGD, EAD
- Monitoring: Population stability index (PSI) tracks distributional drift in probabilities, not raw scores
If you skip the formula — or worse, treat the score as a probability — every downstream decision inherits that error.
How It Works: From Raw Coefficients to Calibrated PD
Let's break this into the steps that actually happen in production.
1. Estimate coefficients via maximum likelihood
You don't minimize squared error. You maximize the likelihood of observing your default/non-default labels given the model:
L(β) = ∏ pᵢʸⁱ (1-pᵢ)^(1-yᵢ)
Where yᵢ ∈ {0,1} and pᵢ = 1/(1+e^(-zᵢ))
Most software (Python's statsmodels, R's glm, SAS PROC LOGISTIC) handles this. But the optimization can fail — perfect separation, multicollinearity, or just flat likelihood surfaces. Check your standard errors. If they're huge, your coefficients are noise Not complicated — just consistent..
2. Compute the linear predictor for each borrower
z = β₀ + Σ βⱼ xⱼ
This is where feature engineering pays off. Continuous variables? Keep them continuous unless you have a strong reason to bin. Practically speaking, binning throws away information and creates cliff effects at bin boundaries. If you must bin (some regulators prefer it), use monotonic binning — WOE transformation — and document every cut Took long enough..
Categorical variables? Now, one-hot encode or use effect coding. Drop one level to avoid the dummy variable trap Not complicated — just consistent..
3. Apply the logistic transformation
p = 1 / (1 + exp(-z))
In code, this is one line. On top of that, in practice, watch for numerical overflow when z is very large (positive or negative). Most libraries handle this with a stable implementation.
def sigmoid(z):
if z >= 0:
return 1 / (1 + math.exp(-z))
else:
ez = math.exp(z)
return ez / (1 + ez)
4. Calibrate — this is where most models fail
Your raw logistic output is a rank-ordering tool. But the absolute probability values? The AUC tells you it separates defaulters from non-defaulters. Often wrong Easy to understand, harder to ignore..
Why? Three main reasons:
- Case-control sampling — you oversampled defaults to get enough 1s. The intercept is biased.
- Population drift — the training portfolio doesn't match the application portfolio.
- Time horizon mismatch — you modeled 12-month default but need lifetime PD (or vice versa).
Calibration techniques
Platt scaling — fit a logistic regression on your model's output scores. Simple, works well when you have enough validation data That's the whole idea..
Isotonic regression — non-parametric, monotonic calibration. More flexible, needs more data. Can overfit on small samples.
Beta calibration — three-parameter family that generalizes Platt. Handles skewed score distributions better.
Recalibration by intercept adjustment — if only the default rate shifted (same rank ordering), just adjust β₀:
β₀_new = β₀_old + ln(π_new/π_old) - ln((1-π_new)/(1-π_old))
Where π is the default rate. So this is the "prior correction" formula. Works when the covariate shift is only in the target prevalence Took long enough..
5. Validate calibration, not just discrimination
Plot calibration curves (reliability diagrams): bin predicted probabilities, plot actual default rate vs. That's why mean predicted probability per bin. The 45-degree line is perfect calibration The details matter here..
Compute Hosmer-Lemeshow test — but don't worship it. With large samples, it rejects trivial miscalibration. With small samples, it
…rejects trivial miscalibration. With small samples, it may fail to detect real problems. Instead, complement it with:
- Brier score – the mean squared error between predicted probabilities and observed outcomes; lower values indicate better overall calibration and discrimination.
- Calibration slope – fit a logistic regression of the outcome on the log‑odds of the predicted score; a slope of 1 and intercept of 0 denote perfect calibration. Deviations reveal over‑ or under‑fitting.
- Expected Calibration Error (ECE) – weighted average of absolute differences between observed and predicted frequencies across bins; useful when you need a single number to monitor drift over time.
- Maximum Calibration Error (MCE) – the worst‑case bin deviation, highlighting regions where the model is most misleading.
When you spot systematic miscalibration, return to the calibration step. So naturally, often a simple intercept adjustment (the prior correction) suffices if the covariate distribution is stable but the overall default rate has shifted. If the miscalibration varies across score ranges, consider Platt scaling or isotonic regression on a hold‑out set that mirrors the application population Still holds up..
Putting it all together – a practical workflow
- Data preparation – keep continuous variables continuous, encode categoricals wisely, and document any binning or WOE transformations.
- Model fitting – estimate β via maximum likelihood on the training sample (case‑control or otherwise).
- Initial scoring – compute z and apply the stable sigmoid to obtain raw probabilities.
- Calibration – on a validation set that reflects the target population, fit a calibration model (intercept shift, Platt, isotonic, or beta) and store its parameters.
- Validation – plot calibration curves, report Brier score, calibration slope, ECE, and MCE; check Hosmer‑Lemeshow only as a supplemental diagnostic.
- Deployment – apply the stored calibration parameters to new scores before using the probabilities for decision‑making, pricing, or capital allocation.
- Monitoring – schedule periodic recalibration checks; trigger a full model rebuild when calibration metrics deteriorate beyond pre‑defined thresholds.
Conclusion
Logistic regression remains a transparent, interpretable workhorse for credit risk, but its raw output is only a ranking tool. Trustworthy probability estimates demand deliberate feature handling, careful numerical implementation, and — most crucially — rigorous calibration and validation. By treating calibration as an integral modeling step rather than an afterthought, and by monitoring it with solid metrics such as the Brier score, calibration slope, and ECE, you confirm that the PDs you feed into downstream processes truly reflect the likelihood of default. This disciplined approach bridges the gap between statistical performance and business‑relevant risk measurement.