regeldokument - linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/fulltext01.pdf ·...

38
Degree project Merton Jump-Diffusion Modeling of Stock Price Data Author: Furui Tang Supervisor: Roger Pettersson Examiner: Astrid Hilbert Date: 2018-09-25 Course Code: 2MA41E Subject: Applied Mathematics Level: Bachelor Department Of Mathematics

Upload: others

Post on 18-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Degree project

Merton Jump-Diffusion Modeling of Stock Price Data

Author: Furui Tang Supervisor: Roger Pettersson Examiner: Astrid Hilbert Date: 2018-09-25 Course Code: 2MA41E Subject: Applied Mathematics Level: Bachelor Department Of Mathematics

Page 2: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Linnaeus University

Merton Jump-DiffusionModeling of Stock Price Data

Author:Furui Tang

Supervisor:Roger Pettersson

September 25, 2018

Page 3: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Contents

1 Abstract 3

2 Introduction 3

3 Basic Tools 33.0.1 Logarithmic return . . . . . . . . . . . . . . . . . . . . 4

3.1 Some used probability definitions . . . . . . . . . . . . . . . . 43.1.1 Distribution functions . . . . . . . . . . . . . . . . . . 43.1.2 Expectation & Variance . . . . . . . . . . . . . . . . . 53.1.3 A normal distribution . . . . . . . . . . . . . . . . . . 5

3.2 Brownian motion . . . . . . . . . . . . . . . . . . . . . . . . . 5

4 Black-Scholes Model 64.1 Introduction to the Black-Scholes model . . . . . . . . . . . . 64.2 Simulation of the BS model . . . . . . . . . . . . . . . . . . . 74.3 Estimation of the parameters µ and σ for the BS model . . . . 84.4 Comparison of the empirical log-returns with the BS-modeled

log-returns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

5 The Poisson Process 11

6 The Compound Poisson Process 12

7 Merton Jump-Diffusion Model 137.1 Introduction to the Merton Jump-Diffusion model . . . . . . . 137.2 Simulations for the MJD model . . . . . . . . . . . . . . . . . 147.3 Estimate of the parameters µd, σd, λ, µj and σj . . . . . . . . 15

7.3.1 One initial parameter estimate . . . . . . . . . . . . . . 157.3.2 Maximum likelihood estimation . . . . . . . . . . . . . 18

7.4 Comparison of the empirical log-returns with the MJD-modeled log-returns . . . . . . . . . . . . . . . . . . . . . . . 20

8 Comparison of the BS Model with the MJD Model forEmpirical stock prices 21

9 Conclusion 25

10 Reference 26

1

Page 4: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Appendices 26

A Matlab codes for the figures 26

B Matlab codes for parameter estimations 32

2

Page 5: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

1 Abstract

Abstract

In this thesis, we investigate two stock price models, the Black-Scholes (BS) model and the Merton Jump-Diffusion (MJD) model.Comparing the logarithmic return of the BS model and the MJDmodel with empirical stock price data, we conclude that the MertonJump-Diffusion Model is substantially more suitable for the stockmarket. This is concluded visually not only by comparing the densityfunctions but also by analyzing mean, variance, skewness and kurtosisof the log-returns.

One technical contribution to the thesis is a suggested decisionrule for initial guess of a maximum likelihood estimation of the MJD-modeled parameters.

2 Introduction

In the financial market, there are many risks for investors, for examplestock price. For avoiding risks, investors can analyze historical price topredict the future distribution of stock prices by using suitable models. Inthis thesis, the Black-Scholes and the Merton Jump-Diffusion model, arestudied as models for stock prices. Both models can be used to analyze trendsof stock prices in the financial market. The MJD model is a generalization ofthe BS model. Here, it is investigated whether the MJD model is significantlymore fit to empirical stock price data.

To approach this problem, we need some basic probability and stochasticprocess theory, such as mean, variance, normal distribution and probabilitydensity function, et cetera. By comparing the density functions of the twomodels, the Merton Jump-Diffusion model is found to be significantly moresuitable for real stock prices, which is further confirmed by investigating themoments.

3 Basic Tools

To analyze the two models, we recall some setups in finance and probability.

3

Page 6: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

3.0.1 Logarithmic return

Definition 1. Let St be a stock price at time t. During the time increment∆t, the logarithmic return R∆t of the stock price is defined as

R∆t = ln(St+∆t

St).

For convenience, we rewrite the logarithmic return in a short form: log-return. The log-return R∆t depends not only on time t but also on the timeincrement ∆t. However, the distribution of the log-return does not dependon the time for the two models. Therefore, the time t is suppressed for thelog-return R∆t.

A well-known empirical fact is that for small time increment ∆t, the log-return R∆t is approximately equal to the arithmetic return (St+∆t − St)/St.For the two stated models here, the log-return is more convenient to analyzethan the arithmetic return. Therefore, in this thesis we will compare the log-return of empirical data with the two modeled log-returns to decide whetherthe MJD model can be much more suitable for the real stock market thanthe BS model.

3.1 Some used probability definitions

3.1.1 Distribution functions

Definition 2. For a random variable X, the cumulative distribution function(CDF) FX(x) is defined as

FX(x) = P (X ≤ x).

Definition 3. A random variable X is said to be continuous if its CDF canbe written in the integral form

FX(x) =

x∫−∞

fX(t)dt.

Here, the integrand fX(t) is called the probability density function of X.

The integral in Definition 3 is a Lebesgue integral , which is an extensionof the classical Riemann integral .

4

Page 7: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

3.1.2 Expectation & Variance

Definition 4. For a continuous random variable X, the expectation E(X)is defined as

E(X) =

∞∫−∞

xfX(t)dx.

Definition 5. For a continuous random variable X, the variance Var(X) isdefined as

Var(X) = E(x− E(X))2 =

∞∫−∞

(x− E(X)

)fXdx.

3.1.3 A normal distribution

Definition 6. The probability density function (PDF) of a normal randomvariable X, denoted as X ∼ N(µ, σ), is defined by:

fX(x) = ϕ(x|µ, σ2) =1√

2πσ2e−

(t−µ)2

2σ2 , −∞ < x <∞.

3.2 Brownian motion

Definition 7. A stochastic process {Wt}t≥0 is called a standard Brownianmotion, if the following properties are satisfied:

(1) W0=0.

(2) Independent increments: for every time point 0 ≤ t1 ≤ t2 ≤ · · · ≤ tn,the increments of W : Wtn −Wtn−1, Wtn−1 −Wtn−2,. . . , Wt2 −Wt1 areindependent random variables.

(3) Normal distribution: for every time point 0 ≤ t1 ≤ t2 ≤ · · · ≤ tn, theincrements of W : Wtn−Wtn−1, Wtn−1−Wtn−2,. . . , Wt2−Wt1 are normaldistributed with mean zero and variance (tn− tn−1), (tn−1− tn−2), . . . ,(t2 − t1), respectively.

(4) With probability one, the function t 7→ Wt is a continuous function forevery t.

For more about the Brownian motion, see for instance, Chapter 2 ofreference [5]. Note that the increment ∆Wt = Wt+∆t −Wt ∼ N(0,∆t) ∼√

∆tN(0, 1), which means that (Wt+∆t −Wt)/√

∆t ∼ N(0, 1).

5

Page 8: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Since ∆Wt ∼√

∆tN(0, 1), a standard Brownian motion is easilysimulated. A path of a standard Brownian motion is illustrated in Figure 1.

0 1 2 3 4 5 6 7 8

time

-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

Brow

nian m

otion

Figure 1: A simulation of a standard Brownian motion.

