Credit Portfolio Risk (2D)

Simulate thousands of loan portfolios with one hidden systemic factor: expected loss, unexpected loss, value-at-risk and the Basel capital charge in one picture.

Run

Layers

Numerical checks

The science

Expected loss

Each loan has a probability of default PD, a loss given default LGD and an exposure EAD: EL = PD · LGD · EAD. A bank prices this in; it is the average loss, not the risk.

One-factor model (Vasicek)

Borrower i defaults when its asset value Ai = √ρ Z + √(1-ρ) εi falls below Φ-1(PD), where Z ~ N(0,1) is the shared economy and εi is idiosyncratic. Given Z, defaults are independent with PD(Z) = Φ((Φ-1(PD) - √ρ Z)/√(1-ρ)).

Loss distribution

For a large homogeneous portfolio the loss fraction has the closed-form CDF P(L ≤ x) = Φ((√(1-ρ) Φ-1(x/LGD) - Φ-1(PD))/√ρ) and quantile VaRα = LGD · PD(-Φ-1(α)). The Basel IRB capital charge is the unexpected loss K = VaR99.9% - EL; the regulatory correlation is ρ(PD) = 0.12 w + 0.24 (1-w) with w = (1-e-50 PD)/(1-e-50).

Honest simplifications

Constant LGD and PD, no maturity or rating migration, Gaussian copula (it understates joint extreme defaults compared with 2008), one factor, no recovery uncertainty; the Monte Carlo has finite portfolio size and, when concentration is on, unequal exposures, so it exceeds the infinite-granularity formula. Educational model, not a regulatory calculator or financial advice.

scenarios0
latest loss-
systemic Z-
defaults-
EL-
VaR-
-
Conditional default rate vs systemic factor Z
Capital charge K (%) vs PD (%): current ρ, Basel ρ(PD), ρ=0
Running mean loss (%) vs expected loss
Loss CDF (loss %): analytic vs simulated