5.8. Calculations For Each aggregate
Class
Objectives: Describe calculations performed by the Aggregate
, Portfolio
, Distortion
, and Bounds
classes.
Audience: Advanced users and programmers.
Prerequisites: DecL, general use of aggregate
, probability.
See also: API Reference, A Ten Minute Guide to aggregate.
Contents:
5.8.2. Aggregate
Class Calculations
Todo
Discussion to follow.
5.8.3. Portfolio
Class Calculations
A Portfolio
is a collection of Aggregate
objects. The class
computes the densities of each aggregate component as well as the sum,
and also computes the variables shown below.
These variables are central to many
allocation algorithms. All computations use FFTs to compute relevant
convolutions and surface integrals. \(X_i(a\) represents recoveries
to line \(i\) when total capital is \(a\) and lines have equal
priority. It is given by \(X_i(a) = X_i(X\wedge a) /X\): when
\(X \le a\) line \(i\) is paid in full and \(X_i(a)=X_i\)
and when \(X>a\) payments are a pro rata \(X_i/X\) share of
available assets \(a\). Hence expected recoveries are
emphasizing the importance of knowing \(\mathsf{E}[X_i /X \mid X]\).
Densities are computed using FFT in \(O(n\log(n))\) time.
Variable |
Meaning |
Computation |
Complexity |
---|---|---|---|
All lines combined |
|||
p_total |
Density of \(X=\sum_i X_i\) |
FFT Convolution |
|
exa_total |
\(\mathsf E[\min(X,a)]=\mathsf E[X\wedge a]\) |
Cumsum of \(S\) |
\(O(n)\) |
exlea_total |
\(\mathsf E[X \mid X\le a]\) |
||
exgta_total |
\(\mathsf E[X\mid X > a]\) |
||
By line |
|||
p_line |
Density of \(X_i\) |
FFT computation of aggregate using MGF |
|
exeqa_line |
\(\mathsf E[X_i \mid X=a]\) |
Conv \(xf_i(x)\), \(f_{\hat i}\) |
\(O(n\log(n))\) |
lev_line |
\(\mathsf E[\min(X_i,a)]=\mathsf E[X_i\wedge a]\) |
Cumsum of \(S_i\) |
\(O(n)\) |
e2pri_line |
\(\mathsf E[X_{i,2}(a)]\) |
Conv \(\mathsf E[X_i\wedge x]\), \(f_{\hat i}\) |
\(O(n\log(n))\) |
exlea_line |
\(\mathsf E[X_i \mid X\le a]\) |
Cumsum of \(E(X_i \mid X=x)f_X(x)\) |
\(O(n)\) |
e_line |
\(\mathsf E[X_i]\) |
||
exgta_line |
\(\mathsf E[X_i \mid X > a]\) |
Conditional expectation formula |
|
exi_x_line |
\(\mathsf E[X_i / X]\) |
Sum using conditional expectation |
|
exi_xlea_line |
\(\mathsf E[X_i/X \mid X \le a]\) |
Cumsum of \(\mathsf E[X_i\mid X=x]f_X(x)/x\) |
|
exi_xgta_line |
\(\mathsf E[X_i/X \mid X > a]\) |
Conditional expectation formula |
|
exa_line |
\(\mathsf E[X_i(a)]\) |
Conditional expectation formula |
|
epd_i_line |
\((\mathsf E[X_i]-\mathsf E[X\wedge a)]/\mathsf E[X_i]\) |
Stand-alone Expected Policyholder Deficit |
|
epd_i_line |
\((\mathsf E[X_i]-\mathsf E[X_i(a)]/\mathsf E[X_i]\) |
Equal priority EPD |
|
epd_i_line |
\((\mathsf E[X_i]-\mathsf E[X_{i,2}(a)]/\mathsf E[X_i]\) |
Second priority EPD |
For Total, All Lines \(X\)
Density \(f\) computed by convolving each individual line using FFTs.
\(F\) and \(S\) are computed from the cumulative sums of the density.
exa_total \(=\mathsf{E}[\min(X,a)]=\mathsf{E}[X\wedge a]\), also called lev_total for limited expected value, is computed as cumulative sums of \(S\) times bucket size. Note exa_total= lev_total.
exlea_total \(=\mathsf{E}[X \mid X\le a]\) is computed using the relation \(\mathsf E[X\wedge a]=\int_0^a tf(t)dt + aS(a)\) as
\[\mathsf E[X \mid X\le a]=\frac{1}{F(a)} \int_0^a tf(t)dt = \frac{\mathsf{E}[X\wedge a]-aS(a)}{F(a)}.\]When \(F(a)\) is very small these values are unreliable and so the first values are set equal to zero.
exgta_total \(=\mathsf{E}[X\mid X > a]\) is computed using the relation \(\mathsf{E}[X] = \mathsf{E}[X\mid X \le a]F(a) + \mathsf{E}[X\mid X > a]S(a)\). Therefore
\[\mathsf{E}[X\mid X > a] = \frac{\mathsf{E}[X]-\mathsf{E}[X\mid X \le a]F(a)}{/S(a)}.\]
For Individual Lines \(X_i\)
Density and distributions as for total.
exeqa_line \(=\mathsf{E}[X_i \mid X=a]=\kappa_i(a)\) can be computed efficiently using FFTs in the case \(X_i\) are independent. Without loss of generality \(X=X_i + \hat X_i\) where \(\hat X_i\) is the sum of all other lines (“not \(i\)”). Let \(f_x(x_i, \hat x_i)\) be the conditional density of \(X_i=x_i\), \(\hat X_i=\hat x_i\) given \(X=x\). Thus \(f_x(x_i, \hat x_i) = f(x_i, \hat x_i) / f_X(x)\) where \(f\) is the bivariate density of \(X_i\) and \(\hat X_i\) and \(f_X\) is the unconditional density of \(X\). Assuming independence between \(X_i\) and \(\hat X_i\):
\[\begin{split}\mathsf{E}[X_i \mid X=a] &= \int_0^a x_i f_a(x_i, a-x_i) dx_i\\ &= \frac{1}{f_X(a)} \int_0^a x_i f_i(x_i)f_{\hat i}(a-x_i) dx_i\end{split}\]showing \(\mathsf E[X_i \mid X=a]\) is the convolution of the functions \(x_i\mapsto x_i f_i(x_i)\) and \(f_{\hat i}\). The convolution can be computed using FFTs. In the case \(f_X(a)\) is very small these estimates may be numerically unreliable.
exlea_line \(=\mathsf{E}[X_i \mid X\le a]\) is given by
\[\begin{split}\mathsf{E}[X_i \mid X\le a] &= \mathsf{E}[\mathsf{E}(X_i \mid X\le a]\mid X) \\ &= \int_0^a \mathsf{E}[X_i \mid X\le a, X=x]f_{\{X\mid X\le a\}}(x) dx \\ &=\frac{1}{F_X(a)} \int_0^a \mathsf{E}[X_i \mid X=x]f_X(x) dx \\\end{split}\]can be computed for all \(a\) using the cumulative sums. Care is needed when \(a\) is so small that \(F(a)\) is very small.
exgta_line \(=E(X_i \mid X \ge a)\) can be computed using \(\mathsf{E}[X] = E(X_i \mid X\le a)F(a) + \mathsf{E}[X_i \mid X > a]S(a)\). It could also be computed with a reverse cumulative sum.
exi_x_line \(=\mathsf{E}[X_i / X]\), the unconditional average proportion of losses from line \(i\) is computed as
\[\begin{split}\mathsf{E}[X_i / X] &= \mathsf{E}_X[\mathsf{E}[X_i/X \mid X]] \\ &= \mathsf{E}_X[\mathsf{E}[X_i \mid X] / X] \\ &= \int_0^\infty \mathsf{E}[X_i \mid X=x]x^{-1} f_X(x)dx.\end{split}\]exi_xlea_line \(=\mathsf{E}[X_i/X \mid X \le a]\) is computed using cumulative sums via
\[\mathsf{E}[X_i/X \mid X \le a] = \frac{1}{F(a)}\int_0^a \mathsf{E}[X_i\mid X=x]x^{-1}f_X(x)dx.\]exi_xgta_line \(=\mathsf{E}[X_i/X \mid X > a]=\alpha_i(a)\) computed from \(\mathsf{E}[X_i/X]\) and \(\mathsf{E}[X_i/X \mid X \le a]\) as usual.
exa_line \(=\mathsf{E}[X_i(a)]\) is the loss cost for line \(i\) using the equal priority rule. It is computed by conditioning on \(X\)
\[\begin{split}\mathsf{E}[X_i(a)] &= \mathsf{E}[X_i(a] \mid X \le a)F(a) + \mathsf{E}[X_i(a] \mid X > a)S(a) \\ &= \mathsf{E}[X_i \mid X \le a]F(a) + a\mathsf{E}[X_i/X \mid X > a]S(a)\end{split}\]showing it is a simple weighted average of \(\mathsf{E}[X_i \mid X \le a]\) and \(\mathsf{E}[X_i/X \mid X > a]\), both of which have already been computed. The computation could also be carried out using \(\mathsf{E}[X_i ; X \le a]\) and \(\mathsf{E}[X_i/X ; X > a]\) which would avoid multiplying and dividing by \(F\) and \(S\).
e2pri_line \(=\mathsf{E}[X_{i,2}(a)]\) is the recovery to \(X_i\) when it is subordinate to \(\hat X_i\) and total assets \(=a\). It can also be computed using FFTs. Assuming independence between the lines the recovery to line \(i\) given \(\hat X_i\) is
\[X_{i,2}(a,\hat X_i) = \max(0, \min(X_{i,2}, a-\hat X_i)) = X_{i,2} \wedge (a-\hat X_i)^+\]which can be computed as
\[\begin{split}\mathsf{E}[X_{i,2}(a)] &=\mathsf{E}_{\hat X_i}[\mathsf{E}[X_{i,2}(a)\mid \hat X_i]] \\ &=\mathsf{E}_{\hat X_i}[\mathsf{E}[X_i\wedge (a-\hat X_i)^+\mid \hat X_i]] \\ &= \int_0^a \mathsf{E}[X_i\wedge (a-x)\mid \hat X_i=x) f_{\hat i}(x)dx \\ &= \int_0^a \mathsf{E}[X_i\wedge (a-x)] f_{\hat i}(x)dx\end{split}\]showing \(\mathsf{E}[X_{i,2}(a)]\) is the convolution of the functions \(x\mapsto \mathsf{E}[X_i\wedge x]\) and \(f_{\hat i}\), i.e. of the limited expected values of \(X_i\) on a stand-alone basis and the density of \(\hat X_i\).
epd_i_line are the expected policyholder deficits of line with assets \(a\). When \(i=1\) the computation is for the standalone line, when \(i=1\) for the line with equal priority and when \(i=2\) for the line with second priority relative to all other lines. The calculation are all simple
\[\begin{split}\text{epd}_{0}(X_i, a) &= \frac{\mathsf{E}[X_i] - \mathsf{E}[X_i\wedge a]}{\mathsf{E}[X_i]} \\ \text{epd}_{1}(X_i, a) &= \frac{\mathsf{E}[X_i] - \mathsf{E}[X_i(a)]}{\mathsf{E}[X_i]} \\ \text{epd}_{2}(X_i, a) &= \frac{\mathsf{E}[X_i] - \mathsf{E}[X_{i,2}(a)]}{\mathsf{E}[X_i]}\end{split}\]
The upshot of these calculations is that all the required values, for all levels of capital \(a\) can be computed in time \(O(mn\log(n))\) where \(m\) is the number of lines of business and \(n\) is the length of the vector used to discretize the underlying distributions. Without using FFTs the calculations would take \(O(mn^2)\). Since \(n\) is typically in the range \(2^{10}\) to \(2^{20}\) FFTs provide a huge speed-up. Using simple simulations would be completely impractical for the delicate calculations involved.
The calculation of \(\mathsf{E}[X_i(a)] = \mathsf{E}[X_i \mid X \le a]F(a) + a\mathsf{E}[X_i/X \mid X > a]S(a)\) depends critically on the fact that the same values \(\mathsf{E}[X_i \mid X=x]\) and \(\mathsf{E}[X_i/X \mid X > a]\) are used for all values of \(a\). Only the weights \(F(a)\) and \(S(a)\) change with \(a\). As a result \(\mathsf{E}[X_i(a)]\) can be computed in one sweep of length \(n\). If different values were required for each value of \(a\) the complexity would jump up to \(O(mn\times n^2)\) (or \(O(mn\times n\log(n))\) if it is possible to use FFTs). This is unfortunately the situation when one line is collateralized because the ratio of capital to collateral determines the allocation of assets in insolvency.
Now we compute the impact of applying a distortion \(g\) to the underlying probabilities, i.e. discuss premium allocations.
Let \(\mathsf{E}_g\) denote expected values with respect to the distorted probabilities defined by \(g\).
Variable |
Meaning |
Computation |
Complexity |
---|---|---|---|
gS, gF |
\(g(S(x))\) and \(1-g(S(x))\) |
\(O(n)\) |
|
gp_total |
Estimate of \(-d g(S(x))/dx\) |
Difference of \(g(S)\) |
\(O(n)\) |
exag_total |
\(\mathsf E_g[X\wedge a]\) |
Cumulative sum of \(g(S)\) |
\(O(n)\) |
exag_line |
\(\mathsf E_g[X_i(a)]\) |
See below |
\(O(n)\) |
exag_total is easy to compute as the cumulative sums of \(g(S)\)
exag_line is computed as
\[\begin{split}\mathsf{E}_g[X_i(a)] &= \mathsf{E}\left[X_i\frac{X\wedge a}{X}g'S(X)\right] \\ &= \mathsf{E}\left[\mathsf{E}\left[X_i\frac{X\wedge a}{X}g'S(X)\mid X \right]\right] \\ &= \mathsf{E}\left[\mathsf{E}[X_i \mid X] 1_{\{X\le a\}} g'S(X) \right] + a \mathsf{E}\left[\frac{\mathsf{E}[X_i\mid X]}{X} 1_{\{X > a\}} g'S(X) \right] \\ &= \int_0^a \mathsf{E}[X_i\mid X=x] g'(S(x))f_X(x)dx + \int_a^\infty \mathsf{E}[X_i\mid X=x] x^{-1} g'S(x)f_X(x)dx.\end{split}\]The first integral is computed as a cumulative sum of its terms, the second is computed as a reverse cumulative sum, both using
exeqa
. This expectation can also be expressed using \(\beta_i(a)\).If \(g\) has a probability mass at \(s=0\) then how are the masses dealt with?
Finally we discuss computing the impact of line specific collateral.
Computing the impact of collateral on recoveries. Computes the expected recoveries to line \(X_i\) when there are assets \(a\) but line \(i\) has collateral \(c\le a\). This calculation, alas, cannot be performed quickly using FFTs. It has to be computed mirroring the three way split of the default zone: no default, default and line \(i\) just paid full collateral (which requires \(X_i < cx/a\) where \(x\) is total loss), and line \(i\) is paid its usual pro rata proportion of assets.
5.8.4. Distortion
Class Calculations
Todo
Documentation to follow.
5.8.5. Bounds
Class Calculations
Todo
Documentation to follow.