Monday, October 1, 2018

Is there a step-by-step guide for calculating portfolio VaR using monte carlo simulations


I am trying to determine a step-by-step algorithm for calculating a portfolio's VaR using monte carlo simulations. It seems to me that the literature for this is extraordinarily opaque for something as common as VaR. To simplify things, I want to initially consider only a portfolio of stocks and at a later stage include derivatives.


Here are the steps I have managed to pickup using different sources:




  1. Estimate the portfolio's current value $P_0$.

  2. Build the portfolio's covariance matrix using stock historical data.

  3. Create the Cholesky decomposition of the covariance matrix.

  4. Generate a vector of n independent standard normal variates

  5. multiply the matrix resulting from the Cholesky decomposition with the vector of standard normal variates in order to get a vector of correlated variates.

  6. Calculate the assets' terminal prices using geometric brownian motion. $$ S_i(T) = S_i(0) \exp\left(\left(\mu-\frac{\sigma^2}{2}\right)T + \sigma\sqrt{T}\epsilon_i\right)$$ where $\epsilon_i$ corresponds to the correlated random variate for asset i obtained from the vector of correlated variates.

  7. reevaluate the portfolio's value at time $T$, $P_T$, using the stock prices generated in the previous step.

  8. Calculate the portfolio return using $$R_T=\frac{P_T - P_0}{P_0}$$

  9. Repeat steps 4-8 many times (for example $n=10000$ simulations).


  10. Sort the returns in ascending order.


I have the following questions:



  1. How do I extract the VaR from the sorted portfolio returns?

  2. How do I define the time horizon T?

  3. I have seen examples where the whole stock path is discretized using a relation of the form: $$ S_{(t+dt)} = S_t + S_t\mu dt + S_t \sigma \sqrt{dt} \epsilon_i $$ Do we need to do that or simply evaluating the stock's terminal price using the formula in point 6 is enough?



Answer



You have the correct approach.



(1) The simulation generates sampled portfolio values, $P_1,P_2, \dots, P_n$ at time $t=T$. VaR is specified as a left-tail percentile.


Order the sample as


$$P_{(1)} \leq P_{(2)} \leq \dots \leq P_{(n)}.$$


If you are considering $VaR_\alpha$ at the $100(1-\alpha) \% $ confidence level , then choose the smallest integer $k$ that exceeds $n\alpha$


For example, at the $99 \%$ level $\alpha = 0.01$. With $n=10,000$ simulations, $k = (10000)(0.01) = 10$ and


$$VaR_{99 \%} = P|_{t=0} -P_{(10)} $$


expressed as the worst loss relative to the initial portfolio value the would be exceeded with probability less than $0.01$.


(2) The time horizon can be arbitrary, but banks usually calculate VaR at $1$-day and $10$-day time horizons. The $10$-day Var is used to set market-risk capital requirements and the $1$-day VaR is used in back-testing to check the fidelity of the calculation. For example, given a calculated $1$-day VaR at the $99\%$ confidence level, then the portfolio is expected to lose a larger amount over a $1$-day period no more than $1$ day out of $100$. The test is conducted by determining the number of times the VaR threshold would have been exceeded over the past $100$ days (using historical return observations) and the current composition of the portfolio. If the number of exceedences is too large, then bank regulators will impose an increased capital penalty. An allowance is made for sampling error, so the test requirement might be that VaR threshold should not be exceeded more than $2$ times out of $100$, for example.


In the determination of credit loss due to counterparty default, the time horizon might be as long a year. In the determination of credit exposure the time horizon could be vary long -- for example, out to the longest time-to-maturity among all the derivatives in the portfolio.


(3) In your example, you selected a stochastic process with an exact solution for the joint distribution of asset prices at the time horizon. Simulating the evolution of the asset prices at intermediate time steps was not necessary. This might not be possible if the risk factors used to determine future portfolio value have more complicated stochastic models that preclude an exact solution over a longer time horizon. Another case where time-stepping over shorter intervals may be necessary is when the portfolio has many path-dependent derivatives such as knock-out options.



Different situations may arise in practice. For example a bank may choose to calculate $1$-day VaR and estimate $10$-day VaR by multiplying by $\sqrt{10}$, rather than simulate in discrete $1$-day steps over the $10$-day horizon. This would be beneficial if it leads to a lower capital requirement. In general it is best practice to make the most accurate determination. Trying to game the calculation may lead to a penalty.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...