Module credit
Expand description
Portfolio credit loss models: the one-factor Gaussian and double-t
copulas (Copula) and the large-homogeneous-pool (LHP) expected tranche
loss. The formulas below are the Gaussian’s; the double-t replaces Φ by
the unit-variance t CDFs of the factor and the names, and Φ⁻¹ by the
inverse of the latent variable’s CDF, a convolution computed by
quadrature.
Xᵢ = √ρ·M + √(1−ρ)·εᵢ default ⇔ Xᵢ < C = Φ⁻¹(PD(t))
p(t|m) = Φ((C − √ρ·m)/√(1−ρ)) conditional default probability
L(t|m) = LGD · p(t|m) LHP pool loss fraction
ETL(t; A, D) = ∫ min(max(L(t|m) − A, 0), D − A) φ(m) dmEverything is computed in the mode over a fixed factor quadrature grid, so a reverse pass yields the sensitivities of an expected tranche loss to every survival pillar it read. The normal functions are written in the mode too — West’s CDF is polynomial and exponential arithmetic — rather than linearised at a passive point, so every order of derivative is the function’s own.
Structs§
- DoubleT 🔒
- The double-t copula’s two unit-variance t distributions.
- NuLifts 🔒
- The two distributions’ ν-lifts, built only when the degrees of freedom are marked.
Enums§
- Copula
- The one-factor copula a portfolio credit product prices under: how the
names’ latent variables
Xᵢ = √ρ·M + √(1−ρ)·Zᵢare distributed. - Panel 🔒
- A piece of the factor line the double-t integrates over.
- Recovery
Model - How a tranche’s pool recovers from a default under the one-factor Gaussian copula.
Constants§
- BULK 🔒
- The first rung of the geometric ladder past the bulk.
- CUTS 🔒
- Where a window about a centre is cut, in its scale: the factor’s bulk
about zero at scale one, a name’s transition about
C/√ρat√(1−ρ)/√ρ. - FACTOR_
BOUND 🔒 - Integration bound:
|m| ≤ 8captures the normal density to ~1e-15. - FACTOR_
NODES 🔒 - Quadrature order for the common-factor integral.
- PANEL_
NODES 🔒 - Gauss–Legendre order on each panel of the double-t’s factor integral.
- SQRT_
2PI 🔒
Functions§
- amraoui_
hitier_ 🔒marginal - The Amraoui–Hitier conditional loss as the constant-recovery LHP’s:
(1 − R̃)·Φ((Φ⁻¹(pd') − √ρ·m)/√(1 − ρ))is the loss of a pool with default probabilitypd' = pd·(1 − R̄)/(1 − R̃)and loss given default1 − R̃. Generic in the floor so its sensitivities read in the mode. - basket_
survival_ 🔒marked basket_survival_probabilitywith the double-t’s degrees of freedom lifted bymarks: the thresholds, the names’ conditional probabilities and the factor’s weights carry their ν-derivatives, the value unmarked.marksis ignored under the Gaussian.- basket_
survival_ probability P(fewer than n defaults by t)for a finite basket under a one-factor copula: at each factor node the constituents’ conditional default probabilities feed a Poisson-binomial recursion truncated atn, and the lower tail integrates over the factor. Heterogeneous marginals are the point — eachpdis typically read off its own survival curve.- basket_
tail 🔒 Σ wᵢ·P(N < n | mᵢ)over a factor grid, the conditional count distribution by the Poisson-binomial recursion truncated atn.- capped_
loss 🔒 - The LHP expected capped loss
E[min(L, K)],L = lgd·p(M). - conditional 🔒
- The conditional default probability at factor
m. - expected_
tranche_ loss - The LHP expected tranche loss
E[min(max(L − A, 0), D − A)]as a pool-loss fraction, for unconditional default probabilitypd, loss given defaultlgdand asset correlationrho, undercopula. Zero whenpd ≤ 0. - expected_
tranche_ 🔒loss_ marked expected_tranche_losswith the double-t’s degrees of freedom lifted bymarks: the value is the unmarked one, the ν-derivatives the model’s.marksis ignored under the Gaussian.- factor_
grid - The factor grid,
(m, w·φ(m))pairs:Σ wᵢ·f(mᵢ) ≈ ∫ f(m)·φ(m) dm. - finite_
pool_ tranche_ loss - The expected tranche loss
E[min(max(L − A, 0), D − A)]of a finite homogeneous pool ofnamesidentical names under the Gaussian copula, as a pool-loss fraction: at each factor node the number of defaults is binomial on the conditional default probability, the tranche loss is its expectation over that distribution — each name losinglgd / names— and the factor integrates on the same grid as the large pool. This is exact for a homogeneous pool, and the large pool is its limit. - gauss_
hermite 🔒 - Gauss–Hermite nodes and weights for a standard normal:
Σ wᵢ·f(xᵢ) ≈ E[f(Z)], the weights summing to one. The roots of the physicists’ Hermite polynomial by Newton iteration on its orthonormal recurrence, seeded from the largest root inward, then rescaled to the normal density. - gauss_
legendre 🔒 - Gauss–Legendre nodes and weights on
[−1, 1]by Newton iteration on the Legendre recurrence. - inv_
norm_ cdf - The inverse standard-normal CDF: Acklam’s approximation at the passive
value, then the inverse’s Taylor series about it written in the mode, to
third order in
u = (p − Φ(x₀))/φ(x₀): - inv_
norm_ 🔒cdf_ f64 - Acklam’s rational approximation of
Φ⁻¹, passive; polished byinv_norm_cdf. - loadings 🔒
(√ρ, √(1 − ρ)), checked against[0, 1).- norm_
cdf - The standard-normal CDF by West’s double-precision algorithm, in the mode.
- panel_
rule 🔒 - Gauss–Legendre nodes and weights on
[−1, 1]for one panel. - tail_
scale 🔒 - The tail map’s scale from a start point
a: the distance to the origin, so the map’s first nodes sit at the start’s own scale. - to_f64 🔒
- A small count as a float — exact for every grid size in play.
- unit_
grid 🔒 - Gauss–Legendre nodes and weights on
[−1, 1]for the smooth piece of the capped loss.
Type Aliases§
- DofMarks 🔒
- A double-t copula’s degrees of freedom as market inputs: the moves
(Δν_factor, Δν_idiosyncratic)off the passive point theCopula::StudentTstates, each zero-valued and carrying the lifted mark’s derivatives.