(C) Copyright 2019 Everysk Technologies, Inc. This is an unpublished work containing confidential and proprietary information of Everysk Technologies, Inc. Disclosure, use, or reproduction without authorization of Everysk Technologies, Inc is prohibited.
In what follows we present a step-by-step description of our multi-asset, forward looking calculation engine:
STEP 1: RISK FACTORS
The first step of the process is the decomposition of each security into their underlying risk factors in order to compute how these factors interact with each other. For example: a bullet corporate bond has interest rate and credit spread risks (apart from default and potentially FX risks). The rate component is likely to be detrimental to the bond when there is a flight from quality, but the credit spread will counteract this negative effect. Measuring this propagation of risk is not trivial and it starts with the right choice of risk factors.
Risk factors that can be reliably utilized for forecasting need to be independent and identically distributed (i.i.d.). For example: non-overlapping compounded returns rather than closing prices should be used as the risk factor for a stock. In what follows we describe why:
The scatterplot below shows the daily closing prices of a stock in the x-axis with the 1-day lagged prices in the y-axis. In red, we plot the location-dispersion ellipsoid to represent the covariance between the samples. It can be seen that there is a very uneven amount of variance projected to the principal axis of the ellipsoid. The series of closing prices cannot be considered independent.
Conversely, the 1-day lagged scatterplot of non-overlapping compounded returns is shown below. The corresponding location-dispersion ellipsoid is almost a circle, indicating that compounded returns are independently distributed and can be used as a risk factor in forecasting.
The following table shows some securities and their corresponding risk factors, as modeled by our calculation engine . The risk factors are described in greater detail in Step 7:
Security | Invariant 1 | Invariant 2 | Invariant 3 | Invariant 4 |
US stock | stock (LN) | |||
US future | continuous maturity future (LN) | |||
Foreign Stock | stock (LN) | currency (LN) | ||
Options | stock (LN) | volatility (LN) | rates (N) | |
Foreign Option | stock (LN) | volatility (LN) | rates (N) | FX (LN) |
US Corporate Bond | stock (LN) | blended constant maturity treasury rates(N) | blended credit spread (N) |
(LN) represents the lognormal returns for the risk factors and (N) represents their difference in value between 2 sampling dates.
An additional risk factor might be required when the base currency of the portfolio is different from the domestic currency of the security (please see pricing formulas in Step 7).
STEP 2: RISK FACTOR MATRIX
In this step the historical returns/rates representing the risk factors that will be required to price each security are collected into a matrix denoted X. Our calculation engine retrieves information going back to the beginning of 2008 in order to account for the Great Financial Crisis (GFC). Each column in this matrix will represent a risk factor. The number of columns could be larger than the number of securities as more than one risk factor might be mapped to a particular security.
STEP 3: AUGMENTED RISK FACTOR MATRIX
In order to capture the co-movements between the various securities' risk factors with one or more exogenous indices, additional columns with the risk factors for those indices are appended to the matrix X from Step 2. We call this augmented matrix, %% \small \overline{XZ} %%.
The first %% \small m^{*} %% columns represent the risk factors that will be used to generate the forward looking PL of the portfolio (see Step 7). For simple securities, there is a one-to-one mapping and %% \small m^{*} \equiv m %%, where %% \small m %% is the number of securities in the portfolio. If one or more securities are complex and depend on multiple risk factors, %% \small m^{*} > m %%.
Similarly, the last %% \small k^{*} %% columns represent the risk factors for the exogenous indices that will be used either for risk attribution (projection) (see Steps 8 and 9) as well as conditioning probabilities for stress tests (see Step 10).
The next 2 steps in the process will prepare the sample covariance for the simulations. First, an exponential decay is applied to weight recent historical samples more heavily. Then spurious relationships are removed,retaining only stronger causal relationships. The notation below is used to represent the covariance matrix at each stage:
$$ \large \begin{array}{cccc} \Sigma & \rightarrow & \hat\Sigma &\rightarrow &\Sigma^{*} \end{array} $$
STEP 4: DOUBLE DECAY WEIGHTING
An exponential weighting is applied to the matrix from Step 3 in order to account for the time-varying nature of volatilities and correlations. The formulas are presented below:
First, the generic exponential decay formulas applied to the %% \small \overline{XZ} %% matrix from Step 3 are:
$$ \begin{array}{cc}\mu_{i}^{\lambda} = \frac{\sum_{t=1}^{T} \exp^{-\lambda(T-t)}\overline{XZ}_{t,i}}{\sum_{t=1}^{T} \exp^{-\lambda(T-t)}}& &i=1,\cdots,(m^{*}+k^{*})\end{array} $$
$$ \begin{array}{cc}\Sigma_{i,j}^{\lambda} = \frac{\sum_{t=1}^{T} \exp^{-\lambda(T-t)}\overline{XZ}_{t,i}\overline{XZ}_{t,j}}{\sum_{t=1}^{T} \exp^{-\lambda(T-t)}} - \mu_{i}^{\lambda}\mu_{j}^{\lambda}& &1 \le i \le j=1,\cdots,(m^{*}+k^{*})\end{array} $$
which are combined with 2 decay strengths: a fast decay with half life of 2 months for volatilities and a slower decay with half life of 6 months for correlations:
$$ \small \begin{array}{ccc}\hat{\Sigma}_{i,j} = \frac{\sqrt{\Sigma_{i,i}^{\lambda_{1}}.\Sigma_{j,j}^{\lambda_{1}}}}{{\sqrt{\Sigma_{i,i}^{\lambda_{2}}.\Sigma_{j,j}^{\lambda_{2}}}}}. \Sigma_{i,j}^{\lambda_{2}}& &i,j=1,\cdots, (m^{*}+k^{*})\end{array} $$
where:
$$ \small \lambda_{1} = \frac{-ln(0.5)}{(T-t_{1})} $$
is the volatility decay, where %% \small t_{1} %% is 2 months going back and
$$ \small \lambda_{2} = \frac{-ln(0.5)}{(T-t_{2})} $$
is the correlation decay with %% \small t_{2} %% representing 6 months going back. These half lives can be customized depending on the application.
STEP 5: REGULARIZATION
Despite weighing more heavily recent data, the covariance matrix from Step 4, %%\small \hat{\Sigma}%%
might still be ill-conditioned and/or contain undesirable spurious correlations. This step uses a proprietary regularization to achieve 2 goals, namely:- Minimum amount of eigenvalue over-dispersion, achieved with a l2 norm that shrinks the sample eigenvalues towards some suitable constant.
- Maximum amount of sparseness while retaining important causal relationships, achieved with a l1 norm. This is an important step to address estimation errors in the sample covariance (these techniques are standard in the Machine Learning community to avoid overfitting when trying to make predictions).
Our engine uses a proprietary heuristic to weight the amounts of normalization above. As an example, a simple portfolio with 25 stocks would have the following properties after penalizing for off-diagonal elements as well as the dispersion around an average eigenvalue:
Matrix | Condition Number | Off-diagonal zeros as percent of dense matrix |
---|---|---|
Sample %%\small \left(\Sigma\right)%% | 74.98 | 0% |
Regularized %%\small \left(\Sigma^{*}\right)%% | 5.70 | 43% |
It can be seen above that the regularized covariance has two desirable properties: a) it is better conditioned, i.e. less dispersion of eigenvalues and b) there are less spurious correlations, i.e. there are more off-diagonal zeros. Additionally, significant less data is required to estimate this regularized covariance. The amounts of regularization we employ have been extensively tested with cross-validation methods. For larger matrices, we can achieve even higher degrees of sparsity.
STEP 6: SIMULATIONS
The regularized covariance from Step 5, %% \small \Sigma^{*} %%, is used to generate multivariate t-student random simulations for all the necessary invariants. We call this matrix %% \small \overline{sims} %%:
$$ \small \overline{sims} = t(\mu * \tau, \Sigma^{*} * \tau, \nu) = \mu * \tau + N(0,\Sigma^{*} * \tau) / \sqrt{Gam\left[\nu/2,\nu/2\right]} $$
We use a multivariate t-student with a degree of freedom %%\small \nu = 5 %% to capture the extreme joint co-movements, or ”tail dependence” present in the risk factors. %% \small Gam\left[\alpha,\beta\right] %% is the Gamma random function with location %% \small \alpha>0 %% and dispersion %% \small \beta>0 %%.
%% \small \tau %% is the ratio between the forecast horizon and the sampling of the risk factors. The dimensions of the %% \small \overline{sims} %% matrix are %% \small n \times (m^{*}+k^{*}) %%, where %% \small n %% is the number of simulations and %% \small (m^{*}+k^{*}) %% is the total number of invariants.
STEP 7: PROFIT AND LOSS SIMULATIONS
The first %% \small m^{*} %% columns from the simulation matrix, %% \small \overline{sims} %%, representing risk factors, are then mapped to security simulations using various pricing formulas.
Before we detail each pricing formula, we need to make sure that the correlated effects of currencies and other assets in the portfolio are properly captured. Our generic FX simulation transforms a payoff that is denominated in domestic currency to the base currency of the portfolio and is defined as:
$$ \small \begin{array}{ccc} FX_{\small{\text{sim}}} = e^{\left(sims\left[\small{\text{SECFX}}\right]-sims\left[\small{\text{BASEFX}}\right]\right)}\end{array} $$
Everysk Calculation Engine computes all crosses against US dollars, therefore %% \small sims[\small{\text{SECFX}}] %% and %% \small sims[\small{\text{BASEFX}}] %% are the columns from the simulation matrix representing the security’s domestic currency and the portfolio’s base currency, both versus the US dollars. These are vectors of size %% \small n \times 1 %% and exist only when securities and/or portfolio are not denominated in the same currency.
The following sections describe in detail how simulations of risk factors are converted, via pricing formulas, to profit and loss for the various securities covered by our calculation engine.
7.1. GLOBAL EQUITIES:
The generic simulation formula for global equities is:
$$ \small P_{0} * FX_{0}*amt * \left( FX_{\small{\text{sim}}} * e^{sims\left[\small{\text{INV}}\right]} - 1.0 \right) $$
represents the simulated PL when conversion to base currency is taken into account. %% \small P_{0} %% is the initial price in domestic currency and %% \small sims[\small{\text{INV}}] %% is the column from the simulation matrix that retrieves the appropriate risk factor for this security.
where:
$$ \small FX_{0} = \frac{FX_{\text{sec}}}{FX_{\text{base}}} $$
converts the security’s domestic currency into portfolio’s base currency whereby:
- %% \small FX_{\text{sec}} %% is the amount of dollars that can be purchased with the security’s domestic currency.
- %% \small FX_{\text{base}} %% is the amount of dollars that can be purchased with the portfolio’s base currency.
For example: assume an investor based in Europe buys 100 shares of Sony Corporation (6758:XTKS) traded in the Tokyo Stock Exchange. This position has 2 distinct risks for the investor: a) the variability of its price in Yen; and b) the variability of the FX conversion from Yen to Euro.
Despite EURJPY existing as a traded cross, Everysk Calculation Engine keeps all crosses against the US Dollar, even for crosses that are less liquid. The following schematic shows that simulating Sony (for this European investor) would require 3 columns from the simulation matrix: a) the stock in Yen; b) the exchange rate from Yen to USD (JPYUSD) and c) the exchange rate from Euro to USD (EURUSD):
Both b) and c) above are used to convert the stock from Yen to Euro. The forward looking PL simulation for 100 shares of Sony in the illustrative example above would be:
$$ \small \displaystyle PL_{sony} = \small{\text{JPY} 3,371} * \frac{0.009942}{1.1219} *100 * \left(FX_{\small{\text{sim}}}*e^{\bold{sims[\small{\text{\small{6758:XTKS}}}}]} - 1.0 \right) $$
Where JPY 3,371 is the current price of Sony stock; 0.009942 is the amount of US dollars that can be purchased with 1 Yen; and 1.1219 is the amount of US dollars that can be purchased with 1 Euro. The currency simulation is defined as:
$$ \small \displaystyle FX_{\small{\text{sim}}} = e^{(\bold{sims\left[\small{\text{JPYUSD}}\right]}-\bold{sims\left[\small{\text{EURUSD}}\right] })}$$
Let’s assume we took a concurrent slice of the 3 simulated invariants and found:
- %% \small \text{sims}[\small{\text{JPYUSD}}] = 0.02 %%
- %% \small \text{sims}[\small{\text{EURUSD}}] = 0.00 %%
- %% \small \text{sims}[\small{\text{6758:XTKS}}] = 0.03 %%
i.e. Sony corporation appreciating 3% in Yen, the Yen appreciating 2% against the US dollar and the Euro flat to the US dollar. Sony’s simulated PL would be:
$$ \small \displaystyle PL_{sony} = \small{\text{JPY} \ 3,371} * \frac{0.009942}{1.1219} *100 * \left( e^{(0.02-0.0)}*e^{0.03} - 1.0 \right) = \small{\text{EUR}} \ 153.16 $$
Investors in different parts of the world should perceive the risk of Sony differently. If an investor in Brazil bought the same 100 shares of Sony, her/his PL assuming a BRL weakening 2% to the dollar:
- %% \small \text{sims}[\small{\text{JPYUSD}}] = 0.02 %%
- %% \small \text{sims}[\small{\text{BRLUSD}}] = -0.02 %%
- %% \small \text{sims}[\small{\text{6758:XTKS}}] = 0.03 %%
$$ \small \displaystyle PL_{sony} = \small{\text{JPY} \ 3,371} * \frac{0.009942}{0.31} *100 * \left( e^{(0.02-(-0.02))}*e^{0.03} - 1.0 \right) = \small{\text{BRL}} \ 783.90$$
Our calculation engine effectively produces 50,000 possible outcomes for Sony’s stock, taking into account all the relevant risk factors and how they correlate. We will show in Step 10 how this rich data set can be used to generate granular stress tests.
Any currency supported in our database can be used as the base currency of the portfolio.
7.2. FUTURES
Futures are very similar to equity simulations, except that the traded contract needs to be initially mapped to a continuous, “generic” future contract. The reason is that the historical information from the traded contract, which has a defined expiration, is not invariant and therefore cannot be used in the simulations: a future contract expiring in 10 months has a very different risk profile than the same contract expiring in 2 months. The following example illustrates the pricing:
An investor with Canadian dollar as base currency buys 10 contracts of CLZ6, the Crude Oil future traded in the Chicago Mercantile Exchange, expiring on 11/21/2016. Everysk Calculation Engine first maps CLZ6 to continuous contracts (1month, 2months,etc.) as follows:
The CLZ6 contract has 2.8 months to expiration (as of 08/25/16), requiring a linear interpolation between the 2 and 3 month generic contracts (CL2 and CL3). The interpolation factor is %% \small \alpha = \frac{(3-2.8)}{(3-2)} = 0.2 %%, weighting CL2 with 20% and CL3 with 80%.
The forward looking PL distribution for these 10 contracts would be:
$$ \small \displaystyle \text{CL}_{\text{blended}} = \ 0.2*\text{sims}[\small{\text{CL2}}]+ 0.8*\text{sims}[\small{\text{CL3}}] $$
$$ \small \displaystyle PL_{\text{CLZ6}} = \small{\text{USD} \ 48.70} * \frac{1}{0.77}*1000 * 10*\left( e^{-\bold{sims\left[\small{\text{CADUSD}}\right]}}*e^{\text{CL}_{\text{blended}}} - 1.0 \right) $$
Where USD 48.70 is the current price for CLZ6; 0.77 is the amount of US dollars that can be purchased with 1 Canadian dollar. Each contract has a multiplier of 1000. The simulation from CAD to USD has a negative sign indicating that, for a Canadian investor, a strengthening CAD will be detrimental due to her/his money being invested on a dollar asset (the crude future). Conversely, a weakening CAD will be beneficial.
Let’s assume we took a concurrent slice of the 3 simulated invariants and found:
- %% \small \text{sims}[\small{\text{CADUSD}}] = -0.02 %%
- %% \small \text{sims}[\small{\text{CL}}] = -0.02 %%
- %% \small \text{sims}[\small{\text{CL3}}] = -0.018 %%
i.e. the Canadian dollar weakening 2% against the US dollar; the generic 2 month crude oil losing 2.0% and the generic 3 month losing 1.8% (notice that the simulations would be consistent: both generic contracts presenting very similar return behavior and Canadian dollar being correlated with them). Then the PL of this position, in Canadian dollars, would be:
$$ \small \displaystyle \begin{array}{l} PL_{\text{CLZ6}} = \small{\text{USD} \ 48.70} * \frac{1}{0.77}*1000 * 10*\left( e^{-(-0.02)}*e^{-(0.2*0.02+0.8*0.018)} - 1.0 \right) \\ \\ PL_{\text{CLZ6}} = \small{\text{CAD}} \ 1012.75 \end{array} $$
Notice how the expected fall in oil prices is compensated by a stronger US dollar, as perceived by our Canadian investor. Our flexible symbology and calculation engine allows for any synthetic future contract (with any expiration) to be provided and the underlying continuous contracts will be automatically interpolated.
7.3. EQUITY/INDEX OPTIONS
Options are priced with the Black and Scholes formula using an implied volatility that is calculated to match the current premium of the option. The risk free rate is simulated as a normal invariant and the logs of the non-overlapping returns for the underlying stock is also used.
For example, a Norwegian investor purchases 50 contracts of an out-of-the-money call option on IBM, struck at USD 165 and expiring on 11/18/2016 (0.173 years). The current price of IBM is USD 158.32 and its dividend yield is 3.4%:
The market price for this option is USD 2.56 and the implied volatility is 17.3%. The PL for this position is:
$$ \small \displaystyle \begin{array}{ccc} PL_{option} = \frac{1}{0.12}*50*100 * \left[ e^{-\bold{sims\left[\small{\text{NOKUSD}}\right]})}*\small{BS \left( \text{sims}[\small{\text{IBM}}] \right)} - \small{\text{2.56}} \right] \end{array} $$
Where the Black and Scholes is a function of the simulations for IBM stock and risk free rate, defined as:
$$ \small \displaystyle \begin{array}{ccc} \small{BS \left( \text{USD} \ 158.32*e^{\text{sims}\left[\small{\text{IBM}}\right]},165,0.173,\text{sims}[\small{\text{RFRATE}}],0.33,c,0.034 \right)} \end{array} $$
Let’s assume we took a concurrent slice of the 3 simulated invariants and found:
- %% \small \text{sims}[\small{\text{NOKUSD}}] = -0.015 %%
- %% \small \text{sims}[\small{\text{IBM}}] = 0.02 %%
- %% \small \text{sims}[\small{\text{RFRATE}}] = 0.008 %%
Then, the forward looking PL for the call option, for a Norwegian investor, would be:
$$ \small \displaystyle \begin{array}{lll} BS \left( \text{USD} \ 158.32*e^{0.02},165,0.173,0.008,0.33,c,0.034 \right) &=&3.90 \\ \\ PL_{option} = \frac{1}{0.12}*50*100 * \left[ e^{-(-0.015)}*3.90 - \small{\text{2.56}} \right] &=& \small{\text{NOK}} \ 41,666 \end{array} $$
For index options, dividend term-structures are computed with put-call parity.
7.4. CURRENCY FORWARDS
Currency forwards are contracts to sell currency A and buy currency B at a point in time in the future, at a pre-agreed exchange rate. It has a initial PL of zero at contract time.
For example: A risk manager based in India needs to sell 1.5 million British pounds and buy Euro 6 months forward. Assuming the user supplied forward rate is GBPEUR 0.8, the risk manager will sell GBP 1.5M and buy EUR 1.2M in 6 months. If EUR is stronger she/he will have a positive PL. Conversely if EUR is weaker than the pre-agreed rate, she/he will lose money. Presumably the currency forward is used to offset some British pound asset/Euro liability. The following formula summarizes the payoff, cash settled in EUR:
$$ \small \displaystyle \begin{array}{lll} PL_{forward} &=& \small{\text{-GBP} \ 1.5M} * 0.8 * \frac{1.1219}{0.015} * \text{FX}_{\small{\text{sim}}} *\left( \text{FWD}_{\small{\text{sim}}}- 1.0 \right) \\ \\ \\ \text{FWD}_{\small{\text{sim}}} &=& e^{\small{sims[\text{\small{GBPUSD}}]}-\small{sims[\small{\text{EURUSD}}]}} \\ \\ \text{FX}_{\small{\text{sim}}}&=& e^{\small{sims[\small{\text{EURUSD}}]}-\small{sims[\small{\text{INRUSD}}]}} \end{array} $$
where 0.015 is the number of US dollars that can be purchased with 1 Indian rupee and 1.1219 is the number of US dollars purchased with 1 Euro. Let’s assume we took a time slice of the 3 simulated invariants and found:
- %% \small \text{sims}[\small{\text{INRUSD}}] = -0.015 %%
- %% \small \text{sims}[\small{\text{GBPUSD}}] = -0.04 %%
- %% \small \text{sims}[\small{\text{EURUSD}}] = -0.03 %%
Then:
$$ \small \displaystyle \begin{array}{lll} PL_{forward} &=& \small{\text{-GBP} \ 1.5M} * 0.8 * \frac{1.1219}{0.015} * 0.9851*\left( 0.9900 - 1.0 \right) \\ \\ PL_{forward} &=& \small{\text{INR 0.88M}} \end{array} $$
The cash settlement of the GBPEUR forward above is in Euros. If the base currency of the portfolio was also in EUR, the formula would simply be:
$$ \small \displaystyle \begin{array}{lll} PL_{forward} &=& \small{\text{-GBP} \ 1.5M} * 0.8 * \left( 0.9900 - 1.0 \right) \\ \\ PL_{forward} &=& \small{\text{EUR 12,000}} \end{array} $$
7.5. GOVERNMENT BONDS
The bond simulation has 3 steps:
A) First the spot par rate is interpolated using the duration of the bond:
Assume the duration of the bond in years is %% \small D %%, falling between 2 key rates, %% \small T_1 %% and %% \small T_2 %%. The linear interpolation is calculated as:
$$ \small \alpha = \frac{(T_2-D)}{(T_2-T_1)} $$
Then, the spot rate is calculated from the neighboring key rates using the above weighting:
$$ \small \begin{array}{ccc} {\text{parRate}} = \alpha * \small{\text{rate}_{T1}} +(1-\alpha) * \small{\text{rate}_{T2}}\end{array} $$
For example: assume the duration of the bond is 6 years and the constant maturity treasuries published by the Federal Reserve Bank of St. Louis are: DGS1MO (0.75%), DGS1(1.02%), DGS5(1.74%), DGS10(2.21%) and DGS30YR(2.87%).
Then:
$${\text{parRate}} = [(10 - 6)/(10-5)] * 1.74\% + [1 - (10 - 6)/(10-5)] * 2.21\% $$
and %% \small \text{parRate} = 1.84\%%%
The generic formula for rate simulation is:
$$ \small \displaystyle rateSim = \small{\text{parRate}} +\ \left[\alpha*\bold{\text{sims[\small{RATE1}]}}+(1-\alpha)*\bold{\text{sims[\small{RATE2}]}}\right] $$
Where RATE1 and RATE2 are the columns from the simulation matrix corresponding to the constant maturity treasuries surrounding the duration of the bond.
B) Then the sovereign spread is simulated:
Credit default swaps from the issuer country are used when available:
$$ \small \displaystyle countrySim =\small{\text{spread}}_{0} +\ \left[\alpha^{*}*\bold{\text{sims[\small{CDS1}]}}+(1-\alpha^{*})*\bold{\text{sims[\small{CDS2}]}}\right] $$
Where %% \small \bold{\text{sims[\small{CDS1}]}}%% and %% \small \bold{\text{sims[\small{CDS2}]}}%% are the columns from the simulation matrix corresponding to the country credit default swaps with maturities surrounding the duration of the bond and %%\alpha^{*}%% is the interpolation factor similar to the rates procedure above.
When a CDS term structure for the issuing country is not available, a regional credit spread index is used to proxy the country risk as follows:
$$ \small \displaystyle countrySim = \small{\text{spread}}_{0} +\ \bold{\text{sims[\small{REGION}]}}$$.
And
$$ \small \displaystyle \small{\text{spread}}_{0} = \small{\text{ytm}} - \small{\text{parRate}} $$
Where: ytm is the bond yield-to-maturity and %% \small \bold{\text{sims[\small{REGION}]}} %% represents the simulations of a proxy regional index for the country, as follows:
Bond Property | Indices to be used |
Sovereign Issuer | BofA Merrill Lynch Regional Option-adjusted spreads (EMEA, APAC, LATAM, NORTHAM) |
Depending on the country of issuance, one of the BofA Merrill Lynch Option-adjusted regional indices will be used, namely: APAC, EMEA, LATAM and NORTHAM.
C) Finally rate and sovereign spread simulations are used in a vectorized bond pricer:
$$ \small \displaystyle bondSim = \text{bondPricer}(100,\small{\text{time2Mat}},(rateSim+countrySim),\small{\text{coupon,periodicity}}) $$
The final formula, accounting for any currency effects is:
$$ \small \displaystyle \begin{array}{ccc} PL_{bond} = \frac{FX_{sec}}{FX_{base}} * \left[ e^{(\bold{sims\left[\small{\text{SECFX}}\right]}-\bold{sims[\small{\text{BASEFX}}]})}*\small{bondSim} - \small{\text{price}} \right] \end{array} $$
7.6. CORPORATE BONDS
Corporate bonds are calculated similarly to Government bonds. The bond simulation has 3 steps:
A) First the spot par rate is interpolated using the duration of the bond:
Assume the duration of the bond in years is %% \small D %%, falling between 2 key rates, %% \small T_1 %% and %% \small T_2 %%. The linear interpolation is calculated as:
$$ \small \alpha = \frac{(T_2-D)}{(T_2-T_1)} $$
Then, the spot rate is calculated from the neighboring key rates using the above weighting:
$$ \small \begin{array}{ccc} {\text{parRate}} = \alpha * \small{\text{rate}_{T1}} +(1-\alpha) * \small{\text{rate}_{T2}}\end{array} $$
For example: assume the duration of the bond is 6 years and the constant maturity treasuries published by the Federal Reserve Bank of St. Louis are: DGS1MO (0.75%), DGS1(1.02%), DGS5(1.74%), DGS10(2.21%) and DGS30YR(2.87%).
Then:
$$\small {\text{parRate}} = [(10 - 6)/(10-5)] * 1.74\% + [1 - (10 - 6)/(10-5)] * 2.21\% = 1.84\% $$
The generic formula for rate simulation is:
$$ \small \displaystyle rateSim = \small{\text{parRate}} +\ \left[\alpha*\bold{\text{sims[\small{RATE1}]}}+(1-\alpha)*\bold{\text{sims[\small{RATE2}]}}\right] $$
Where RATE1 and RATE2 are the columns from the simulation matrix corresponding to the constant maturity treasuries surrounding the duration of the bond.
B) Second, the credit spread is simulated:
When credit default swaps are available for the issuer, we follow the same procedure from Government bonds:
$$ \small \displaystyle corporateSim =\small{\text{spread}}_{0} +\ \left[\alpha^{*}*\bold{\text{sims[\small{CDS1}]}}+(1-\alpha^{*})*\bold{\text{sims[\small{CDS2}]}}\right] $$
And
$$ \small \displaystyle \small{\text{spread}}_{0} = \small{\text{ytm}} - \small{\text{parRate}} $$
Where %% \small \bold{\text{sims[\small{CDS1}]}}%% and %% \small \bold{\text{sims[\small{CDS2}]}}%% are the columns from the simulation matrix corresponding to the corporate credit default swaps with maturities surrounding the duration of the bond and %%\alpha^{*}%% is the credit interpolation factor.
When the CDS term structure for the issuing company is not available, a structural default model is used to proxy the corporate spread risk. Given the duration and probability of default of the security, we establish a blended credit rating for the bond using a 20x20 matrix of default rates published by S&P (the average cumulative issuer-weighted global default rates by letter rating from 1983 to 2015), as follows:
- Calculate the probability of default (“PD”) using a timeseries structural model (see Appendix)
- Given the duration and PD, bi-linearly interpolate from the 20x20 matrix of default rates. The columns of this matrix are maturities ranging from 1 to 20 years and the rows are S&P ratings, ranging from AAA to CCC.
- The previous step will determine the blended rating. This blend is used to simulate credit spreads using various BofA Merrill Lynch US Corporate Option-adjusted spreads.
The following table summarizes the rate and credit interpolations:
Bond Property for interpolation | List of indices to be interpolated |
duration | Treasury Constant Maturity Rates (1mo, 1yr, 5yr, 10 yr and 30yr) |
duration and probability of default | BofA Merrill Lynch US Corporate Option-adjusted spreads (AAA, AA, BBB, BB, B, CCC) |
Therefore yields have 2 simulated components, rates and spread:
$$ \small \displaystyle rateSim = \small{\text{parRate}} +\ \left[\alpha*\bold{\text{sims[\small{CMTY:5Y}]}}+(1-\alpha)*\bold{\text{sims[\small{CMTY:10Y}]}}\right] $$
$$ \small \displaystyle corporateSim = \small{\text{spread}}_{0} +\ \left[\beta*\bold{\text{sims[\small{BAMLBBB}]}}+(1-\beta)*\bold{\text{sims[\small{BAMLBB}]}}\right] $$
The above formulas illustrate a bond interpolating between the 5 and 10 year constant maturity treasuries and between BBB and BB credit spreads. %% \small \displaystyle \alpha \ \small{\text{and}} \ \beta %% are interpolation factors, varying from 0 to 1. For example: if the duration of the bond is exactly 5.5 years and the probability of default is 5%, we retrieve from the default table:
5 yrs | 6 yrs | |
BBB | 1.617 | 2.029 |
BB | 6.263 | 7.346 |
First we interpolate the columns:
5 yrs | 5.5 yrs | 6 yrs | |
BBB | 1.617 | 1.823 | 2.029 |
BB | 6.263 | 6.804 | 7.346 |
Then we establish the blend of BBB and BB, using the 5% probability of default from the bond:
$$ \small \displaystyle \beta = \frac{(PD_2-PD)}{(PD_2-PD_1)} = \frac{(6.804-5.0)}{(6.804-1.823)} = 26.17\% $$
Thus our illustrative bond will be a blend of 26.17% of BBB and 73.83% of BB. Given its 5.5 years duration, the bond will be proxied as a blend with 90% of 5 year constant maturity treasury and 10% of 10 year constant maturity treasury. Note that the simulated invariants are normal and therefore added to the initial rate/spread.
C) Finally the simulated rates and credit spreads are used together in a vectorized bond pricer:
$$ \small \displaystyle bondSim = \text{bondPricer}(100,\small{\text{time2Mat}},(rateSim+corporateSim),\small{\text{coupon,periodicity}}) $$
The final formula, consistent with other security formulas is:
$$ \small \displaystyle \begin{array}{ccc} PL_{bond} = \frac{FX_{sec}}{FX_{base}} * \left[ e^{(\bold{sims\left[\small{\text{SECFX}}\right]}-\bold{sims[\small{\text{BASEFX}}]})}*\small{bondSim} - \small{\text{price}} \right] \end{array} $$
7.7. TERM LOANS
Term loans follow a similar procedure to Corporate bonds above, with the exception of the coupon that floats with libor. Therefore Libor also needs to be simulated:
A) First Libor is simulated:
$$ \small \displaystyle liborSim =\small{\text{L3M}_{0}} + \ \bold{\text{sims[LIBOR3M]}}$$
B) Then we simulate the credit spread:
Same procedure from corporate bonds above, either using the credit default swaps from the issuer or proxying with a blend of OAS indices resulting on %% \small creditSim %%.
C) Finally the simulated libor and credit spreads are used together in a vectorized bond pricer:
$$ \small \displaystyle yieldSim = liborSim + creditSim $$
And:
$$ \small \displaystyle loanSim = \text{bondPricer}(100,\small{\text{time2Mat}},yieldSim, (liborSim+ \small{\text{coupon)}},\small{\text{periodicity}})$$
The final loan simulation formula, accounting for FX effects:
$$ \small \displaystyle \begin{array}{ccc} PL_{loan} = \frac{FX_{sec}}{FX_{base}} * \left[ e^{(\bold{sims\left[\small{\text{SECFX}}\right]}-\bold{sims[\small{\text{BASEFX}}]})}*\small{loanSim} - \small{\text{price}} \right] \end{array} $$
7.8. CREDIT DEFAULT SWAPS
Credit Default Swaps are simulated using the underlying credit term structure of the issuer (please see Government/Corporate bond descriptions above).
When an underlying credit default swap is not available, we proxy the CDS with a leveraged cash bond and use the structural model to proxy spread risk as follows: we artificially plug a principal, borrowed at the swap rate and “deduct” it at the end of the simulation. The motivation is that a CDS is approximately equal to the corporate bond yield less the swap rate. This equivalence stems from the following arbitrage:
- Borrow money at Libor rate
- Use a swap to convert Libor to a fixed rate
- Buy the bond with borrowed money
- Buy credit protection
If the bond yield is larger than the sum of swap rate and CDS rate you should make money. If the opposite is true, you could make money by shorting corporate bond, selling credit protection and lending at swap rate. This relationship is not exact due to several factors, such as: maturity mismatches between CDS and bonds, taxes, counterpart risk and differences in default definition. Having said that, the relationship is accurate for our purposes.
Thus, for issuers lacking CDS we follow the methodology for corporate bonds using the structural model with slight modifications such that only the credit component is simulated (par rates are held constant):
$$ \small \displaystyle yieldSim = \small{\text{parRate}}+ \small{spreadSim} $$
CDS simulations are compared to par, rather than a corporate bond price:
$$ \small \displaystyle \begin{array}{ccc} PL_{cds} = \frac{FX_{sec}}{FX_{base}} * \left[ e^{(\bold{sims\left[\small{\text{SECFX}}\right]}-\bold{sims[\small{\text{'BASEFX'}}]})}*\small{bondSim} - \small{\text{100}} \right] \end{array} $$
7.9. CASH
Cash is a risk-less asset when it is denominated in the same currency as the portfolio’s base currency. However, when cash is denominated in a different currency, it’s FX risk has to be taken into account.
For example: assume an European investor with positions trading in the Brazilian BM&F exchange that require BRL 1M to be encumbered. The forwarding looking PL for this cash position would be:
$$ \small \displaystyle \begin{array}{cccc} PL_{cash} = \frac{0.31}{1.1219}*BRL \ 1,000,000 * \left( e^{(sims\left[\small{\text{BRLUSD}}\right]-sims[\small{\text{EURUSD}}])} - 1 \right) \end{array} $$
Where 0.31 is the number of US dollars that can be purchased with 1 Brazilian Real and 1.1219 is the number of US dollars purchased with 1 Euro. Let’s assume we took a timel slice of the 2 simulated invariants and found:
- %% \small \text{sims}[\small{\text{BRLUSD}}] = -0.03 %%
- %% \small \text{sims}[\small{\text{EURUSD}}] = -0.02 %%
Then:
$$ \small \displaystyle \begin{array}{cccc} PL_{cash} = \frac{0.31}{1.1219}*BRL \ 1,000,000 * \left( e^{(-0.03+0.02)} - 1 \right) \end{array} = -\small{\text{EUR}} \ 2749.39 $$
Thus, despite a 3% devaluation of the BRL, this European investor effectively loses 1%, as EUR also devalues against US dollar.
STEP 8: MCTR - MARGINAL CONTRIBUTION TO TOTAL RISK
Steps 8 to 10 will show how we use the matrix of simulated PLs to generate granular portfolio diagnostics. The first measure, MCTR, breaks down the marginal contribution to total risk from underlying securities to the portfolio risk, in normal times.
The aim of risk attribution is to specify the contribution from each security to the overall risk of the portfolio. Simply summing the risk of each individual security will not equate to the portfolio’s risk because it does not account for the role of correlation. Securities that are highly correlated with the portfolio are riskier than ones that are negatively correlated. In the former case, the security tends to co-move with the rest of the portfolio, thus offering little diversification. A negative correlation, by contrast, actually reduces risk, since it acts as a hedge for the rest of the portfolio.
We use a measure called Marginal Contribution to Total Risk (MCTR) for risk attribution. It basically isolates the riskier positions as the ones with all three characteristics:
- Larger allocations
- Higher individual volatilities
- More correlation to the rest of the portfolio
Conversely the less risky positions have opposite properties:
- Smaller allocations
- Lower individual volatilities
- Less correlation (preferably negative) to the rest of the portfolio
The PL matrix contains the simulated PLs, in the base currency of the portfolio, both for underlying securities in the portfolio as well as exogenous indices: %%\small \left[PL_{secs}|PL_{factors} \right] %%. These amounts are then converted to percent returns by dividing the %% \small PL_{secs} %% by the net liquidating value of the portfolio (NLV) and the %%\small PL_{factors} %% by their unit prices.
$$ \small \displaystyle \left[\overline{R}_s | \overline{Z} \right] = \left[PL_{secs}/NLV_{port}|PL_{factors}/NLV_{factors} \right] $$
The net liquidating value of the portfolio, %%\small NLV_{port} %%, used in the formula above is the amount of base currency that would be instantaneously generated upon sale of the whole portfolio. It is also known as portfolio "equity". It is comprised of cash (unencumbered and margin) as well as market value of positions purchased with cash, such as stocks and premium paid for options. The following table describes the NLV formulas for some securities:
NLV Considerations
The net liquidating value of the portfolio is the sum of net liquidating value from all securities. The larger the %% \small NLV_{port} %% is, the smaller the risk for the portfolio i.e. a larger base amount (denominator) to support the same distribution of PL (numerator).
To properly model the risk statistics, aggregate encumbered margin needs to be explicitly supplied by the user. This can be done with a margin security, or supplying the NLV of the portfolio explicitly.
Negative cash is allowed and represents borrowed money. It effectively reduces the denominator and makes the portfolio riskier.
Everysk calculates the marginal contribution from each security to portfolio risk by first projecting their simulated returns to simulated factors (indices). Performing all the calculations at a “projected” factor space will yield a flexible data structure, enabling risk contributions from positions or factors to be interchangeably displayed:
$$ \overline{Z}_{FR} = \left[ \begin{array}{c|c} \overline{Z} & \overline{R}_s - \overline{Z} * \overline{d}_s \end{array} \right] $$
%% \small \overline{Z} %% are %% \small n \times k %% simulated factors, where %% \small n %% is the number of simulations and %% \small k %% the number of factors. %% \small \overline{R}_s %% are the simulated security PL’s with dimensions %% \small n \times m %% where %% \small m %% is the numbers of securities and %% \small \overline{d}_s %% are the %% \small k \times m %% forward looking transfer coefficients from securities to factors, calculated from simulations.
%% \small \overline{R}_s - \overline{Z} * \overline{d}_s %% in the equation above represents the residuals from projecting security simulations into factor simulations. By doing so, the marginal risk contributions can be retrieved by security or by factor interchangeably. The matrix of exogenous factors plus residuals, %% \small \overline{Z}_{FR} %%, has dimensions %% \small n \times \left(k+m\right) %%. Given this augmented matrix, the marginal risk contribution is:
$$ MCTR = (\begin{array}{} \left[ \begin{array}{cccccc} \overline{d}_s \\ --- \\ \overline{I} \end{array} \right] & .* & \large \Sigma_{Z_{FR}} & * & \left[ \begin{array}{} \overline{d}_p \\ --- \\ \overline{1} \end{array} \right] \end{array} ) / \sigma(\sum_s R_s) $$
where %% \small \sigma(\sum_s R_s) %% represents the portfolio risk, i.e. the one standard deviation around the mean of the simulated portfolio P&L (equivalent to the sum of all securities' P&Ls). %% \small \overline{d}_p %% is a %% \small k \times 1 %% vector with the overall portfolio transfer coefficients to factors, %% \overline{I} %% is the identity matrix with dimensions %% \small m \times m %%, %% \overline{1} %% is a vector of ones with dimensions %% \small m \times 1 %% and %% \small \large \Sigma_{Z_{FR}} %% is the covariance of the factors plus residuals, with dimension %% \small \left(k+m\right) \times \left(k+m\right) %%.
The result from the above equation, %% \small MCTR %%, represents the marginal risk contributions “projected” into the exogenous factors, whereby the residuals have been properly taken into account. The dimensions of this matrix are %% \small \left(k+m\right) \times m %%:
$$\small \displaystyle MCTR = \left[ \begin{array}{cccc} mctr_{1,1} & mctr_{1,2} & \cdot & mctr_{1,m} \\ mctr_{2,1} & mctr_{2,2} & \cdot & mctr_{2,m} \\ \cdot & \cdot & \cdot & \cdot \\ mctr_{k,1} & mctr_{k,2} & \cdot & mctr_{k,m} \\ --& --&--&--\\mctr_{res,1} & 0 & \cdot & 0 \\ 0 & mctr_{res,2} & \cdot & 0 \\ \cdot & \cdot & \cdot & \cdot \\ 0 & 0 & \cdot &mctr_{res,m} \end{array}\right] $$
Each row is a factor (plus %% \small m %% rows that represent residuals as described below) and each column is a security. The first %% \small k %% rows are the projections of each security to those %% \small k %% factors. The remainder %% \small m %% rows are the individual residuals, positioned on a diagonal matrix. We then collapse the %% \small m \times m %% diagonal residuals into a single row, %% \small k+1 %%:
$$ \small \displaystyle MCTR = \left[ \begin{array}{cccc} mctr_{1,1} & mctr_{1,2} & \cdot & mctr_{1,m} \\ mctr_{2,1} & mctr_{2,2} & \cdot & mctr_{2,m} \\ \cdot & \cdot & \cdot & \cdot \\ mctr_{k,1} & mctr_{k,2} & \cdot & mctr_{k,m} \\ --& --&--&--\\mctr_{res,1} & mctr_{res,2} & \cdot & mctr_{res,m} \end{array}\right] $$
Then, we can efficiently retrieve the marginal risk contributions per factor (adding all the columns of a single row) or alternatively per securities (adding all the rows of a single column). Because the residuals were properly taken into account, we will always get the same total risk for the portfolio, regardless how we accumulate these contributions.
An important remark is that the process above does not linearize the behavior of securities. We are merely “storing” the density of the PL distribution for a security in various factor buckets. The residual will fully recover the original PL distribution, including any asymmetric behavior.
Other bottom-up aggregations for marginal contribution to portfolio risk are trivial to compute: simply sum all the columns belonging to the same aggregation set %% \small A %%, i.e. representing same market capitalization, liquidity, sector or any other criteria:
$$ \small \displaystyle \sum_{l \in A}(\sum_{i=1}^{k} (mctr_{i,l}) + mctr_{res,l}) $$
STEP 9: CVaR - CONDITIONAL VALUE AT RISK
Step 8 above described how Everysk calculates the marginal contribution to risk such that granularity at the security level is preserved. Next, we show how the contribution from each security to the “tails” of the portfolio distribution are computed.
Given the simulation for the overall portfolio, %% \small \overline{R}_p = \sum_s R_s %%, we initially sort the values in ascending order. The same order is used to sort other matrices, such as: %% \small \overline{Z} %% and %% \small \overline{\Pr}_{1}^{*} %% (these matrices/vectors are explained below). We then crop the sorted matrices at the confidence interval. For example: if the confidence interval is 95% and the number of simulations is 10000, we use only the first 5%, or 500 samples. Re-sorted and cropped vectors are denoted with an asterisk superscript:
The contribution to CVaR from each security is calculated in 2 steps:
- First, the re-sorted and cropped security simulations are projected to the factors, similar to the procedure for calculating MCTR:
$$ \small \displaystyle \overline{Z}_{{FR}_{i}}^{*} = \left[ \begin{array}{c|c} \overline{Z}^{*} & \overline{R}_{{s}_{i}}^{*} - \overline{Z}^{*} * \overline{d}_{{s}_{i}} \end{array} \right] , \forall i $$
The formula above augments the factor simulations, %% \overline{Z}^{*} %%, with residuals from each security in the portfolio. The dimensions of %% \small \overline{Z}_{{FR}_{i}}^{*} %% are %% \small n2 \times \left(k+1\right) %%, where %% \small n2 %% is the number of paths representing the “left tail” and %% \small n2 << n %%. %% \small \overline{Z}^{*} %% is %% \small n2 \times k %%, %% \small \overline{R}_{{s}_{i}}^{*} %% is %% \small n2 \times 1 %% and %% \small \overline{d}_{{s}_{i}} %% is %% \small k \times 1 %%.
- Then we proceed to calculate the contribution from each security to the portfolio conditional VaR (CVaR), projected onto factors:
$$ \small \text{CVaR}_{i} = \sum_{\text{rows}} ( \begin{array}{} \overline{Z}_{{FR}_{i}}^{*} & .* & \left[ \begin{array}{c|c} d_{{s}_{i}} & 1 \end{array} \right] & .* & \overline{\Pr}_{1}^{*} \end{array} ), \forall i $$
The matrix %% \small \left[ \begin{array}{c|c} d_{{s}_{i}} & 1 \end{array} \right] %% has dimensions %% \small 1 \times \left(k+1\right) %% and is multiplied element-wise to the rows of %% \small \overline{Z}_{{FR}_{i}}^{*} %%. The vector of probabilities %% \small \overline{\Pr}_{1}^{*} %% has dimensions %% \small n2 \times 1 %%, and is multiplied element-wise to the columns of %% \small \overline{Z}_{{FR}_{i}}^{*} %%. The summation is over the %% \small n2 %% rows. The figure below is highlighting the calculations for the first security in the portfolio, projected onto the first factor.
Up to now the probabilities %% \small \overline{\Pr}_{1}^{*} %% have been equally weighted. We will show in Step 10 how they can be perturbed to reflect different stress tests (views). The summation above is performed over the columns and because equal weighted probabilities are multiplied element wise, this is akin to calculating the mean of the tails which is the definition of CVaR. The result, %% \small CVaR_{i} %% has dimensions %% \small 1 \times \left(k+1\right) %%. After the calculations above are performed for each security, we collect their transposes into the columns of a %% \small \left(k+1\right) \times m %% matrix:
$$ \small \displaystyle CVaR = \left[ \begin{array}{} \small CVaR_1^{T} & \cdots & \small CVaR_m^{T}\end{array}\right]=\left[ \begin{array}{cccc} cvar_{1,1} & cvar_{1,2} & \cdot & cvar_{1,m} \\ cvar_{2,1} & cvar_{2,2} & \cdot & cvar_{2,m} \\ \cdot & \cdot & \cdot & \cdot \\ cvar_{k,1} & cvar_{k,2} & \cdot & cvar_{k,m} \\ --& --&--&--\\cvar_{res,1} & cvar_{res,2} & \cdot & cvar_{res,m} \end{array}\right] $$
Similar to marginal contribution to risk, the CVaR matrix allows Everysk to quickly retrieve the contribution to portfolio CVaR from underlying securities (adding all the rows of a single column) or alternatively from underlying factors (adding all the columns of a single row). Because the residuals were properly incorporated into the calculations, we will always retrieve the same portfolio CVaR, regardless how we accumulate it. We use this technique throughout Everysk.
Other bottom-up aggregations for CVaR are trivial to compute: simply sum all the columns belonging to the same aggregation set %% \small A %%, i.e. representing same market capitalization, liquidity, sector or any other criteria:
$$ \small \displaystyle \sum_{l\in A}(\sum_{i=1}^{k} (cvar_{i,l}) + cvar_{res,l}) $$
The same data structure can consistently perform aggregation and projection of the tail properties in the portfolio, for each shock.
We described above how Everysk calculates the contribution from positions and factors to the worst x-percentile of the portfolio PL distribution (CVaR-). It is trivial to calculate the contribution from positions and factors to the best x-percentile of the portfolio distribution. All we need to do is to revert the sorting used in the previous calculations and proceed exactly the same way. We call this measure CVaR+.
In the calculations above, the vector of probabilities %% \small \overline{\Pr}_{1}^{*} %% was equally weighted. In what follows we show how Everysk’s risk engine “perturbs” these probabilities to satisfy various exogenous shocks.
STEP 10: STRESS TESTS
Stress tests are calculated with the same simulations delineated in previous Steps, but with a new set of probabilities, calculated to satisfy certain user-defined views. For example: assuming %% \small \overline{Z}_{j} %% is one of the exogenous factors that was simulated as per above description and we want to measure what might happen with the portfolio if this factor declines by 4%. Then, there will be a new set of probabilities %% \small \overline{\Pr}_{2} %% that satisfy this constraint and at the same time has the minimum amount of deviation (distance) from the original probabilities %% \small \overline{\Pr}_{1} %%
In what follows we will provide the intuition on how these %%\small \overline{\Pr}_{2} %% probabilities are found, followed by the formal mathematical formulation.
Let’s describe a hypothetical problem. Assume there is:
- An idealized simulated index, %% \small \overline{Z}_{discrete} %% with 10000 entries that can only take 3 discrete values: -5% with 5% probability of occurrence, -2% with 90% probability of occurrence and +3% with 5% probability of occurrence (in a real application this simulated exogenous factor is a vector of potential outcomes whereby the correlation with other portfolio securities has already been taken into account through some multivariate process as per steps 1 to 6 above).
- An initial probability set called %% \small \overline{\Pr}_1 %% = [ 1/10000, 1/10000, … , 1/10000] that equally weights all the simulation paths from %% \small \overline{Z}_{discrete} %%.
- A view that the expected return of this idealized index %% \small \overline{Z}_{discrete} %% will be lower or equal than 4% .
Then the goal is:
Calculate a second set of probabilities %% \small \overline{\Pr}_{2} %%, such that: a) the view is satisfied and b) %% \small \overline{\Pr}_{2} %% is as “close” as possible to %% \small \overline{\Pr}_{1} %%.
The probability sets above, %% \small \overline{\Pr}_{1} %% and %% \small \overline{\Pr}_{2} %%, are called prior and posterior respectively.
Figure 1 - A (sorted) theoretical index with 3 outcomes and equally weighted prior
We need to solve for %% \small \overline{\Pr}_{2} %% to be as “close” as possible to %% \small \overline{\Pr}_{1} %%. In this illustrative example we minimize a simple euclidean distance: %% \small \sqrt{\sum_{i} ({\overline{\Pr}_{2}}_{i} - {\overline{\Pr}_{1}}_{i})^2 } %% with the following constraints:
- Each %% \small {\overline{\Pr}_{2}}_{i} %% is bounded between 0 and 1: %% \small 0 \le {\overline{\Pr}_{2}}_{i} \le 1 %% as they are all probabilities.
- The sum of all elements of %% \small \overline{\Pr}_{2} %%, just like %% \small \overline{\Pr}_{1} %%, has to be 1: %% \small \sum_{i} {\overline{\Pr}_{2}}_{i} = 1 %%
- The inequality has to be satisfied: %% \small \sum_{i} ({\overline{Z}_{discrete}}_{i} * {\overline{\Pr}_{2}}_{i}) \le 4 \% %%.
We will start with a guess for %% \small \overline{\Pr}_{2} %%, assuming that all the probability is concentrated in the paths corresponding to -5% index returns. See Figure 2.
Figure 2 - A concentrated %% \overline{\Pr}_{2} %%
Our “concentrated” %% \small \overline{\Pr}_{2} %% satisfies 1) and 2) above. It also satisfies 3) as the sum-product is -5%. But is this the best solution? The distance to %% \small \overline{\Pr}_{1} %% would be:
$$ \small \displaystyle d_{21} = \sqrt {( [ 1/500 - 1/10000]^{2} * 500 + [ 0 - 1/10000]^{2} * 9500)} = 0.043 $$
Another viable solution distributes the probabilities of %% \overline{\Pr}_{2} %% as per figure 3:
Figure 3 - A less concentrated %% \overline{\Pr}_{2} %%
%% \overline{\Pr}_{2} %% still satisfies 1) and 2). The sum-product is also satisfied (-4.24%) and the new euclidean distance is:
$$ \small \displaystyle d_{21} = \sqrt {( [ 1/650 - 1/10000]^{2} * 500 + [ 2.43e^{-5} - 1/10000]^{2} * 9500)} = 0.033 $$
Thus, the second probability set is an improved solution as it satisfies all the constraints with less departure from the prior probabilities. The illustrative example above can be framed as a convex optimization problem where the objective function is to find the %% \overline{\Pr}_{2} %% that minimizes the distance between posterior and prior, and also satisfies inequality/equality constraints (views) and equality constraints (probabilities adding to one). In what follows, we complement the intuition above with more formal derivations:
The convex optimization stated above is:
$$ \small \displaystyle \overline{\Pr}_{2} = \arg\min_{p \in C} \varepsilon (p | \overline{\Pr}_{1}) $$
where %% \small \varepsilon %% is a distance measure. We use a simple entropy measure:
$$ \small \displaystyle \overline{\Pr}_2 = \arg\min_{p \in C} (\sum_{j=1}^{n} \left[ x_j (ln(x_j)-ln(\overline{\Pr}_1)) \right]) $$
Subject to the following constraints:
- %% \small 0 \le {\overline{\Pr}_{2}}_{i} \le 1 %%
- %% \small \sum_{i} {\overline{\Pr}_{2}}_{i} = 1 %%
- %% \small \sum_{i} ({\overline{Z}_{j}}_{i} * {\overline{\Pr}_{2}}_{i}) \le 4 \% %%
where the summation is over the number of simulations, %% \small n %%. The constraint set %% \small C %% is comprised of equality and inequality constraints aggregated in 2 separate matrix equations:
The equality matrix:
$$ \small \displaystyle A_{eq}*x=b_{eq} \Rightarrow \left[ \begin{array}{} 1 & 1 & 1 & \cdot & 1\\ Z_{k,1} & Z_{k,2} & Z_{k,3} & \cdot & Z_{k,n} \\ \cdot & \cdot &\cdot &\cdot & \cdot \\ Z_{l,1} & Z_{l,2} & Z_{l,3} & \cdot & Z_{l,n} \end{array} \right] * \left[ \begin{array}{} x_1 \\ x_2 \\ \cdot \\ x_n \end{array} \right] = \left[ \begin{array}{} 1 \\ val_1 \\ \cdot \\ val_{k1} \end{array}\right] $$
The first row forces the probabilities to sum to one. The other rows are constraints on expectations: the formula above is illustrating equality constraints on 2 hypothetical factors, %% \small Z_k %% and %% \small Z_l %%, which are two columns from the matrix of simulated exogenous factors, %% \small Z %%. The matrix %% \small A_{eq} %% above has dimensions %% \small (k_{1}^{*} \times n) %%, where %% \small k_{1}^{*} %% is the number of equality constraints ( %% \small k_{1}^{*} = k_1+1 %%, as there needs to be an additional constraint to force probabilities to add to one) and %% \small val_1 \cdots val_{k1} %% are the expected values in percent.
The inequality constraint:
$$ \small \displaystyle A_{ineq}*x < b_{ineq} \Rightarrow \left[ \begin{array}{} Z_{f,1} & Z_{f,2} & Z_{f,3} & \cdot & Z_{f,n} \\ \cdot & \cdot &\cdot &\cdot & \cdot \\ Z_{j,1} & Z_{j,2} & Z_{j,3} & \cdot & Z_{j,n} \end{array} \right] * \left[ \begin{array}{} x_1 \\ x_2 \\ \cdot \\ x_n \end{array} \right] < \left[ \begin{array}{} val_{k1+1} \\ \cdot \\ val_{k1+k2} \end{array}\right] $$
The two rows in the example above are inequalities on expectations. The inequality constraint matrix has %% \small k_{2}^{*} %% rows.
The optimization problem, as stated above, has %% \small n %% unknowns, i.e. the new probabilities associated with each simulation path. Instead of solving this large and complex optimization problem, we use the dual formulation which is much more manageable and has only %% \small k_{1}^{*}+k_{2}^{*} %% unknowns, equivalent to the number of constraints dictating the problem. Once those lagrangians are found, %% \small \overline{\Pr}_2 %% can be easily recovered.
Thus a CVaR that satisfies certain user-defined views, which we call conditioned CVaR, would be calculated similarly to the unconditional one from Step 9, but using the posterior probabilities rather than the prior:
$$ \small \displaystyle CVaR_{i} = \sum_{\text{rows}} ( \begin{array}{} \overline{Z}_{{FR}_{i}}^{*} & .* & \left[ \begin{array}{c|c} d_{{s}_{i}} & 1 \end{array} \right] & .* & \overline{\Pr}_{2}^{*} \end{array} ), \forall i $$
An intuitive way to explain the effect of a new probability set that weighs more heavily certain negative scenarios is: (a) The unconditioned CVaR- (5-percentile with 10000 paths) will average the lowest 500 samples; (b) The conditioned CVaR- with same confidence will average a smaller number of samples in the left tail, say 430 for example, as the probabilities will accumulate to 5% faster than the unconditional case. Thus, CVaR- from (b) will represent a larger potential loss than CVaR- from (a).
Probabilities for multiple user-defined views can be calculated in parallel by changing the constraints above. For example: The portfolio below is being stress tested with various weekly shocks on Russell index (from -3% to +3%). Only one simulation needs to be performed and the only change from each grey bar to the next is a new set of probabilities, %% \small \overline{\Pr}_2 %%, that needs to be calculated. Each bar is calculated in parallel with 7 convex optimizations with equality constraints (no inequality constraints are used in these stress tests).
For example, the constraint for the leftmost bar is:
$$ \small \displaystyle \left[ \begin{array}{} 1 & 1 & 1 & \cdot & 1\\ Z_{RUT,1} & Z_{RUT,2} & Z_{RUT,3} & \cdot & Z_{RUT,n} \end{array} \right] * \left[ \begin{array}{} x_1 \\ x_2 \\ \cdot \\ x_n \end{array} \right] = \left[ \begin{array}{} 1 \\ -0.03 \end{array}\right] $$
APPENDIX 1: RETRIEVING THE PROBABILITY OF DEFAULT
We adopt a time-series approach, whereby observed equity values and liability thresholds for the company are used to calibrate the corresponding unobserved company values and volatility of assets of the company.
1. Calibration
First we collect one year of historical stock prices for the company we are simulating corporate bonds: (%% \small \overline{S}=\left[S_0,S_1, \cdots , S_n \right] %%).
Then we calibrate the volatility of assets with the following iterative procedure, where K is the iteration:
$$ \small \displaystyle \left[ \begin{array}{ll} \sigma_{0}^a &= 100 \\ \\ \sigma_{1}^a &= \sigma_{\text{stock}} * (S_n * \text{shares}_{n}) / (S_n * \text{shares}_{n} * D^a ) \\ \\ k &=1 \\ \\ \text{while} & (\sigma_{k}^a - \sigma_{k-1}^a) > \sigma_{\text{threshold}}: \\ \\ \phantom{aaa} & \overline{V}_{k}^a = g^{-1}\left[\overline{E},\sigma_{k}^a\right] \\ \\ \phantom{aaa} & \overline{R}_{k}^a = \text{logRet}(\overline{V}_{k}^{a}) \\ \\ \phantom{aaa} & \sigma_{k+1}^a = \text{std}(\overline{R}_{k}^a) \\ \\ \phantom{aaa} & k = k+1 \\ \\ \text{end while} \end{array} \right.$$
Where:
* %% \small \displaystyle \overline{E} : %% is a vector with the daily market capitalizations of the firm, defined as stock price times the number of shares outstanding every day - (%% \small \displaystyle S_t \times \text{shares}_{t} %%).
* %% \small \overline{D}^a : %% is a vector with the daily level of total debt, also referred as default point.
* %% \small \overline{V}_{k}^a : %% is a vector with the daily value of the firm’s assets, at iteration K.
* %% \small \overline{R}_{k}^a : %% is a vector with the daily log returns of (%% \small \overline{V}_{k}^a %%), at iteration K.
* %% \small \sigma_{k}^a : %% is a number representing the annualized firm’s asset volatility, at iteration K.
Additionally, %% \small g^{-1}[] %% is the inverse relationship of asset as a function of market capitalization (stock), which is solved by Newton Raphson. The forward non-linear equation is:
$$ \small \displaystyle \overline{E} = g\left[\overline{V}_{k}^a,\sigma_{k}^a\right] $$
And the daily components of the above formula are (subscript K dropped for legibility):
$$ \small \displaystyle E_t = g(V_{t}^a,\sigma^a) = V_{t}^a \Phi (d_t) - D_{t}^a * e^{-r(\text{T}-t)} * \Phi (d_t - \sigma^a \sqrt{\text{T}-t}) $$
And
$$ \small \displaystyle d_t = \frac{ln(V_t^a/D_{t}^a)+(r+0.5\overline{\sigma^a}^2)}{\sigma^a\sqrt{\text{T}-t}} $$
%% \small \displaystyle T %% in the above equations represent the maturity of the bond we are pricing and %% \small \displaystyle r %% is the risk free rate. The final two outcomes from the time-series calibration above are:
* %% \small \sigma_{final}^a : %% a number representing the converged annualized firm’s asset volatility.
* %% \small V_{final}^a : %% a number representing the converged firm value.
2. Retrieving the probability of default
Finally the probability of default (PD) can be retrieved using the 2 outcomes from the calibration above, as follows:
$$ \small \displaystyle \text{PD}=1.0 -\Phi\left[ \frac{1}{\sigma_{final}^a \sqrt{\text{T}}} \left[\ln{\left(\frac{V_{final}^{a}}{D_{T}^a}\right)} + \text{T}\left(r - 0.5 \overline{\sigma_{final}^a}^2 \right) \right] \right] $$
APPENDIX 2: DATA STRUCTURES
The results from Steps 8 -10 are stored in data constructs that can efficiently recover contributions from underlying aggregations (bottom-up) or projections (top-down). Four different risk properties share the same construct, namely:
- MCTR : Marginal contribution to Total Risk
- CVaR- : Conditional Value-at-Risk on the negative side of the PL distribution
- CVaR+: Conditional Value-at-Risk on the positive side of the PL distribution
- EV: Mean of the PL distribution
Each one of the above properties is calculated at the position level, but stored on a projected space of factors+residual: rows are factors and columns are positions. We have 4 matrices, one per measure above.
The following schematics show how relevant information is retrieved (the highlighted areas indicate which cells need to be added):
Contribution to risk measure (MCTR, CVaR-, CVaR+ or EV) from an individual position
Contribution to risk measure (MCTR, CVaR-, CVaR+ or EV) from IT sector. All columns that pertain to positions from the IT sector should be added.
Contribution to risk measure (MCTR, CVaR-, CVaR+ or EV) from individual factor
Contribution to risk measure (MCTR, CVaR-, CVaR+ or EV) from systematic sources. All rows, except from residual should be added.
Contribution to risk measure (MCTR, CVaR-, CVaR+ or EV) from idiosyncratic sources. The residual row should be added.