I have a problem calculating VaR with the Monte Carlo Simulation.

I followed the next steps and would like know if it is a right way to calculate VaR or if I need something more?

The steps

  1. Generate random numbers

  2. Define Correlation Matrix

  3. Define volatilities, drift and weights

  4. Perform a Cholesky decomposition of the correlation matrix

  5. Multiply random numbers by the Cholesky matrix

  6. Multiply result of step 5 by volatility and drift

  7. Take the exponent of results from step 6

  8. Take log returns of step 7 results

  9. Create the weighted portfolio returns

  10. Calculate the VaR (use percentile function at right confidence interval)

  11. Calculate the volatilites of your random numbers

  12. Cross-check with analytical VaR

  • 5
    $\begingroup$ possible duplicate of Is there a step-by-step guide for calculating portfolio VaR using monte carlo simulations $\endgroup$ – airstrike May 27 '15 at 5:29
  • 2
    $\begingroup$ #13 bake on high for 50 mins or until you run out of patience. $\endgroup$ – eddiewould Sep 3 '15 at 9:49
  • $\begingroup$ The first step is "generate random numbers" and then later you calculate the correlations. But in fact you need the correlations to generate the random numbers ... so what is first? $\endgroup$ – Ric Mar 3 '16 at 7:56
  • $\begingroup$ @Richard I don't think you need the correlation matrix before generating the random numbers, you can do it afterwards (see here). $\endgroup$ – SRKX Jul 5 '16 at 1:53
  • $\begingroup$ Random numbers is bullet point 1...correlation matrix comes afterwards... I think this is already just as you say.. Right? $\endgroup$ – Ric Jul 5 '16 at 5:36

Concerning the weighted portfolio returns. If you have weights $w_i$ and individual returns $r_i$ of your assets then it is only precisely true that the portfolio return $r$ is given by the scalar product $$ r = \sum_{i=1}^n w_i r_i $$ if $r_i$ is the usual arithmetic/simple return (not logreturn).

Thereby I mean the simple return $$ r = P_{t+1}/P_t - 1 $$ as opposed to the log-returm $$ R = \ln(P_{t+1}/P_t) = \ln P_{t+1} - \ln P_{t+1}. $$ Switching between the two is easy as $$ R = \ln(1+r) $$ and $$ r = \exp(R)-1. $$ Logreturns are good for statistical modelling as they range from $-\infty$ to $\infty$ and that's where the useful distributions live on. For a portfolio should use the geometric return.

What you can do:

  1. generated random log-returns for each asset, convert to somple returns.
  2. aggregate to the simple-returns of the portfolio
  3. convert the portfolio-returns to log-returns
  4. calculate a quantile.

For more information on returns you can look here and here.


I can share how a pricing application (eg: QuantLib) calculates the VaR with Monte-Carlo.

  1. Generate a vector of independent Gaussian random numbers. A typical (and simple) implementation is Box-Muller. I prefer the inverse transform method, and I think this is also the default for QuantLib.

  2. Now, we will need to generate correlated returns. We will need a correlation matrix. Decompose the matrix by Cholesky or Singular Value Decomposition. SVD is a stable version but slower. Personally, I have used both of them and found both satisfactory.

  3. Use the corrected returns to apply for a simulation scheme. I mean, substitue the random correlated numbers into the diffusion terms. Usually, we use the Eurler scheme, but you can also use the Milstein scheme. The Eurler scheme approximates up to the second-orders.

  4. Use the scheme to generate a list of independent simulation paths. Price each path upon maturity.

  5. Now you should have a list of payoffs, one for each path. Discount them back and calculate the quartile. This will be your VaR.

When you report your VaR, you will always need to include your significance level and time horizon. The estimate by itself is meaningless.


You have been not really precise in the explanation of your steps, however remember that "random number" is a rather generic expression since the method you describe can be applied to a restricted class of distribution ( among which normal and t ). Considering I am not sure about your methodology my advice is to follow a more classical approach, therefore define the distribution of your risk factors and generate them ( apriori any distribution is fine) . Once you have a sample you can compute the losses from the risk factor making explicit the relation L=-V(t+1)+V(t)=-f(t+1,Z(t+1))+f(t,Z(t))where Z are the risk factors ...Then sort all the losses you have simulated and take the (q*(# simulations)) highest value to obtains VaR(q)


I would say, the Monte Carlo may be not necessary in your case. You may look through the paper http://www.sciencedirect.com/science/article/pii/S0167715215003247

enter link description here

Good Luck!

  • $\begingroup$ What? I tell you a new approach, which is more easier in your case. It is your business to look into it. Why it is useless? $\endgroup$ – Aborna Mar 6 '16 at 14:14

Your Answer

