Applied Credit Risk Modeling with R
A Step-by-Step Guide for Business, Finance, and Risk Analysts
Preface
This book is written for readers who want to close the gap between credit risk models, the logic behind those models, and the code required to implement them. The aim is to keep intuition, mathematical structure, data analysis, graphical interpretation, and reproducible R code in the same conversation.
The style is deliberately explicit. Credit risk work depends on many small choices: how a default variable is coded, how a model threshold is selected, how a probability is interpreted, how a portfolio loss is simulated, and how a result becomes a lending or risk management decision. For that reason, the book treats code as part of the explanation. Each step is meant to explain what is being computed, why the computation is needed, and where its limitations are.
The organizing principle follows the literate programming spirit of Knuth (1984). The code is not included only to show commands. It is included because a reader should understand what the computer is being asked to do, why that operation is useful for the credit-risk problem, and how the numerical output should be read. The book remains under active revision, with the emphasis on clarity, reproducibility, and practical interpretation.
What’s new in this edition
- Credit-scoring workflow: Chapter 1 now connects logistic PDs with cutoff rules, bad rates, calibration, ROC/AUC, Brier score, and a simple lending payoff exercise.
- Tree-based benchmark: Chapter 2 compares logistic regression, a single tree, and XGBoost using the same test set and the same credit-policy metrics.
- Merton model rebuild: Chapter 3 now gives a fuller risk-neutral valuation bridge, replicates Hull’s equations, checks the numerical solution, and links equity to a call payoff on firm assets.
- Credit-spread bridge: Chapter 4 now connects default probabilities with corporate bond spreads, recovery assumptions, and CDS valuation.
- Portfolio credit risk: Chapter 5 now builds the Gaussian copula model around Hull Example 24.7, correlated defaults, portfolio losses, concentration risk, and capital.
- Tail-risk extension: The final Chapter 5 sections compare Gaussian and t-copula assumptions and connect the simulation logic to Credit VaR, expected shortfall, and economic capital.
- Climate credit risk: Chapter 6 now uses public NGFS/CLIMACRED scenario data to connect climate-adjusted PDs with expected loss, sector contributions, spread adjustments, CDS-style compensation, and simulated portfolio losses.