4 Black-Scholes Model

4.1 Introduction to the Black-Scholes model

In the financial market, the Black-Scholes model is a widely used model.For convenience, we abbreviate the Black-Scholes model as the BS model.The stock price St under the BS model is:

St = S0e(µ−σ

2

2)t+σWt . (1)

In the formula (1), S0 is the stock price at time zero, µ is a drift rate, and σis named as a volatility which expresses the uncertainty of the stock price.From the BS model (1), the logarithm of the stock price is:

ln(St) = ln(S0e(µ−σ

2

2)t+σWt)

= ln(S0) + ln(e(µ−σ2

2)t+σWt)

= ln(S0) + (µ− σ2

2)t+ σWt. (2)

6

Page 9: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

By Definition 1, we can obtain the log-return R∆t of the BS-modeled stockprice as

R∆t = ln(St+∆t

St)

= (µ− σ2

2)∆t+ σ(Wt+∆t −Wt)

∼ N((µ− σ2

2)∆t, σ2∆t

)= (µ− σ2

2)∆t+ σ

√∆tN(0, 1), (3)

which means thatR∆t − (µ− σ2

2)∆t

σ√

∆t∼ N(0, 1).

4.2 Simulation of the BS model

From (1) and simulation of the standard Brownian motion {Wt}t≥0, asequence of log-returns R∆t of the BS model is easily generated. Simulationcodes for the BS model can be seen in Appendix A.

For the given parameters µ = 0.15 and σ = 0.19, and S0 = 416, five pathsof simulated stock prices under the BS model are illustrated in Figure 2.

0 1 2 3 4 5 6 7 8

time

200

400

600

800

1000

1200

1400

1600

1800

2000

Stoc

k pric

es

Figure 2: Five paths of BS simulated stock prices with S0 = 416, µ = 0.15,σ = 0.19.

7

Page 10: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

4.3 Estimation of the parameters µ and σ for the BSmodel

To fit empirical data to the BS model, it is necessary to estimate theparameters µ and σ.

Let E(R∆t) and Var(R∆t) be the mean and variance of the log-return ofthe BS-modeled stock price, respectively. By Definitions 4, 5 and formula(3), we can get the mean and variance of the log-return R∆t:E(R∆t) = (µ− σ2

2)∆t

Var(R∆t) = σ2∆t.(4)

From (4), based on a log-return data sequence, it is natural to estimate µand σ by

µ =2E(R∆t) + Var(R∆t)∆t

2∆t

σ2 =Var(R∆t)

∆t,

(5)

where E(R∆t) is the sample mean of the empirical log-returns, and Var(R∆t)is the sample variance of the empirical log-returns.

Here, the used empirical data is historical stock prices of the Googlecompany from 2013-03-01 to 2018-03-05, with 1260 trading days [10]. Theunit time is one year with for simplification 252 trading days per year, whichmeans that the time difference between the data points is 1/252. Hence,the estimated parameters under this empirical data are µ = 0.2171 andσ = 0.2210.

The following MATLAB code is used to estimate the parameters µ andσ for the BS model for the Google stock prices.

S=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ;dt =1/252;R=d i f f ( l og (S) ,1 ) ; % the re turn o f the empr ica l s tock

p r i c emuhat=mean(R) /dt+var (R) /(2∗ dt ) ;sigmahat=s q r t ( var (R) /dt ) ;

8

Page 11: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

4.4 Comparison of the empirical log-returns with theBS-modeled log-returns

According to the estimation of parameters, we import the estimatedparameters µ = 0.2171 and σ = 0.2210 into the BS model. Then we simulatelog-returns for the adapted BS model, and compare it with the empirical log-returns. The simulated BS-modeled log-returns and the empirical log-returnsare illustrated in Figure 3.

0 1 2 3 4 5

time

-0.1

-0.05

0

0.05

0.1

0.15

Log-

retur

ns

EmpiricalBS model

Figure 3: Comparison of simulated BS-modeled log-returns with theempirical Google log-returns.

In Figure 3, the BS-modeled log-returns seem to be similar to theempirical log-returns. However the empirical log-returns have several largerspikes. Note also that most empirical log-returns are smaller in size than theBS-modeled log-returns. That may indicate that the seemingly randomnessof the empirical log-returns are from two parts, one is giving large spikeswhich do not often appear, the another one which appear most of thetime typically gives smaller log-returns than the BS-modeled log-returns.Consequently, there may be a need for another model to analyze stock pricesthan the BS model.

To visualize the difference between the modeled log-returns and theempirical log-returns, a proper clearer way is to compare their probabilitydensity functions. Hence, we consider the probability density functions ofthe BS-modeled and the empirical log-returns.

9

Page 12: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

From (4), by Definition 6, the probability density function of the BS-modeled log-return R∆t is:

ϕ(x|(µ− σ2

2)∆t, σ2∆t

)=

1√2πσ2∆t

e−

(x−(µ−σ2

2 )∆t

)2

2σ2∆t , for x ∈ R. (6)

The PDF of the empirical log-returns is estimated by a kernel densityestimation of the form:

fh(x) =1

nh

n∑i=1

K(r − rih

),

where r1, r2, . . . , rn are the empirical returns, K is the standard Gaussiandensity K(x) = ϕ(x|0, 1), and h is a suitable bandwidth.

Then, the PDF of the BS-modeled log-returns is compared with the kerneldensity estimation of the empirical log-returns. The bandwidth h is hereselected by default by MATLAB. The densities are illustrated in Figure 4.

-0.05 0 0.05 0.1 0.15

empirical and BS-modeled log-returns

5

10

15

20

25

30

35

40

Prob

abilit

y den

sity

EmpiricalBS model

Figure 4: Kernel density estimation of the empirical log-returns and the PDFof the BS-modeled log-returns.

Since the BS-modeled log-returns are normal distributed, if the BS modelis suitable for the real stock price, the empirical log-returns should be at leastmoderately close to a normal density. Otherwise, the BS model does not suitthe real stock price.

10

Page 13: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Hence, we apply two tests, the Jarque-Bera test1 and the Kolmogorov-Smirnov test2, to judge whether the probability density function of empiricaldata is normal distributed. By importing the Google data into the two tests,the results for both tests are that a normal distribution hypothesis of thelog-return of the Google data is rejected. Therefore, the BS model is notvery suitable for the real stock market.

That motivates us to consider the Merton Jump-Diffusion (MJD) modelwhich is a generalization of the BS model that allows jumps of the stock price.In this model, we should pay attention to the occasional larger spikes and thefrequent small size log-returns, illustrated in Figure 3, which may indicatethat the log-returns are frequently quite small but by and then jumps of thestock price occurs. To analyze the jumps of the stock price, we first need tostudy the Poisson process and the compound Poisson processes.

5 The Poisson Process

The jumps for the MJD model occur according to a Poisson process.Therefore the Poisson process is recalled here.

Definition 8. Let {τi}i≥1 be a sequence of exponential random variables withparameter λ. Let Tn =

∑ni=1 τi. Then the Poisson process {Nt}t≥0 is defined

asNt =

∑n≥1

1t≥Tn ,

where the intensity λ is the expected number of jumps per unit time [4].

The Poisson process can be simulated in different ways. Note that

∆Nt = Nt+∆t −Nt

is Poisson distributed with mean λ∆t, i.e. P (∆Nt = k) = (−λ∆t)k

k!e−λ∆t, for

k = 0, 1, 2, . . .. The implementation of ∆Nt is here given by the MATLABPoisson random number generator.

A simulated Poisson process path {Nt}t≥0 with intensity λ = 15 isdisplayed in Figure 5. For Poisson process simulation codes, see AppendixA.

