Upcoming SlideShare
×

Monte Carlo Simulation Of Heston Model In Matlab(1)

15,569 views

Published on

Bachelore Thesis Presentation

2 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
15,569
On SlideShare
0
From Embeds
0
Number of Embeds
85
Actions
Shares
0
124
0
Likes
2
Embeds 0
No embeds

No notes for slide

Monte Carlo Simulation Of Heston Model In Matlab(1)

1. 1. Monte Carlo Simulation of Heston Model in MATLAB GUI and its Application to Options BACHELOR THESIS IN MATHEMATICS /APPLIED MATHEMATICS DEPARTMENT OF MATHEMATICS AND PHYSICS MÄLARDALEN UNIVERSITY Author Amir Kheirollah Supervisor Robin Lundgren Examiner Dmitrii Silvestrov
2. 2. Abstract <ul><li>In the Black-Scholes model, the volatility considered being </li></ul><ul><li>deterministic and it causes some inefficiencies and trends in pricing options. It has been proposed by many authors that the volatility should be modelled by a stochastic process . Heston Model is one solution to this problem. To simulate the Heston Model we should be able to overcome the correlation between asset price and the stochastic volatility . </li></ul><ul><li>This paper considers a solution to this issue. A review of </li></ul><ul><li>the Heston Model presented in this paper and after modelling some investigations are done on the applet. </li></ul><ul><li>Also the application of this model on some type of options has programmed by MATLAB Graphical User Interface (GUI). </li></ul>
3. 3. Summary <ul><li>The Theoretical Background </li></ul><ul><li>Monte Carlo Simulation </li></ul><ul><li>An Overview on Black-Scholes Model </li></ul><ul><li>Theory of Heston Model </li></ul><ul><li>Cholesky Decomposition </li></ul><ul><li>Types of Options Under Study </li></ul><ul><li>Empirical Investigations </li></ul><ul><li>MATLAB GUI </li></ul>
4. 4. The Theoretical Background <ul><li>Implied or Local Volatility’s inefficiency on Black-Scholes Formula </li></ul><ul><li>Volatility varying by strike (e.g. volatility smile or skewness) </li></ul><ul><li>Observations where the volatility varies ( randomly) </li></ul><ul><li>Volatility to be stochastic </li></ul><ul><li>In compare to other stochastic volatilities Heston Model is: </li></ul><ul><ul><ul><li>A semi-analytical formula </li></ul></ul></ul><ul><ul><ul><li>Forms small steps of time </li></ul></ul></ul><ul><ul><ul><li>Keeps the volatility positive </li></ul></ul></ul><ul><ul><ul><li>Allows the correlation between asset returns and volatility </li></ul></ul></ul>
5. 5. Monte Carlo Simulation <ul><li>A mathematical experimentation tool. </li></ul><ul><li>A crucial techniques in pricing of derivative securities </li></ul><ul><li>To improve the efficiency of a simulation. </li></ul><ul><li>Applications in Mathematical Finance </li></ul><ul><li>To assess the efficiency of the method three considerations are maid: </li></ul><ul><ul><ul><li>computing time, </li></ul></ul></ul><ul><ul><ul><li>biasness </li></ul></ul></ul><ul><ul><ul><li>and finally variance. </li></ul></ul></ul>The method samples randomly from a universe of possible outcomes and takes the fraction of random draws that fall in a given set as an estimate of the set’s measure. The Law of Large Numbers guarantees the convergence of the estimation to the correct value as the number of draws increases.
6. 6. An Overview on Black-Scholes Model <ul><li>Black-Scholes Model is fairly the best known continuous time model. </li></ul><ul><li>The model is simple and requires only five inputs: </li></ul><ul><ul><ul><li>the asset price, </li></ul></ul></ul><ul><ul><ul><li>the strike price, </li></ul></ul></ul><ul><ul><ul><li>the time to maturity, </li></ul></ul></ul><ul><ul><ul><li>the riskfree rate of interest, </li></ul></ul></ul><ul><ul><ul><li>and the volatility. </li></ul></ul></ul><ul><li>The simple Black-Scholes assumes that the underlying price is given by the process </li></ul><ul><li>The Black-Scholes formula for a European Call Option </li></ul><ul><li>Where, </li></ul>
7. 7. The Heston Model – Genral Form of SDEs <ul><li>The general form of an SDE </li></ul><ul><li>if, </li></ul><ul><li>Then </li></ul><ul><li>Which results in </li></ul>(1) (2)
8. 8. The Heston Model <ul><li>Now by introducing the Heston Model and considering the last procedure; </li></ul><ul><li>where </li></ul><ul><li>v t is the instantaneous variance of the underlying asset, </li></ul><ul><li> /  is the long-run mean of the instantaneous variance, </li></ul><ul><li> is a parameter that indicates the speed of the mean-reversion of the variance, </li></ul><ul><li>and σ v is the variance of the variance process (volatility of volatility). </li></ul><ul><li>W 1 and W 2 are two correlated Wiener processes with correlation  . </li></ul><ul><li>drift in price process, . </li></ul><ul><li>drift in volatility process . </li></ul><ul><li>and finally diffusion processes; </li></ul><ul><ul><li>for price process, . </li></ul></ul><ul><ul><li>for volatility, . </li></ul></ul>(3) (4)
9. 9. The Heston Model <ul><li>Next step is to simplify this model by discretization of the diffusion processes in order to apply the Cholesky decomposition and finding the correlation between Wiener processes. </li></ul><ul><li>By discretizing the Wiener processes </li></ul><ul><li>By the result </li></ul>W 1 and W 2 In equations (3) and (4) Replaced by Where epsilons are correlated (5) (6)
10. 10. The Heston Model – Discretization Versus Randomization <ul><li>How to randomize the correlation? </li></ul><ul><li>Letting be a vector of IID normal random numbers and epsilon to be a vector of , then; </li></ul><ul><li>in order to get enough random vectors of correlations between two Wiener processes we repeat (5) and (6) </li></ul>ε = Ax + µ (7)
11. 11. The Heston Model – Mean Reversion <ul><li>A fair generation of random numbers around the mean surges employing a mean reverting model on volatility process. </li></ul><ul><li>As before mentioned Beta is the factor which controls the speed of this mean reversion mechanism in the volatility process. </li></ul><ul><li>Also by considering equation (1), these factors are easily traceable on the general form of SDEs. </li></ul>
12. 12. The Heston Model – Application of Monte Carlo Simulation and Cholesky Decomposition <ul><li>The data generated by Monte Carlo simulation where the two random stochastic processes are correlated by cholesky decomposition and randomizing this concept we are able to evaluate the underlying asset. </li></ul><ul><li>By considering the discretized Heston Model </li></ul>
13. 13. The Heston Model – Application of Monte Carlo Simulation and Cholesky Decomposition <ul><li>And by refereeing to our last argument on epsilons and the random vector x, </li></ul><ul><li>If </li></ul><ul><li>By equation (7) </li></ul><ul><li>Where it results in </li></ul><ul><li>Which is ready for programming. </li></ul>
14. 14. Options under Study <ul><li>The options programmed and studied </li></ul><ul><li>are: </li></ul><ul><ul><li>European Call Option </li></ul></ul><ul><ul><li>Average (Asian) Option </li></ul></ul><ul><ul><li>Look-back Option </li></ul></ul>1) 2) 3) where
15. 15. Empirical Investigation <ul><li>An investigation on European option and evaluation methods </li></ul><ul><li>Pricing a European call option by both Heston and Black-scholes Model. </li></ul><ul><li>Consider equal condition for both models. </li></ul><ul><li>Consider some constant inputs for both models </li></ul><ul><li>Dividend considered for both models ( a note to Black-scholes) </li></ul><ul><li>The data </li></ul><ul><li>Type of option : European call option Volatility : 0.05 </li></ul><ul><li>Time to maturity : 10 days Initial volatility : 0.05 </li></ul><ul><li>Strike price : \$89 Alpha : 0.02 </li></ul><ul><li>Spot Price : \$100 Beta : 0.2 </li></ul><ul><li>Interest rate : 0.02 Rho : 0.04 </li></ul><ul><li>Dividend yield : 0.1 </li></ul>
16. 16. Empirical Investigation – The Table   Table 1: Data for Empirical Investigation Category Number of Iterations Black-Scholes (BLS) Price Heston Model Price Heston Model STD Heston Model MIN Heston Model MAX Heston Model COV Heston Model’s Relative Error from BLS 1 10 11,0666 11,3257 1,2997 7,8744 14,0729 1,6893 0,023413 2 100 11,0666 11,0667 0,4381 10,0278 12,2727 0,1919 9,04E-06 3 1000 11,0666 11,0632 0,1146 10,6927 11,2826 0,0131 0,000307 4 5000 11,0666 11,067 0,0567 10,9516 11,2267 0,0032 3,61E-05 5 10000 11,0666 11,0568 0,0402 10,9635 11,1486 0,0016 0,000886 6 25000 11,0666 11,0599 0,023 11,0006 11,1159 5,30E-04 0,000605 7 50000 11,0666 11,0601 0,0156 11,0249 11,0929 2,44E-04 0,000587
17. 17. Empirical Investigation <ul><li>To improve the result categories of iterations by 100 expriments for each hired. </li></ul><ul><li>Two observations: </li></ul><ul><ul><li>What is the relation of the mean on stochastic Heston Model to the deterministic Black-Scholes? </li></ul></ul><ul><ul><li>What the experiments tells us about the accuracy of the Heston formula modelled by Monte Carlo simulation? </li></ul></ul>European call option priced by both methods. As number of iterations increases the price of Heston Model converges To price obtaind by Black-Scholes.
18. 18. Empirical Investigation <ul><li>Increasing the number of iterations, </li></ul><ul><li>there is strong evidence in decreasing </li></ul><ul><li>standard deviation. </li></ul><ul><li>An evidence resulted by Strong Law </li></ul><ul><li>of Large Numbers . </li></ul><ul><li>This is clear from the 4 th and 5 th column of table one where the data on two extremes of each category of iterations is given. The interval diminishes by the rise of number of iterations. </li></ul>Standard Deviation
19. 19. Empirical Investigation <ul><li>The relative error behaviour according </li></ul><ul><li>to increase in number of iterations. </li></ul><ul><li>after a dramatic decrease we face </li></ul><ul><li>an unusual increase followed by a </li></ul><ul><li>gradual decrease. </li></ul><ul><li>According to definition Monte Carlo </li></ul><ul><li>simulation’s set is a set of IID random </li></ul><ul><li> variables. </li></ul><ul><li>Our research shows that this is not </li></ul><ul><li>the case. But by increasing the </li></ul><ul><li>number of iterations the accuracy </li></ul><ul><li>of this assumption is more touchable. </li></ul>Relative Error of Heston Model from Black-Scholes Model Covariance Between Prices Respective Number of Iterations.
20. 20. Empirical Investigation <ul><li>One of critics to this method of programming is the length of time to execute the program. For iterations more than 10000 performance of the program is under question. While it showed by impirical investigation that results of 10000 and more iterations are not really different from eachother. </li></ul><ul><li>One solution to this inefficiency can be simulation of standard Brownian motion by Karhunen-Loeve expansion . </li></ul><ul><li>An investigation on Options’ evaluation by MATLAB GUI </li></ul><ul><li>The same data applied from the first empirical investigation. </li></ul><ul><li>Three samples of each 100 observations on each type of option taken. </li></ul><ul><li>By calling the negligible difference between choosing 10000 or more iteration in order to reduce the time of experiment, samples of hundreds by 10000 iterations are chosen. </li></ul>
21. 21. Empirical Investigation Data for Empirical Investigation <ul><li>Standard deviation, Min and Max values are in an acceptable range. </li></ul><ul><li>Mean on Average and European call options are almost close, which implies by a </li></ul><ul><li>larger sample of data the result of the calculation will be almost equal for this two types. </li></ul><ul><li>Interesting Result </li></ul><ul><li>European call option reach the value of the Average call option if the sample of data </li></ul><ul><li>gets large enough. </li></ul>10000 Iterations Price STD MIN MAX Asian Option 11,03488 0,025823128 10,972 11,095 Look Back Option 14,06824 0,028532498 14,001 14,139 European Call Option 11,05677 0,04028882 10,963 11,149
22. 22. MATLAB GUI Manual – Graphical Representation Opening window of the program HestonGUI.
23. 23. MATLAB GUI Manual – User Manual The pattern considered in example.
24. 24. MATLAB GUI Manual – User Manual <ul><li>1- Run the program from MATLAB. </li></ul><ul><li>2- Choose the option type you want to calculate its price from the popup menu. In the case of our example we choose the European option which is by default chosen already by the program. </li></ul><ul><li>3- Decide how many iteration you will consider in your calculation. Note that number of iterations can heavily affect on the time of calculations by Monte Carlo simulation. By default the program considers one thousand iterations which we will not change in our example. </li></ul><ul><li>4- Put in the length of the period you want to calculate the price for it. The program considers the finance year to be 252 days. In our case we consider a 3 months or 90-days European call option. </li></ul><ul><li>5- Next step can be determination of spot and strike price. We will consider the same values taken by default. </li></ul><ul><li>6- Interest rate should be considered also as an input to the program. This value usually is declared by central banks in the countries. In our example we consider the interest rate to be 2%. </li></ul><ul><li>7- The initial volatility also should be considered. The benchmark for this value can be the historical volatilities in option markets. In our case we consider %7 volatility. </li></ul><ul><li>8- The last step in giving data to the program where we put in values for Greeks, we can consider the default values. </li></ul><ul><li>9- To see the result we push the execute button and run the program. </li></ul><ul><li>10- The result is shown in the asset price field. </li></ul><ul><li>11- To reset the program to defaults reset button should be used. </li></ul>
25. 25. MATLAB GUI Manual – Error-dialogue Windows Error-dialogue declaring the input can not be negative or non-numeric. Error-dialogue declaring the input can not be taken other than the interval. Error-dialogue declaring the input can not take zero, non-numeric or negative values. Error-dialogue windows of the program.
26. 26. Conclusion <ul><li>The Heston model successfully modelled by MATLAB GUI after development a solution to the desired calculation of correlations between stochastic terms of the model. </li></ul><ul><li>The Empirical Investigations on the model showed the accuracy of the model and since Black-Scholes chosen as benchmark the test on this model showed a high degree of accuracy. </li></ul><ul><li>Also as mentioned before in empirical investigation it is possible by some methods to avoid programming the inner loop of the program and in this way by using such a random distribution that mentioned before reduce the time of simulation dramatically. </li></ul><ul><li>Also the analytical solution to exotic options by Heston Model is available which can be an interesting research question to be compared with the simulation. </li></ul>