A selection of topics on IT and its application to finance.
Send me your comments, questions or suggestions by clicking here
Calculating Value at Risk (VaR) using Monte Carlo
Computing VaR with Monte Carlo is very similar to computing it with historical simulation. The main difference lies in the first step. Instead of using historical data for the price returns of the asset and assuming that this return is valid in the present, we generate a random number that will be used to estimate the price return of the asset at the end of the time horizon. The steps are as follows:
Step 1 – determine the time horizon t for the analysis and divide into into equally into small time periods, i.e δt = t/n
For illustration we will compute a monthly VaR consisting of 22 trading days, therefore n = 22 and δt = 1. We want to ensure that δt is sized such that it approximates the continuous pricing we find in real markets. This is called discretization whereby we approximate a continuously variable phenomenon by a large number of discrete intervals.
Step 2- Draw a random normally distributed number and use it to calculate athe price of the asset at the end of the first time period δt
We assume that the equation to determine a stock price on the ith period is given by
Ri = (Si+1 – Si)/Si ) = µδ+ εσδt
Ri is the return on the ith period
Si is the stock price on the ith period
Si+1 is the stock price on the ith+1 period
µ is the mean of the stock price
σis the volatility of the stock price
εis our random number
δtis the time step
At the end of period i we have drawn a random number and calculated Si+1 since all other parameters can be determined or estimated
Step 3 – repeat step 2 for each i until we have reached the end of our time horizon.
In our case Si+22 represents our estimate of the stock price after 1 month
Step 4 – repeat steps 2 and 3 above a large number, say M, of times to generate different stock prices
Step 5 Rank all the prices in order from ther smallest to the largest
Simply read off the value that corresponds to the desired confidence level e.g typically 95% or 99%. Let’s say we wanted a 99% confidence level. We would rank ther prices then choose that value that corresponds the the1% lowest percentile. If this value is less than Si which it almost certainly will be then this corresponds to a loss equal to (Si – Si+t)and there is a 1% chance that your asset will experience this loss.