1In statistics, the null hypothesis of the Jarque-Bera test is that the data comes froma normal distribution. The test rejects the null hypothesis at the 5% significance level,which indicates that the data is far from being normal distributed and the null hypothesisis rejected.

2The null hypothesis of Kolmogorov-Smirnov test here is also that the data comes froma standard normal distribution.

11

Page 14: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

0 0.2 0.4 0.6 0.8 1

time

0

2

4

6

8

10

12

14

Poiss

on pr

oces

s Nt

Figure 5: A simulated Poisson process path with intensity λ = 15.

For the simulation technique applied in Figure 5, ∆t = 11000

. The cumula-tive number of jumps are only registered at time points 0, ∆t, 2∆t, 3∆t, . . . , 1.In this simulation, the number of jumps is 14, which is not far from theexpected number of jumps λ = 15.

6 The Compound Poisson Process

For the MJD model not only the jump times but also the jump heights arerandom. The randomness is determined by a compound Poisson processwhich consequently is here introduced.

Definition 9. Let {Qi}i≥1 be a sequence of independent and identicallydistributed random variables, and {Nt}t≥0 be a Poisson process with intensityparameter λ. Then the compound Poisson process {Yt}t≥0 is defined by

Yt =Nt∑i=1

Qi,

with jump intensity λ, [4].If Nt = 0, then Yt is defined as Yt =

∑0i=1Qi = 0.

To simulate the compound Poisson process, the sum of jumps in [t, t+∆t]has the same distribution as

∑∆Nti=1 Qi, where we recall that the number of

12

Page 15: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

jumps ∆Nt is Poisson distributed with mean λ∆t.To simulate

∑∆Nti=1 Qi, at first, ∆Nt is simulated from the Poisson distribution

with mean λ∆t. Given such random integer ∆Nt = k say,∑∆Nt

i=1 Qi =∑ki=1Qi is generated. If the Qi is normal distributed, Qi ∼ N(µj, σ

2j ), where

the j represents jumps, then∑k

i=1Qi ∼ N(kµj, kσ2j ).

A simulated compound Poisson process Nt with intensity λ = 15 andnormal distributed jumps N(0.5, 1) is illustrated in Figure 6. For compoundPoisson process simulation codes, see Appendix A.

0 0.2 0.4 0.6 0.8 1

time

-2

0

2

4

6

8

10

12

Comp

ound

Pois

son p

roce

ss Y

t

Figure 6: A simulated compound Poisson process path with jump intensity15 and a normal jump height distribution N(0.5, 1).

Here, the number of jumps is 17. The mean jump height 0.5 in thecompound Poisson process implies that the jumps are mostly upwards.

7 Merton Jump-Diffusion Model

7.1 Introduction to the Merton Jump-Diffusion model

With Chapters 4 and 5, a basic understanding of the Poisson processes andthe compound Poisson processes were given. Now we are ready to presentthe Merton Jump-Diffusion (MJD) model.

The stock price St under the MJD model is:

St = S0e(µd−

σ2d2

)t+σdWt+∑Nti=1 Qi , (7)

13

Page 16: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

where the µd is named as diffusion drift, σd is named as the volatilityof diffusion, {Wt}t≥0 is a standard Brownian motion, {

∑Nti=1Qi}t≥0 is a

compound Poisson process with normal distributed jumps N(µj, σ2j ) and

intensity λ. Here, the index d represents the diffusion of the MJD model,and j represents the jumps of the MJD model.

From the MJD model (7), the logarithm of the stock price is

ln(St) = ln(S0e

(µd−σ2d2

)t+σdWt+∑Nti=1 Qi

)= ln(S0) + ln

(e(µd−

σ2d2

)t+σd(Wt+∆t−Wt)+∑Nti=1 Qi

)= ln(S0) + (µd −

σ2d

2)t+ σd(Wt+∆t −Wt) +

Nt∑i=1

Qi. (8)

Then by Definition 1, we can get the log-return R∆t of the MJD-modeledstock price as

R∆t = ln(St+∆t

St)

= (µd −σ2d

2)∆t+ σd(Wt+∆t −Wt) +

Nt+∆t∑i=Nt

Qi, (9)

where ∆Wt = Wt+∆t−Wt is a standard Brownian motion increment, Qi areindependent normal distributed with mean µj and variance σ2

j , and ∆Nt =Nt+∆t − Nt is a Poisson random variable with mean λ∆t. We observe that∑Nt+∆t

i=NtQi has the same distribution as

∑∆Nti=1 Qi, where once again ∆Nt =

Nt+∆t −Nt.

7.2 Simulations for the MJD model

Since simulations of standard Brownian motion increments ∆Wt andcompound Poisson process increments

∑Nt+∆t

i=NtQi are already estimated, it

is easy to simulate the log-return R∆t (9) of the MJD model. Then from (8),we can simulate MJD-modeled stock prices. Simulation codes for the MJDmodel can be seen in Appendix A.

For the given parameters µd = 0.17, σd = 0.055, λ = 10, µj = 0.005and σj = 0.08, five paths of simulated stock prices of the MJD model aredisplayed in Figure 7.

14

Page 17: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

0 1 2 3 4 5 6 7 8

time

0

1000

2000

3000

4000

5000

6000

Simu

lated

stoc

k pric

es

Figure 7: Five paths of MJD simulated stock prices, where µd = 0.17, σd =0.055, λ = 10, µj = 0.005 and σj = 0.08.

7.3 Estimate of the parameters µd, σd, λ, µj and σj

The expectation and variance of log-return R∆t (9) of the MJD-modeledstock price are: E(R∆t) = (µd −

σ2d

2)∆t+ µjλ∆t

Var(R∆t) = σ2d∆t+ (σ2

j + µ2j)λ∆t.

(10)

For a complete proof of (10), see reference [3].

7.3.1 One initial parameter estimate

To estimate the five parameters µd, σd, λ, µj and σj, we would like touse the maximum likelihood estimation (MLE) method3. Since there arefive parameters in the MJD model, and as far as the author knows, thereare no analytic expressions of the optimal parameter values, we will use theMATLAB code fminsearch to estimate optimal parameters.

3In statistics, the maximum likelihood estimation method is used to estimateparameters in a model. Firstly, it is necessary to find the likelihood function L(θ; x ),where the θ is a parameter for the model and x are the data points. Then we should finda θ maximizing the likelihood function.

15

Page 18: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

To apply the MLE method, firstly, we should find an initial estimate ofthe parameters based on the empirical data. The empirical log-returns R∆t

of the Google data are recalled in the Figure 8.

0 1 2 3 4 5

time

-0.1

-0.05

0

0.05

0.1

0.15

Empir

ical lo

g-re

turns

Figure 8: The log-return of the empirical stock prices.

A delicate matter is to decide when there is a jump. Here the decisionrule is that a jump occurs if the absolute value of the log-return is largerthan some positive value ε.

Here, the time is measured in years. Hence the parameter λ is estimatedas

λ = the number of jumps per year

=the total number of jumps

the total length in years. (11)

For the value ε, dividing the empirical log-return data into two groups Dand J , the group D includes log-returns with absolute value of log-returnsless than value ε. For such log-returns, we decide that there is no jump.Oppositely, the group J includes log-returns with absolute value of log-returns larger than value ε. For such log-returns, we decide that jumps haveoccurred. To estimate the initial parameters µd, σd, µj and σj, for simplicity,we decide that there is exactly only one jump for a log-return that belongsto group J .

16

Page 19: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

When there is exactly only one jump, the expectation and variance of thelog-return are

