monte carlo simulation of heston model in matlab(1)

26
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

Upload: amir-kheirollah

Post on 22-May-2015

12.792 views

Category:

Documents


3 download

DESCRIPTION

Bachelore Thesis Presentation

TRANSCRIPT

Page 1: Monte Carlo Simulation Of Heston Model In Matlab(1)

Monte Carlo Simulation of Heston Model in MATLAB GUI

and its Application to OptionsBACHELOR THESIS IN MATHEMATICS /APPLIED

MATHEMATICS

DEPARTMENT OF MATHEMATICS AND PHYSICSMÄLARDALEN UNIVERSITY

AuthorAmir Kheirollah

SupervisorRobin Lundgren

ExaminerDmitrii Silvestrov

Page 2: Monte Carlo Simulation Of Heston Model In Matlab(1)

Abstract

In the Black-Scholes model, the volatility considered being 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.

This paper considers a solution to this issue. A review of the Heston Model presented in this paper and after modelling some investigations

are done on the applet.

Also the application of this model on some type of options has programmed by MATLAB Graphical User Interface (GUI).

Page 3: Monte Carlo Simulation Of Heston Model In Matlab(1)

Summary

The Theoretical Background Monte Carlo Simulation An Overview on Black-Scholes Model Theory of Heston Model Cholesky Decomposition Types of Options Under Study Empirical Investigations MATLAB GUI

Page 4: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Theoretical Background

Implied or Local Volatility’s inefficiency on Black-Scholes Formula

Volatility varying by strike (e.g. volatility smile or skewness)

Observations where the volatility varies ( randomly)

Volatility to be stochastic

In compare to other stochastic volatilities Heston Model is:

A semi-analytical formula Forms small steps of time Keeps the volatility positive Allows the correlation between asset returns and volatility

Page 5: Monte Carlo Simulation Of Heston Model In Matlab(1)

Monte Carlo Simulation

A mathematical experimentation tool. A crucial techniques in pricing of derivative securities To improve the efficiency of a simulation. Applications in Mathematical Finance

To assess the efficiency of the method three considerations are maid: computing time, biasness and finally variance.

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.

Page 6: Monte Carlo Simulation Of Heston Model In Matlab(1)

An Overview on Black-Scholes Model

Black-Scholes Model is fairly the best known continuous time model. The model is simple and requires only five inputs:

the asset price, the strike price, the time to maturity, the riskfree rate of interest, and the volatility.

The simple Black-Scholes assumes that the underlying price is given by the process

The Black-Scholes formula for a European Call Option

Where,

dWXdtXdX ttt

)()(),( )( tTdKedStSc tTr

2

)(]/log[ tT

tT

tTrKSd

Page 7: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model – Genral Form of SDEs

The general form of an SDE

if,

Then

Which results in

)()()()()()()()( )()( it

it

it

it

it

it

it

it dWXdtXbadX

0 tta

tttttt dWXdtXbdX

)()(

)(i

tttit

it dWdtb

X

dX d, , 3 2, 1, i

(1)

(2)

Page 8: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model

Now by introducing the Heston Model and considering the last procedure;

where vt is the instantaneous variance of the underlying asset, / is the long-run mean of the instantaneous variance, is a parameter that indicates the speed of the mean-reversion of the variance, and σv is the variance of the variance process (volatility of volatility). W1 and W2 are two correlated Wiener processes with correlation . drift in price process, . drift in volatility process . and finally diffusion processes;

for price process, . for volatility, .

)1()( ttttt dWSvdtSrdS )2()( ttvt dWvdtvdv

tSr )( )( tv

)1(ttt dWSv

)2(ttv dWv

(3)

(4)

Page 9: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model

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.

By discretizing the Wiener processes

By the result

W1 and W2

In equations (3) and (4)Replaced by

Where epsilons are correlated it

1)( ttt StvtSrS

2)( tvtvv tvt (5)(6)

Page 10: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model – Discretization Versus Randomization

How to randomize the correlation?

Letting be a vector of IID normal random numbers and epsilon to be a vector of , then;

in order to get enough random vectors of correlations between two Wiener processes we repeat (5) and (6)

),...,,( 21 n

ε = Ax + µ (7)

),...,,( 21 nxxxx

Page 11: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model – Mean Reversion

A fair generation of random numbers around the mean surges employing a mean reverting model on volatility process.

As before mentioned Beta is the factor which controls the speed of this mean reversion mechanism in the volatility process.

Also by considering equation (1), these factors are easily traceable on the general form of SDEs.

Page 12: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model – Application of Monte Carlo Simulation and Cholesky Decomposition

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.

By considering the discretized Heston Model

1)( tvStSrS tttt

2)( tvtvv tvt

Page 13: Monte Carlo Simulation Of Heston Model In Matlab(1)

The Heston Model – Application of Monte Carlo Simulation and Cholesky Decomposition

And by refereeing to our last argument on epsilons and the random vector x,

If

By equation (7)

Where it results in

Which is ready for programming.

11 x

22

12 1 x

1)( tvStSrS tttt

)1()( 22

1 tvtvv tvt

Page 14: Monte Carlo Simulation Of Heston Model In Matlab(1)

Options under Study

The options programmed and studied

are:

1. European Call Option

2. Average (Asian) Option

3. Look-back Option

KSX t

N

i

itt Ks

NKSE

1

1

KSEeX t

rT

N

i

it

rT KsN

eX1

1

1)

