normalCDF = x => {
const a1 = 0.254829592, a2 = -0.284496736, a3 = 1.421413741
const a4 = -1.453152027, a5 = 1.061405429, p = 0.3275911
const sign = x < 0 ? -1 : 1
const z = Math.abs(x) / Math.sqrt(2)
const t = 1.0 / (1.0 + p * z)
const y = 1 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.exp(-z * z)
return 0.5 * (1 + sign * y)
}Credit VaR and the Granularity Adjustment
Loss-rate VaR, granularity adjustment for finite portfolios, and dollar VaR with recovery under the Vasicek factor model
Inverting the Vasicek CDF at confidence level \(1 - p\) gives the loss-rate VaR (Vasicek 2002; Christoffersen 2012, chap. 12):
\[ VaR^{1-p} \;=\; \Phi\!\left(\frac{\sqrt{\rho}\,\Phi^{-1}(1-p) + \Phi^{-1}(PD)}{\sqrt{1 - \rho}}\right) \]
The infinite-portfolio assumption underlying this expression systematically understates true risk in finite portfolios. The granularity adjustment is a first-order correction in \(1/n\) (Gordy 2003):
\[ GAVaR^{1-p} \;=\; VaR^{1-p} \;+\; \frac{1}{n}\,GA(1 - p) \]
\[ GA(1 - p) \;=\; \tfrac{1}{2}\left[\frac{\sqrt{\tfrac{1-\rho}{\rho}}\,\Phi^{-1}(1-p) - \Phi^{-1}(VaR^{1-p})}{\phi\!\bigl(\Phi^{-1}(VaR^{1-p})\bigr)}\,VaR^{1-p}(1 - VaR^{1-p}) + 2\,VaR^{1-p} - 1\right] \]
With a constant recovery rate, the dollar VaR is:
\[ \$GAVaR^{1-p} \;=\; DV_{PF} \times (1 - RR) \times GAVaR^{1-p} \]
Inputs
Tip
How to experiment
Start with the defaults (the Christoffersen worked example: \(PD = 3\%\), \(\rho = 8\%\), \(n = 200\), \(DV = \$500\)M, \(RR = 40\%\), \(99\%\) VaR). Move to the Basel IRB region (\(\rho = 0.15\) to \(0.24\), \(1 - p = 99.9\%\)) and watch the dollar VaR jump. Drop \(n\) to 25 and observe how the granularity adjustment grows — small concentrated books are structurally riskier than the infinite-\(n\) formula suggests. Push \(PD\) down to 0.5% with \(\rho\) at 0.5 and hunt for the non-monotonic edge case where pushing \(\rho\) higher can slightly lower VaR.
Note
Regulatory context. The Basel II/III Internal Ratings-Based (IRB) formula uses exactly this VaR expression at \(1 - p = 99.9\%\) with prescribed \(\rho\) values (decreasing in PD between 0.12 and 0.24 for corporate exposures). Regulatory capital equals the unexpected loss component — the dollar VaR net of expected loss, which is already priced into loan spreads.
References
Christoffersen, Peter F. 2012. Elements of Financial Risk Management. 2nd ed. Academic Press.
Gordy, Michael B. 2003. “A Risk-Factor Model Foundation for Ratings-Based Bank Capital Rules.” Journal of Financial Intermediation 12 (3): 199–232.
Vasicek, Oldrich. 2002. “The Distribution of Loan Portfolio Value.” Risk 15 (12): 160–62.