E(RJ∆t) = E[R∆t|Nt+∆t −Nt = 1]

= E[(µd −σ2d

2)∆t+ σd∆W +Qi]

= (µd −σ2d

2)∆t+ µj

andVar(RJ

∆t) = Var[R∆t|Nt+∆t −Nt = 1]

= Var[(µd −σ2d

2)∆t+ σd∆W +Qi]

= σ2d∆t+ σ2

j ,

respectively. In summary,E(RJ∆t) = (µd −

σ2d

2)∆t+ µj

Var(RJ∆t) = σ2

d∆t+ σ2j .

(12)

The parameters µj and σj are estimated from equation (12),µj = E(RJ∆t)− (µd −

σ2d

2)∆t

σ2j = Var(RJ

∆t)− σ2d∆t,

(13)

where E(RJ∆t) and Var(RJ

∆t) are the sample mean and the sample varianceof the empirical log-returns in group J .

When there are no jumps, the expectation and variance of the log-returnare

E(RD∆t) = E[R∆t|Nt+∆t −Nt = 0]

= E[(µd −σ2d

2)∆t+ σd∆W ]

= (µd −σ2d

2)∆t

andVar(RD

∆t) = Var[R∆t|Nt+∆t −Nt = 0]

= Var[(µd −σ2d

2)∆t+ σd∆W ]

= σ2d∆t,

17

Page 20: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

respectively.The parameters µd and σd can be estimated from the above formulas ofE(RD

∆t) and Var(RD∆t), similarly as for the BS model,

µd =2E(RD

∆t) + Var(RD∆t)∆t

2∆t

σ2d =

Var(RD∆t)

∆t,

(14)

where E(RD∆t) and Var(RD

∆t) are the sample mean and the sample varianceof the empirical log-returns in group D.

By reading off Figure 8 and from that figure, choosing ε = 0.02, weobtain the initial estimator of the parameters µd = 0.23028, σd = 0.13874,λ = 25.0199, µj = −0.0011178 and σj = 0.03452 by (13) and (14). Here aMATLAB code is included with a hopefully clear description of the initialparameter estimate.

S=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ; % the empr ica ls tock p r i c e

dt =1/252;R=d i f f ( l og (S) ,1 ) ;e p s i l o n =0.02; %va lue s to v e r i f y jumpjumpindex=f i n d ( abs (R)>e p s i l o n ) ;%i f t rue then cons ide r ed

as jumplambdahat=length ( jumpindex ) / ( ( l ength (S)−1)∗dt ) ; % jump

i n t e n s i t y , the number o f jumps in per− yearRjumps=R( jumpindex ) ; % the data o f ’ jumpindex ’d i f f u s i o n i n d e x=f i n d ( abs (R)<=e p s i l o n ) ; % without jumps ,

the d i f f u s i o n data can be con s id e r as in BS modelR d i f f u s i o n=R( d i f f u s i o n i n d e x ) ; % the data o f ’

d i f f u s i o n i n d e x ’sigmahat=std ( Rd i f f u s i o n ) / s q r t ( dt ) ;muhat=[2∗mean( Rd i f f u s i on )+(sigmahat ˆ2)∗dt ] / (2∗ dt ) ;s i gma jhat=s q r t ( ( var (Rjumps )−sigmahat ˆ2∗dt ) ) ;mu jhat=mean(Rjumps )−(muhat−sigmahat ˆ2/2)∗dt ;

7.3.2 Maximum likelihood estimation

From previous subchapter, we have initial estimates of µd, σj, λ, µj, σj.Those initial estimates are used to numerically optimize the MJD likelihood.That likelihood is introduced here.

18

Page 21: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

By Definition 6 and (9), the PDF of the MJD-modeled log-return R∆t is:

fR∆t(x) =

∞∑k=0

pk(λ∆t)ϕ(x|(µd −

σ2d

2)∆t+ µjk, σ

2d∆t+ σ2

jk), (15)

where pk(λ∆t) = p(∆Nt = k) = (λ∆t)k

k!e−λ∆t. For a complete proof of the

probability density function (15), see reference [2].The objective function of the MLE method to maximize is the likelihood

functionL(θ; x ) = Πn

k=0fR∆t(xi),

where the function fR∆t(t) is specified in equation (15), and x = (x1, . . . , xn)

is the empirical log-return data.It is more convenient to minimize the minus log-likelihood function:

− ln L(θ; x ) = −n∑k=0

ln fR∆t(xi). (16)

By using the fminsearch code for minimizing − lnL and importing the initialestimates from previous subchapter, we can estimate the five parameters fordifferent values of ε. The following table shows a relationship between thevalue ε and the MLE estimated parameters.

Table 1: Estimated parameters of the MLE method depending on differentvalues of ε.

Parameterε=0.07 ε=0.05 ε=0.02

Initial value Estimated value Initial value Estimated value Initial value Estimated value

µd 0.12661 0.22343 0.16848 0.22343 0.23028 0.22343

σd 0.19752 0.15442 0.19193 0.15442 0.13874 0.15442

λ 0.800635 33.9377 1.60127 33.9377 25.0199 33.9377

µj 0.10689 -0.00055442 0.026621 -0.00055442 -0.0011178 -0.00055441

σj 0.035407 0.025513 0.088274 0.025513 0.03452 0.025513

− lnL -3.7457e+03 -3.7457e+03 -3.7457e+03

From Table 1, even though we have chosen different values of ε, theestimated maximum likelihood parameters are the same, µd = 0.22343, σd =0.15442, λ = 33.9377, µj = −0.00055442 and σj = 0.025513. This indicatesthat the MLE method is not strongly depending on the value of ε. However,if the value ε is larger than the maximum absolute value of empirical log-returns R∆t, it is decided that there are no jumps. Then the parameter λ isestimated to be 0, and µj and σj can not be estimated.

19

Page 22: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

7.4 Comparison of the empirical log-returns with theMJD-modeled log-returns

From the estimated parameters µd = 0.22343, σd = 0.15442, λ = 33.9377,µj = −0.00055442 and σj = 0.025513, we can draw an approximation of thePDF (15), illustrated in the Figure 9. Here the number of terms in (15) is 100.For the estimated parameters, the number of terms seems to be sufficient.

-0.1 -0.05 0 0.05 0.1 0.15 0.2

empirical and MJD-modeled log-returns

0

5

10

15

20

25

30

35

40

45

Prob

abilit

y den

sity

EmpiricalMJD model

Figure 9: The PDF of MJD-modeled log-returns and the kernel densityestimation of empirical log-returns.

From Figure 9, we find that the density function of the MJD-modeledlog-returns is quite close to the kernel density estimation of empirical log-returns. This is also indicated in Figure 10, where the empirical log-returnsare compared with the MJD-modeled log-returns.

20

Page 23: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

0 1 2 3 4 5

time

-0.1

-0.05

0

0.05

0.1

0.15

Log-

retur

ns

EmpiricalMJD model

Figure 10: Comparison of the empirical log-returns with the MJD-modeledlog-returns.

We recall the comparison of empirical log-returns with the BS-modeledlog-returns in Figure 3, which indicated that some occasional larger spikes.From Figure 10, there are also some larger spikes for the MJD-modeled log-returns, indicating that the MJD model can pay attention to the occasionallarger spikes. Therefore, the MJD model may be more suitable for the realstock price.

8 Comparison of the BS Model with the

MJD Model for Empirical stock prices

Since the BS model has normal distributed log-returns and our empiricallog-returns are far from being normal distributed, the BS model is not avery suitable stock price model. However, the MJD model seems to be closerto the empirical stock price, at least for the Google data considered in thisthesis.