2) 3)

N

i

it

T KsN

RY1

1

T

t

it

N

i

T KsTN

RX11

11

KSX t tTt

t SM

0max where 0T

KML t

KMEeL t

rT

Page 15: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation

An investigation on European option and evaluation methods Pricing a European call option by both Heston and Black-scholes Model. Consider equal condition for both models. Consider some constant inputs for both models Dividend considered for both models ( a note to Black-scholes)

The data

Type of option : European call option Volatility : 0.05

Time to maturity : 10 days Initial volatility : 0.05

Strike price : $89 Alpha : 0.02

Spot Price : $100 Beta : 0.2

Interest rate : 0.02 Rho : 0.04

Dividend yield : 0.1

Page 16: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation – The Table

 

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

Table 1: Data for Empirical Investigation

Page 17: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation

To improve the result categories of iterations by 100 expriments for each hired.

Two observations:1. What is the relation of the mean on stochastic Heston Model to the deterministic

Black-Scholes?

2. What the experiments tells us about the accuracy of the Heston formula modelled by Monte Carlo simulation?

Price Respective Iterations

10,910,95

1111,0511,1

11,1511,2

11,2511,3

11,35

Iterations

Pri

ce Mean on Heston

Black-Scholes

European call option priced by both methods.

As number of iterations increases the price of Heston Model convergesTo price obtaind by Black-Scholes.

Page 18: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation

Increasing the number of iterations,

there is strong evidence in decreasing

standard deviation.

An evidence resulted by Strong Law

of Large Numbers.

This is clear from the 4th and 5th 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.

Standard Deviation Respective Iterations

0

0,2

0,4

0,6

0,8

1

1,2

1,4

10 100 1000 5000 10000 25000 50000

Iterations

Sta

nd

ard

Dev

iati

on

Standard Deviation

Page 19: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation

The relative error behaviour accordingto increase in number of iterations.after a dramatic decrease we facean unusual increase followed by agradual decrease.

According to definition Monte Carlo simulation’s set is a set of IID random variables.Our research shows that this is not the case. But by increasing the number of iterations the accuracyof this assumption is more touchable.

Relative error from BLS

0

0,005

0,01

0,015

0,02

0,025

10 100 1000 5000 10000 25000 50000

Relative Error of Heston Model from Black-Scholes Model

Covariance

0

0,5

1

1,5

2

10 100 1000 5000 10000 25000 50000

Number of Iterations

Co

vari

ance

Covariance Between Prices Respective

Number of Iterations.

Page 20: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation

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.

One solution to this inefficiency can be simulation of standard Brownian motion by Karhunen-Loeve expansion.

An investigation on Options’ evaluation by MATLAB GUI The same data applied from the first empirical investigation. Three samples of each 100 observations on each type of option taken. 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.

Page 21: Monte Carlo Simulation Of Heston Model In Matlab(1)

Empirical Investigation

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

Data for Empirical Investigation

Standard deviation, Min and Max values are in an acceptable range.Mean on Average and European call options are almost close, which implies by a

larger sample of data the result of the calculation will be almost equal for this two types.Interesting ResultEuropean call option reach the value of the Average call option if the sample of data gets large enough.

Page 22: Monte Carlo Simulation Of Heston Model In Matlab(1)

MATLAB GUI Manual – Graphical Representation

Opening window of the program HestonGUI.

Page 23: Monte Carlo Simulation Of Heston Model In Matlab(1)

MATLAB GUI Manual – User Manual

The pattern considered in example.

Page 24: Monte Carlo Simulation Of Heston Model In Matlab(1)

MATLAB GUI Manual – User Manual

1- Run the program from MATLAB. 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. 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.

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.

5- Next step can be determination of spot and strike price. We will consider the same values taken by default.

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%.

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.

8- The last step in giving data to the program where we put in values for Greeks, we can consider the default values.

9- To see the result we push the execute button and run the program. 10- The result is shown in the asset price field.

11- To reset the program to defaults reset button should be used.

Page 25: Monte Carlo Simulation Of Heston Model In Matlab(1)

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.

Page 26: Monte Carlo Simulation Of Heston Model In Matlab(1)

Conclusion

The Heston model successfully modelled by MATLAB GUI after development a solution to the desired calculation of correlations between stochastic terms of the model.

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.

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.

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.