3
$\begingroup$

In trying to find VaR for 5 financial assets with prices over a long period of time(2000 days worth of data) how would I do the following:

  1. Carry out monte-carlo simulation in order to find a VaR value, assuming all 5 assets are standard normally distributed.
  2. Carry out monte-carlo simulation for all 5 assets to find a VaR value, assuming they follow a student-t distribution with 10 degrees of freedom?

I am trying to do this at both the 95% and 90% confidence levels, and simulate the data with 10,000 replications. Any help would be greatly appreciated. I have already created a Cholesky Decomposition Matrix but not sure how to use the data in it to get the VaR figure.

$\endgroup$
  • $\begingroup$ might there be a way to calculate this using excel? $\endgroup$ – user19182 Jan 27 '16 at 19:00
  • 4
    $\begingroup$ Good to see that the doc is managing his financial future prudently. $\endgroup$ – Forgottenscience Jan 28 '16 at 0:25
1
$\begingroup$

There are a number of different ways to accomplish your goal. One would involve modelling each financial time series and then connecting these marginal distributions using a copula. Monte Carlo is then a matter of simulating the marginals and the copula.

In using your Cholesky matrix, you are implicitly using an elliptical distribution (think of Gaussian and Student t). If you want to for example create a Gaussian MC simulation in which the marginal distributions are Gaussian and the copula is Gaussian, then you only need the standard deviations of each time series for the marginal distributions and the standard MC simulation approach.

In "pseudocode" the steps are (I assume zero drift for simplicity)

1) Generate uniform random numbers on the interval [0,1] (like Rand() in Excel)

2) Convert each of the uniform randoms to standard Gaussian (0,1) randoms (like NORMSINV)

3) Multiply the Cholesky matrix times the Gaussian random vector to create a vector of correlated randoms for each simulation "date"

4) For each underlying, multiply the new "correlated Gaussian" by the standard deviation corresponding to that underlying/asset

5) Using your portfolio weights and the newly simulated asset returns, calculate the portfolio return

6) Calculate your statistics (like the PERCENTILE function in Excel)

The above series of steps can be converted to other marginal distributions apart from Gaussian, and one can use more realistic copulas than the Gaussian copula.

In modelling your distributions and copula, you are making assumptions which lead to model risk. That is not to say that this is a bad approach, but one just needs to be aware of the fitting errors that arise when performing such an exercise.

There is another simulation method that you might consider which is very easy, and which could be used as a check on the MC method - a sort of "bootstrapping historical simulation".

Again in pseudocode:

1) Convert the price series to log return series

2) Number the data "dates" from 1 to 2000 (the size of your time series)

3) k = 1

4) Choose a random integer i equally likely to be from 1 to 2000 inclusive

5) Apply the returns from "date i" to today's prices (the base price we have today)

6) Using the portfolio weights calculate the fluctuation in portfolio value and record in a vector with index k

7) k = k + 1

8) if K < 10,001 go to step 3) above

9) Calculate the VaR using the vector of portfolio returns (like PERCENTILE in Excel)

If this "historical bootstrap VaR" is extremely different from your Gaussian MC VaR then you probably need to use a more realistic set of marginal distribution assumptions and copula assumptions. A good first step would be to try the Student t distributions and copula.

$\endgroup$
0
$\begingroup$

Have you looked at the PerformanceAnalytics R package functions? It should allow you to calculate delta normal Var quite easily. I recommend you look at the instructions manual but here is the code for it:

VaR(R = NULL, p = 0.95, ..., method = c("modified", "gaussian",
"historical", "kernel"), clean = c("none", "boudt", "geltner"),
portfolio_method = c("single", "component", "marginal"), weights = NULL,
mu = NULL, sigma = NULL, m3 = NULL, m4 = NULL, invert = TRUE)

what you need to look at is the method, gaussian being the n-distribution.

to go across your assets (columns) you can use a for loop or apply functions

    setwd( enter file name)
    data <- read.csv("namefile")

    for (i in ncol(data)) {


      stock_var <-  VaR(R = NULL, p = 0.95, ..., method = c("modified", "gaussian",
        "historical", "kernel"), clean = c("none", "boudt", "geltner"),
        portfolio_method = c("single", "component", "marginal"), weights = NULL,
        mu = NULL, sigma = NULL, m3 = NULL, m4 = NULL, invert = TRUE)

print(stock_var)
    }

i recommend you look at the individual functions separately to understand their format

$\endgroup$
  • $\begingroup$ you can calculate delta normal Var manually in excel using the standard deviation and 1.645 for 5% but you will not be able to model the distribution. also please post your comments bellow and not as another answer $\endgroup$ – Alex Bădoi Jan 27 '16 at 19:07
0
$\begingroup$

You should be also keep in mind that you are not constrained only to normal and t. The framework you have would go well with a copula function in which you could choose a very wide variety of distributions and relationships between the variables. However, if your project is for compliance or regulators then you might be creating a lot of work for yourself to educate them on what that method does.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.