21

Page 24: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

-0.1 -0.05 0 0.05 0.1 0.15 0.2

log-returns

0

5

10

15

20

25

30

35

40

45

Prob

abilit

y den

sity

EmpiricalBS modelMJD model

Figure 11: The PDF of two modeled log-returns and the kernel densityestimation of empirical log-returns.

From Figure 11, the PDF of the MJD model is quite closer to reality thanthe BS model.

Now we compare the BS model and the MJD model with the real databy investigating their moments.We recall that the log-returns of the BS model is

R∆t = ln(St+∆t

St)

= (µ− σ2

2)∆t+ σ∆Wt,

where ∆Wt is a standard Brownian motion increment, ∆Wt ∼√

∆tN(0, 1).The mean, variance, skewness and kurtosis for the BS-model log-returns are

22

Page 25: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

shown below:

E(R∆t) = (µ− σ2

2)∆t,

Var(R∆t) = σ2∆t,

Ske(R∆t) =E[(R∆t − E(R∆t))

3]

(Var(R∆t))32

=E[σ∆Wt]

3

σ2(∆t)32

=E[σ√

∆tN(0, 1)]3

σ3∆t32

=σ3(∆t)

32E(N(0, 1))3

σ3(∆t)32

= E(N(0, 1)3),

Kur(R∆t) =E[(R∆t − E(R∆t))

4]

(Var(R∆t))2

=E[σ√

∆tN(0, 1)]4

σ4(∆t)2

=σ4(∆t)2E(N(0, 1))4

σ4∆t2

= E(N(0, 1)4),

where the PDF of the standard normal distribution N(0, 1) is ϕ(x|0, 1) =1√2πe−

x2

2 .

Thus, E(N(0, 1)3) =∫∞−∞ x

3 1√2π

e−x2

2 dx = 0, E(N(0, 1)4) =∫∞−∞ x

4 1√2π

e−x2

2 dx

= 3. Therefore, Ske(Rbs∆t) = 0 and Kur(Rbs

∆t) = 3.

From µ = 0.2171, σ = 0.2210 and ∆t = 1252

, E(R∆t) = 0.0008, and

Var(R∆t) = 0.0002. Obviously, the above computed values of E(R∆t) and

Var(R∆t) are equal to the sample mean and sample variance of the empiricaldata.

We also recall that the log-return of the MJD model is:

R∆t = (µd −σ2d

2)∆t+ σd∆Wt +

Nt+∆t∑i=Nt

Qi,

where ∆Wt is a standard Brownian motion increment, ∆Wt ∼√

∆tN(0, 1),and Qi are independent normal random variables, Qi ∼ N(µj, σ

2j ). We recall

that∑Nt+∆t

i=NtQi has the same distribution as

∑∆Nti=1 Qi, where ∆Nt is a Poisson

23

Page 26: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

process increment with mean λ∆t. Then E(∆Nt) = Var(∆Nt) = λ∆t.The moments of the MJD model are presented as follows.

E(R∆t) = (µd −σ2d

2)∆t+ E(Q)E(∆Nt)

= (µd −σ2d

2)∆t+ µjλ∆t, (17)

Var(R∆t) = E[(R∆t)2]− [E(R∆t)]

2

= E[(σd∆WT +Q∆Nt − µjλ∆t)2]

= E[(σd∆WT )2 + (Q∆Nt)2 + (µjλ∆t)2 + 2σd∆WTQ∆Nt

− 2σd∆WTµjλ∆t− 2Q∆Ntµjλ∆t]

= σ2d∆t+ (σ2

j + µ2j)λ∆t, (18)

Ske(R∆t) =E[(R∆t − E(R∆t))

3]

(Var(R∆t))32

=(3σ2

j + µ2j)µjλ∆t

[σ2d∆t+ (σ2

j + µ2j)λ∆t]

32

, (19)

Kur(R∆t) =E[(R∆t − E(R∆t))

4]

(Var(R∆t))2

=(3σ4

j + 6µ2jσ

2j + µ4

j)λ∆t+(3λ2(σ2

j + µ2j)

2 + 6λσ2d(σ

2j + µ2

j) + 3σ4d

)(∆t)2

[σ2d∆t+ (σ2

j + µ2j)λ∆t]2

.

(20)

For the complete proof of the above moments, see Chapter 2 of the reference[2].

From Chapter 6, the estimated parameters for the MJD model are µd =0.22343, σd = 0.15442, λ = 33.9377, µj = −0.00055441 and σj = 0.025513.Then we can estimate the moments by inserting the estimated parametersinto (17), (18), (19) and (20): E(R∆t) = 0.0008, Var(R∆t) = 0.0002,

Ske(R∆t) = −0.0592, and Kur(R∆t) = 8.1541.

Table 2: Comparison of the empirical log-returns with the two modeled log-returns.

Mean Variance Skewness coefficient Kurtosis coefficientReality 0.0008 0.0002 1.5215 20.5341

BS model 0.0008 0.0002 0 3MJD model 0.0008 0.0002 -0.0592 8.1541

From Table 2, the estimated means and variances of the log-returns forthe two models coincide with the empirical log-returns. The high positive

24

Page 27: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

skewness for the empirical log-returns can be explained by the two relativelylarge positive values illustrated in Figure 8. The skewness coefficients forthe two models are not very close to the real data, indicating that the twomodels do not capture the positive skewness of the empirical log-returns. Thekurtosis coefficients for the empirical data is larger than for the BS modeland the MJD model. However, the kurtosis coefficient for the MJD modelseems to be clearly closer to the empirical kurtosis than for the BS model.

From Figure 3 and 8, we find that there are several larger spikes inempirical log-returns, and the MJD model is a way to take care of thesespikes. Besides, the MJD model indicates that most of the log-returns aresmall in size as for the empirical data. That can also be read off from thePDF of the MJD model.Hence, we can conclude that the MJD model is substantially more suitablefor the real stock market than the BS model at least for our empirical Googledata.

In this thesis, we only compare two models and get the table 2 under theempirical Google data. Other empirical data have also been investigated andsimilar results have been obtained.

9 Conclusion

To sum up, we have discussed the Black-Scholes model and the MertonJump-Diffusion model. We try to find whether the MJD model is significantlymore suitable for empirical stock prices. From the probability densityfunctions of the two models, we find that the probability density function ofMJD model is clearly closer to the kernel density estimation for the Googleempirical data. To verify this conclusion, we compare the moments of theBS model and the MJD model with empirical moments. We get that thekurtosis coefficient of the MJD model is closer to the empirical kurtosis thanfor the BS model. Based on this evidence, it is reasonable to say that theMJD model is better to predict the future distribution of stock prices.

For initial guess of the parameters for the MJD model, the author did notfind a reference of an analytic method. Therefore, a jump decision rule wasintroduced based on a threshold ε. The decision rule seems to give robustMLE estimates of optimal parameters.

25

Page 28: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

10 Reference

References

[1] Black, F.,& Scholes, M. (1973). The pricing of options and corporateliabilities. Journal of political economy, 81(3), 637-654.

[2] Hanson, F. B., & Westman, J. J. Stochastic Analysis of Jump-Diffusionsfor Financial Log-Return Processes (corrected).

[3] Hanson, F. B., & Zhu, Z. (2004, December). Comparison of marketparameters for jump-diffusion distributions using multinomial maximumlikelihood estimation. In Decision and Control, 2004. CDC. 43rd IEEEConference on (Vol. 4, pp. 3919-3924). IEEE.

[4] HAKANSSON, J., & ALBIN, P. (2015). Option Pricing and ExponentialLvy Models.

