A Appendix Credit Model
A.1 Credit Model assumptions
The credit risk portfolio of Section 4 is based on the conditionally binomial credit model described in Section 11.2 of McNeil, Frey, and Embrechts (2015) which belongs to the family of mixture models. Specifically, we consider a portfolio that consists of three homogeneous subportfolios and denote the aggregate portfolio loss by \(L = L_1 + L_2+ L_3\), with \(L_1, L_2, L_3\) the losses of each subportfolio, given by
\[\begin{equation}
L_i=e_i\cdot\text{LGD}_i\cdot M_i,\quad i=1,2,3,
\end{equation}\]
where \(e_i\) and \(M_i\) are the exposure and number of defaults of the \(i^{\text{th}}\) subportfolio, respectively, and \(\text{LGD}_i\) is the loss given default of subportfolio \(i\). \(M_i\) is Binomially distributed, conditional on \(H_i\), a random common default probability. Specifically \(M_i|H_i \sim Binomial(m_i,H_i)\), where \(m_i\) is the portfolio size. The \(H_i\)s follow a Beta distributions with parameters chosen so as to match given overall unconditional default probabilities \(p_i\) and default correlations \(\rho_i\), that is, the correlation between (the indicators of) two default events within a subportfolio, see McNeil, Frey, and Embrechts (2015). The dependence structure of \((H_1,H_2,H_3)\) is modelled via a Gaussian copula with correlation matrix
\[\begin{equation}\Sigma = \begin{pmatrix}
1 & 0.3 & 0.1\\
0.3 & 1 & 0.4\\
0.1 & 0.4 & 1
\end{pmatrix}.\end{equation}\]
Table A.1 summarises the parameter values used in the simulation.
\(i\) | \(m_i\) | \(e_i\) | \(p_i\) | \(\rho_i\) | \(LGD_i\) |
---|---|---|---|---|---|
1 | 2500 | 80 | 0.0004 | 0.00040 | 0.250 |
2 | 5000 | 25 | 0.0097 | 0.00440 | 0.375 |
3 | 2500 | 10 | 0.0503 | 0.01328 | 0.500 |
A.2 Code for generating the data
set.seed(1)
library(copula)
nsim <- 100000
# counterparties subportfolio 1, 2 and 3
m1 <- 2500
m2 <- 5000
m3 <- 2500
# prob of default for subportfolios 1, 2 and 3
p1 <- 0.0004
p2 <- 0.0097
p3 <- 0.0503
# correlation between default probabilities
rho1 <- 0.0004
rho2 <- 0.0044
rho3 <- 0.01328
# exposures
e1 <- 80
e2 <- 25
e3 <- 10
# loss given default
LGD1 <- 0.25
LGD2 <- 0.375
LGD3 <- 0.5
# beta parameters: matching subportfolios default probabilities and correlation
alpha1 <- p1 * (1 / rho1 - 1)
beta1 <- alpha1 * (1 / p1 - 1)
alpha2 <- p2 * (1 / rho2 - 1)
beta2 <- alpha2 * (1 / p2 - 1)
alpha3 <- p3 * (1 / rho3 - 1)
beta3 <- alpha3 * (1 / p3 - 1)
# correlations between subportfolios
cor12 <- 0.3
cor13 <- 0.1
cor23 <- 0.4
# Gaussian copula structure
myCop <- normalCopula(param = c(cor12, cor13, cor23), dim = 3, dispstr = "un")
# multivariate beta with given copula
myMvd <- mvdc(copula = myCop,
margins = c("beta", "beta", "beta"),
paramMargins = list(list(alpha1, beta1),
list(alpha2, beta2),
list(alpha3, beta3)))
# simulation from the chosen copula
H <- rMvdc(nsim, myMvd)
# simulate number of default per subportfolios (binomial distributions)
M1 <- rbinom(n = nsim, size = m1, prob = H[, 1])
M2 <- rbinom(n = nsim, size = m2, prob = H[, 2])
M3 <- rbinom(n = nsim, size = m3, prob = H[, 3])
# total loss per subportfolio
L1 <- M1 * e1 * LGD1
L2 <- M2 * e2 * LGD2
L3 <- M3 * e3 * LGD3
# aggregate portfolio loss
L <- L1 + L2 + L3
# the credit data included in SWIM
credit_data <- cbind(L, L1, L2, L3, H)
colnames(credit_data) <- c("L", "L1", "L2", "L3", "H1", "H2", "H3")