[5] Lawler, G. F. (2010). Stochastic Calculus: An Introduction withApplications. American Mathematical Society.

[6] Moore, D. S., McCabe, G. P., & Evans, M. J. (2005). Introduction tothe practice of statistics Minitab manual and Minitab version 14. WHFreeman & Co.

[7] Merton, R. C. (1976). Option pricing when underlying stock returns arediscontinuous. Journal of financial economics, 3(1-2), 125-144.

[8] Synowiec, D. (2008). Jump-diffusion models with constant parametersfor financial log-return processes. Computers & Mathematics withApplications, 56(8), 2120-2127.

[9] Tankov, P. (2003). Financial modelling with jump processes (Vol. 2).CRC press.

[10] 2013/03/01 ∼ 2018/03/05 Yahoo finance https://finance.yahoo.

com/quote/GOOG/history/

Appendices

A Matlab codes for the figures

26

Page 29: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

% Simulat ion o f Brownian morion and BS model ( Figure1&2)

Ns=5; %the number o f s imu la t i ondt =1/252;t=l i n s p a c e (0 ,(2000−1)∗dt , 2000 ) ’ ;

W=cumsum ( [ z e r o s (1 , Ns) ; s q r t ( dt ) .∗ normrnd (0 , 1 , l ength ( t )−1,Ns) ] ) ;

% standard brownian motionmu=0.15; sigma =0.19; S0=416;Ssim=S0∗exp ( (mu−sigma ˆ2/2)∗ t∗ones (1 , Ns)+sigma∗W) ;% s imu la t i on o f s tock p r i c esubplot ( 1 , 2 , 1 )p l o t ( t ,W)t i t l e ( ’ Standard Brownian motion ’ )x l a b e l ( ’ time ’ )y l a b e l ( ’ Brownian motion ’ )

subplot ( 1 , 2 , 2 )p l o t ( t , Ssim )t i t l e ( ’ S imulat ion Stock p r i c e ’ )x l a b e l ( ’ time ’ )y l a b e l ( ’ Stock p r i c e s ’ )

%Code f o r Figure 3&4Ns=1; %number o f s imu la t i ondt =1/252;t=l i n s p a c e (0 ,(1260−1)∗dt , 1260 ) ’ ;

W=cumsum ( [ z e r o s (1 , Ns) ; s q r t ( dt ) .∗ normrnd (0 , 1 , l ength ( t )−1,Ns) ] ) ;

mu=0.2171; sigma =0.2210; S0=416;% est imate the parametermu and sigma

Ssim=S0∗exp ( (mu−sigma ˆ2/2)∗ t∗ones (1 , Ns)+sigma∗W) ;%stock p r i c e o f s imu la t i onRsim=d i f f ( l og ( Ssim ) ,1 ) ; % return o f the s imulated stock

p r i c eS=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ; % empr ica l

s tock dataR=d i f f ( l og (S) ,1 ) ; % return o f the r e a l s tock p r i c ef i g u r e (1 )x=t ( 2 : end ) ;p l o t (x ,R, x , Rsim , ’ : ’ )

27

Page 30: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

x l a b e l ( ’ time ’ )y l a b e l ( ’ Log−r e tu rn s ’ )l egend ( ’ Empir ica l ’ , ’BS model ’ )f i g u r e (2 )subplot ( 2 , 1 , 1 )[ fks , xks ]= ksdens i ty (R) ; % p r o b a b i l i t y dens i ty es t imatep l o t ( xks , fks , xks , normpdf ( xks , (mu−sigma ˆ2/2)∗dt , sigma∗

s q r t ( dt ) ) ) , a x i s t i g h tx l a b e l ( ’ d i f f e r e n c e o f l o ga r i thmi c re turn ’ )y l a b e l ( ’ P rob ab i l i t y dens i ty ’ )l egend ( ’ Empir ica l ’ , ’BS model ’ )% Jarque−Bera t e s t and Kolmogorov−Smirnov t e s t[ h , p]= j b t e s t (R)% I f the r e s u l t i s 1 , the t e s t r e j e c t s

the normal hypothes i s[ h , p ] = k s t e s t (R) % I f the r e s u l t i s 1 , the t e s t

r e j e c t s the standard normal hypothes i s

% the code o f s imulated Poisson proce s sNs=1;% the number o f s imu la t i onT=1; % the time per iodlambda=15; % the jump i n t e n s i t yngr id =1000;t=l i n s p a c e (0 ,T, ngr id ) ’ ;dt=t (2 )−t (1 ) ; % the per−timeN=cumsum ( [ z e r o s (1 , Ns) ; po i s s rnd ( lambda∗dt , l ength ( t )−1,Ns

) ] ) ; % po i s son d i s t r i b u t i o np lo t ( t ,N)x l a b e l ( ’ time ’ )y l a b e l ( ’ Poisson proce s s N t ’ )

% the code o f s imulated compound Poisson proce s sNs=1;% the number o f s imu la t i onT=1; % the time per iodlambda=15; % the jump i n t e n s i t ym=0.5; %the mean o f jump s i z ede l t a =1;% the standard dev i a t i on o f jump s i z engr id =1000;t=l i n s p a c e (0 ,T, ngr id ) ’ ;dt=t (2 )−t (1 ) ; % the per−timedN=po i s s rnd ( lambda∗dt , ngrid −1,Ns) ; % the po i s son

d i s t r i b u t i o n

28

Page 31: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

sumD=m∗dN+de l t a ∗ s q r t (dN) .∗ randn ( ngrid −1,Ns) ;% the jumps i z e i s normal d i s t r i b u t e d

Y t=cumsum ( [ z e r o s (1 , Ns) ; sumD ] ) ;p l o t ( t , Y t )x l a b e l ( ’ time ’ )y l a b e l ( ’Compound Poisson proce s s Y t ’ )

%the code o f f i g u r e 7Ns=5;% the number o f s imu la t i ondt =1/252; %the per−time in one yeart=l i n s p a c e (0 ,(2000−1)∗dt , 2000 ) ’ ;mu=0.17; sigma =0.055; lambda=10;muj=0.005; s igmaj =0.08; S0

=416;Rsim=logmertonrnd ( dt ,mu, sigma , lambda , muj , sigmaj , t , Ns) ;Ssim=S0∗exp (cumsum ( [ z e r o s (1 , s i z e (Rsim , 2 ) ) ; Rsim ] ) )p l o t ( t , Ssim )

x l a b e l ( ’ time ’ )y l a b e l ( ’ Simulated stock p r i c e s ’ )

f unc t i on Rsim=logmertonrnd ( dt ,mu, sigma , lambda , mu j ,s igma j , t , Ns)%d e f i n e s imulated re turn func t i on

dN=po i s s rnd ( lambda∗dt , l ength ( t )−1,Ns) ;% number o f jumpbetween g r id po int

Y=mu j∗dN+s igma j ∗ s q r t (dN) .∗ randn ( l ength ( t )−1,Ns) ;% sumof the normal jumps between g r id po in t s

dW=s q r t ( dt ) .∗ normrnd (0 , 1 , l ength ( t )−1,Ns) ;% standardbrownian motion

Rsim=(mu−sigma ˆ2/2)∗dt+sigma∗dW+Y;end

% the code o f f i g u r e 8S=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ;% e m p i r i c a l

s tock p r i c edt =1/252; %per−time in a yeart=l i n s p a c e ( 0 , ( l ength (S)−1)∗dt , l ength (S) ) ’ ;R=d i f f ( l og (S) ,1 ) ; % the re turn o f l oga r i thmi c s tock

p r i c ex=t ( 2 : end ) ; % time per iod o f re turnp lo t (x ,R)x l a b e l ( ’ time ’ )y l a b e l ( ’ Empir ica l log−r e turn ’ )

29

Page 32: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

%Code o f f i g u r e 9 &10&11S=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ;dt =1/252;t=l i n s p a c e ( 0 , ( l ength (S)−1)∗dt , l ength (S) ) ’ ;R=d i f f ( l og (S) ,1 ) ; % the e m p i r i c a l log−r e turnL=0.02; %va lue s to v e r i f y jumpjumpindex=f i n d ( abs (R)>L) ;%i f t rue then cons ide r ed as

jumplambdahat=length ( jumpindex ) / ( ( l ength (S)−1)∗dt ) ; % jump

i n t e n s i t y , the number o f jumps in per− yearRjumps=R( jumpindex ) ; % the data o f ’ jumpindex ’d i f f u s i o n i n d e x=f i n d ( abs (R)<=L) ; % without jumps , the

d i f f u s i o n data can be con s id e r as in BS modelR d i f f u s i o n=R( d i f f u s i o n i n d e x ) ; % the data o f ’

d i f f u s i o n i n d e x ’sigmahat=std ( Rd i f f u s i o n ) / s q r t ( dt ) ;muhat=[2∗mean( Rd i f f u s i on )+(sigmahat ˆ2)∗dt ] / (2∗ dt ) ;s i gma jhat=s q r t ( ( var (Rjumps )−sigmahat ˆ2∗dt ) ) ;mu jhat=mean(Rjumps )−(muhat−sigmahat ˆ2/2)∗dt ;theta0 =[muhat sigmahat lambdahat mu jhat s igma jhat ] ;theta=fminsearch (@( theta ) Logmerton ( theta (1 ) , theta (2 ) ,

theta (3 ) , theta (4 ) , theta (5 ) ) , theta0 ) ;f i g u r e 1

[ fks , xks ]= ksdens i ty (R) ;p l o t ( xks , fks , s o r t (R) , logmertonpdf ( s o r t (R) , dt , theta (1 ) ,

theta (2 ) , theta (3 ) , theta (4 ) , theta (5 ) ) , ’−. ’ )x l a b e l ( ’ e m p i r i c a l and MJD−modeled log−r e tu rn s ’ )y l a b e l ( ’ P rob ab i l i t y dens i ty ’ )

l egend ( ’ Empir ica l ’ , ’MJD model ’ )f i g u r e 2Rsim=logmertonrnd ( dt , theta (1 ) , theta (2 ) , theta (3 ) , theta

(4 ) , theta (5 ) , t , 1 ) ;x=t ( 2 : end ) ;p l o t (x ,R, x , Rsim , ’−− ’ )x l a b e l ( ’ time ’ )y l a b e l ( ’ Log−r e tu rn s ’ )l egend ( ’ Empir ica l ’ , ’MJD model ’ )f i g u r e 3mubs=0.2171; sigmabs =0.2210; % mean and var iance o f BS

model

30

Page 33: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

[ fks , xks ]= ksdens i ty (R) ; % p r o b o b i l i t y dens i ty es t imatep l o t ( xks , fks , xks , normpdf ( xks , ( mubs−sigmabs ˆ2/2)∗dt ,

sigmabs∗ s q r t ( dt ) ) , ’−− ’ , s o r t (R) , logmertonpdf ( s o r t (R), dt , theta (1 ) , theta (2 ) , theta (3 ) , theta (4 ) , theta (5 ) ) , ’: ’ )

x l a b e l ( ’ log−r e tu rn s ’ )y l a b e l ( ’ P rob ab i l i t y dens i ty ’ )l egend ( ’ Empir ica l ’ , ’BS model ’ , ’MJD model ’ )% bu i ld a dens i ty func t i on o f MJD modelfunc t i on pd f l og=logmertonpdf ( r , dt ,mu, sigma , lambda , mu j ,

s i gma j )i f lambda>0

nterm=100;term=ze ro s ( l ength ( r ) , nterm ) ;% return a matrix

l ength ( r ) ∗100f o r k=1:nterm

po i s son=(lambda∗dt ) ˆk/prod ( 1 : k )∗exp(−lambda∗dt ); % poss ion d i s t r i b u t i o n

normal=1/ s q r t (2∗ pi ∗( sigma ˆ2∗dt+s igma j ˆ2∗k ) )∗exp(−(r−((mu−sigma ˆ2/2)∗dt+mu j∗k ) ) . ˆ2/ (2∗ (sigma ˆ2∗dt+s igma j ˆ2∗k ) ) ) ; % normald i s t r i b u t i o n

term ( : , k ) =po i s son ∗normal ;endpd f l og=sum ( [ 1 / s q r t (2∗ pi ∗ sigma ˆ2∗dt )∗exp(−(r−(mu−

sigma ˆ2/2)∗dt ) .ˆ2/(2∗ sigma ˆ2∗dt ) )∗exp(−lambda∗dt ) term ] , 2 ) ;

e l s e% lambda <=0pdf l og=1/ s q r t (2∗ pi ∗ sigma ˆ2)∗exp(−(r−(mu−sigma

ˆ2/2)∗dt ) . ˆ2/ (2∗ ( sigma ˆ2∗dt ) ) ) ;end

endfunc t i on Rsim=logmertonrnd ( dt ,mu, sigma , lambda , mu j ,

s igma j , t , Ns)dN=po i s s rnd ( lambda∗dt , l ength ( t )−1,Ns) ;% number o f jump

between g r id po intY=mu j∗dN+s igma j ∗ s q r t (dN) .∗ randn ( l ength ( t )−1,Ns) ;% sum

of the normal jumps between g r id po in t sdW=s q r t ( dt ) .∗ normrnd (0 , 1 , l ength ( t )−1,Ns) ;% brownian

motionRsim=(mu−sigma ˆ2/2)∗dt+sigma∗dW+Y;

31

Page 34: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

end

B Matlab codes for parameter estimations

%Estimate the parameter mu and sigma o f BS modelNs=1; %number o f s imu la t i onS=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ;dt =1/252;t=l i n s p a c e (0 ,(2000−1)∗dt , 2000 ) ’ ;

W=cumsum ( [ z e r o s (1 , Ns) ; s q r t ( dt ) .∗ normrnd (0 , 1 , l ength ( t )−1,Ns) ] ) ;% brownian motion

mu=0.15; sigma =0.19; S0=416;Ssim=S0∗exp ( (mu−sigma ˆ2/2)∗ t∗ones (1 , Ns)+sigma∗W) ; %

Simulated stock p r i c e o f BS modelTest=d i f f ( l og ( Ssim ) ,1 ) ;mutest=mean( Test ) /dt+var ( Test ) /(2∗ dt ) ;s i gmates t=s q r t ( var ( Test ) /dt ) ;[mu mutest ; sigma s igmates t ] ;S=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ;R=d i f f ( l og (S) ,1 ) ;% the re turn o f the empr ica l s tock

p r i c emuhat=mean(R) /dt+var (R) /(2∗ dt ) ;sigmahat=s q r t ( var (R) /dt ) ;[mu muhat ; sigma sigmahat ] ;

% es t imat ion code o f MJD modelS=csvread ( ’GOOG. csv ’ , 1 , 5 , [ 1 , 5 , 1 2 6 0 , 5 ] ) ; % the empr ica l

s tock p r i c edt =1/252;R=d i f f ( l og (S) ,1 ) ;e p s i l o n =0.02; %va lue s to v e r i f y jumpjumpindex=f i n d ( abs (R)>e p s i l o n ) ;%i f t rue then cons ide r ed

as jumplambdahat=length ( jumpindex ) / ( ( l ength (S)−1)∗dt ) ; % jump

i n t e n s i t y , the number o f jumps in per− yearRjumps=R( jumpindex ) ; % the data o f ’ jumpindex ’d i f f u s i o n i n d e x=f i n d ( abs (R)<=e p s i l o n ) ; % without jumps ,

the d i f f u s i o n data can be con s id e r as in BS model

32

Page 35: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

R d i f f u s i o n=R( d i f f u s i o n i n d e x ) ; % the data o f ’d i f f u s i o n i n d e x ’

sigmahat=std ( Rd i f f u s i o n ) / s q r t ( dt ) ;muhat=[2∗mean( Rd i f f u s i on )+(sigmahat ˆ2)∗dt ] / (2∗ dt ) ;s i gma jhat=s q r t ( ( var (Rjumps )−sigmahat ˆ2∗dt ) ) ;mu jhat=mean(Rjumps )−(muhat−sigmahat ˆ2/2)∗dt ;theta0 =[muhat sigmahat lambdahat mu jhat s igma jhat ] ; %

i n i t i a l va lueLogmerton=@(mu, sigma , lambda , mu j , s i gma j )−sum( log (

logmertonpdf (R, dt ,mu, sigma , lambda , mu j , s i gma j ) ) ) ;[ theta f v a l ]= fminsearch (@( theta ) Logmerton ( theta (1 ) ,

theta (2 ) , theta (3 ) , theta (4 ) , theta (5 ) ) , theta0 ) %Maximum l i k e l i h o o d method from i n i t i a l va lue

Rsim=logmertonrnd ( dt , theta (1 ) , theta (2 ) , theta (3 ) , theta(4 ) , theta (5 ) , t , 1 ) ; %s imulated re turn

Logmertons=@(mu, sigma , lambda , mu j , s i gma j )−sum( log (logmertonpdf (Rsim , dt ,mu, sigma , lambda , mu j , s i gma j ) ) );

the ta s=fminsearch (@( theta ) Logmertons ( theta (1 ) , theta (2 ) ,theta (3 ) , theta (4 ) , theta (5 ) ) , theta ) ;%maximuml i k e l i h o o d method from est imated value ’ theta ’

d i sp ( [ ’mu ’ num2str ( [ theta0 (1 ) theta (1 ) the ta s (1 ) ] ) ] )d i sp ( [ ’ sigma ’ num2str ( [ theta0 (2 ) theta (2 ) the ta s (2 ) ] )

] )d i sp ( [ ’ lambda ’ num2str ( [ theta0 (3 ) theta (3 ) the ta s (3 ) ] )

] )d i sp ( [ ’muj ’ num2str ( [ theta0 (4 ) theta (4 ) the ta s (4 ) ] ) ] )d i sp ( [ ’ s igmaj ’ num2str ( [ theta0 (5 ) theta (5 ) the ta s (5 ) ] )

] )%moment e s t imat ion o f e m p i r i c a l log−r e turnM1sp=mean(R) ;M2sp=sum ( (R−M1sp) . ˆ 2 ) /( l ength (R)−1) ;%the second c e n t r a l

momentM3sp=sum ( (R−M2sp) . ˆ 3 ) /( l ength (R)−1) ; % the th i rd

c e n t r a l momentM4sp=sum ( (R−M3sp) . ˆ 4 ) /( l ength (R)−1) ; % the four th

c e n t r a l momentBeta3sp=M3sp/(M2sp ˆ ( 1 . 5 ) ) ;%Skewness c o e f f i c i e n tBeta4sp=M4sp/(M2spˆ(2) ) ;%Kurtos i s c o e f f i c i e n t%moment e s t imat ion o f est imated parameters by formulasM1=(theta (1 )−theta (2 ) ˆ2/2+ theta (3 ) ∗ theta (4 ) )∗dt ;

33

Page 36: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

M2=(theta (2 )ˆ2+theta (3 ) ∗( theta (5 )ˆ2+theta (4 ) ˆ2) )∗dt ;M3=(3∗ theta (5 )ˆ2+theta (4 ) ˆ2)∗ theta (4 ) ∗ theta (3 ) ∗dt ;M4=(3∗ theta (5 ) ˆ4+6∗ theta (4 ) ˆ2∗ theta (5 )ˆ2+theta (4 ) ˆ4)∗

theta (3 ) ∗dt+(3∗ theta (3 ) ˆ(2) ∗( theta (5 )ˆ2+theta (4 ) ˆ2)ˆ(2)+6∗ theta (3 ) ∗ theta (2 ) ˆ(2) ∗( theta (5 )ˆ2+theta (4 ) ˆ2)+3∗ theta (2 ) ˆ(4) ) ∗( dt ˆ2) ;

Beta3=M3/(M2ˆ ( 1 . 5 ) ) ;%Skewness c o e f f i c i e n tBeta4=M4/(M2ˆ(2) ) ;%Kurtos i s c o e f f i c i e n t

func t i on pd f l og=logmertonpdf ( r , dt ,mu, sigma , lambda , mu j ,s i gma j ) % bu i ld a dens i ty func t i on o f MJD model

i f lambda>0nterm=100;term=ze ro s ( l ength ( r ) , nterm ) ;% return a matrix

l ength ( r ) ∗100f o r k=1:nterm

po i s son=(lambda∗dt ) ˆk/prod ( 1 : k )∗exp(−lambda∗dt );

normal=1/ s q r t (2∗ pi ∗( sigma ˆ2∗dt+s igma j ˆ2∗k ) )∗exp(−(r−((mu−sigma ˆ2/2)∗dt+mu j∗k ) ) . ˆ2/ (2∗ (sigma ˆ2∗dt+s igma j ˆ2∗k ) ) ) ;

term ( : , k ) =po i s son ∗normal ;endpd f l og=sum ( [ 1 / s q r t (2∗ pi ∗ sigma ˆ2∗dt )∗exp(−(r−(mu−

sigma ˆ2/2)∗dt ) .ˆ2/(2∗ sigma ˆ2∗dt ) )∗exp(−lambda∗dt ) term ] , 2 ) ;

e l s e% lambda <=0pdf l og=1/ s q r t (2∗ pi ∗ sigma ˆ2)∗exp(−(r−(mu−sigma

ˆ2/2)∗dt ) . ˆ2/ (2∗ ( sigma ˆ2∗dt ) ) ) ;end

end% bui ld a func t i on o f s imulated l oga r i thmi c re turn o f

MJD modelfunc t i on Rsim=logmertonrnd ( dt ,mu, sigma , lambda , mu j ,

s igma j , t , Ns)dN=po i s s rnd ( lambda∗dt , l ength ( t )−1,Ns) ;% number o f jump

between g r id po intY=mu j∗dN+s igma j ∗ s q r t (dN) .∗ randn ( l ength ( t )−1,Ns) ;% sum

of the normal jumps between g r id po in t sdW=s q r t ( dt ) .∗ normrnd (0 , 1 , l ength ( t )−1,Ns) ;% brownian

motion

34

Page 37: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Rsim=(mu−sigma ˆ2/2)∗dt+sigma∗dW+Y;end

35

Page 38: Regeldokument - Linnéuniversitetetlnu.diva-portal.org/smash/get/diva2:1257256/FULLTEXT01.pdf · 3.1 Some used probability de nitions 3.1.1 Distribution functions De nition 2. For

Faculty of Technology SE-391 82 Kalmar | SE-351 95 Växjö Phone +46 (0)772-28 80 00 [email protected]