This action might not be possible to undo. Are you sure you want to continue?
:
A Practical Approach
with
Matlab Code
Nimalin Moodley
2005
An Honours Project
submitted to the
Faculty of Science,
University of the Witwatersrand,
Johannesburg,
South Africa,
in partial fulﬁllment
of the requirements of the
Bachelor of Science Honours,
Programme in Advanced Mathematics of Finance
by
Nimalin Moodley
nimalin@yahoo.com
Acknowledgements
My gratitude and appreciation goes out to the following people: My Internal
Supervisor and ‘Chief’ of Maths of Finance, Prof. David Taylor, for running
the slickest department ever, his advice and motivation. Dr Graeme West (aka
Supa G), for his help, advice, selﬂessness, and inspiration. Grant Lotter, the
Don of L
A
T
E
X, for inspiring me to further my L
A
T
E
X skills. Ulrich N¨ ogel of
FraunhoferInstitut f¨ ur Technound Wirtschaftsmathematik for his advice and
encouragement. The Class of 2005 for creating an environment that encour
aged learning and challenged my thinking thus enabling me to achieve greater
things. My family and Adisha, for all their love and support. Oscar (PhD
Chaos Theory), for sitting by me while I researched. Marchand van Rooyen,
for suggesting the topic.
i
“If I have seen further it is by standing on the
shoulders of Giants.”
Sir Isaac Newton
This project is dedicated to my Grandfather.
Thank you for being that intellectual Giant.
ii
ABSTRACT
This document covers various aspects the Heston model. The structure
and topics covered is as follows:
Chapter 1 introduces the model and provides theoretical and graphi
cal motivation for its robustness and hence popularity. It also discusses
pricing using the Partial Differential Equation and Equivalent Martin
gale Measure techniques
Chapter 2 discusses how the different components of the model can be
evaluated computationally and how this can be achieved with different
methods. These methods are then compared to each other.
Chapter 3 addresses the calibration problem. Different methods are
presented as well as practical implementation, results thereof, and com
parisons.
All the MATLAB code required to implement the model is provided in
the appendix
iii
Contents
Introduction 1
I. A Brief Overview 2
1.
1
The Heston Model . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.
2
Motivation and Parameters . . . . . . . . . . . . . . . . . . . . . 2
1.
3
Pricing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.
3
.
1
PDE approach . . . . . . . . . . . . . . . . . . . . . . . 8
1.
3
.
2
Risk Neutral approach . . . . . . . . . . . . . . . . . . . 8
II. Computational Evaluation 10
2.
1
The ClosedForm Solution . . . . . . . . . . . . . . . . . . . . . 10
2.
2
Fast Fourier Transform (FFT) . . . . . . . . . . . . . . . . . . . . 11
2.
3
Numerical Integration  Quadrature Rules . . . . . . . . . . . . . 14
2.
3
.
1
Adaptive Simpson’s Rule . . . . . . . . . . . . . . . . . . 14
2.
3
.
2
Adaptive Gaussian Quadrature Rules . . . . . . . . . . . 16
2.
3
.
3
Computation of the ‘Heston Integral’ . . . . . . . . . . . 17
2.
3
.
4
Comparison of Quadrature Rules . . . . . . . . . . . . . . 18
2.
4
Comparison of FFT and Numerical Integration . . . . . . . . . . 18
III Calibration 21
3.
1
The Calibration Problem . . . . . . . . . . . . . . . . . . . . . . 21
3.
2
Calibration methods . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.
2
.
1
Regularisation . . . . . . . . . . . . . . . . . . . . . . . 23
3.
2
.
2
Matlab’s lsqnonlin . . . . . . . . . . . . . . . . . . . 24
3.
2
.
3
Excel’s Solver . . . . . . . . . . . . . . . . . . . . . . . 25
3.
2
.
4
Simulated Annealing (SA) . . . . . . . . . . . . . . . . . 25
3.
2
.
5
Adaptive Simulated Annealing (ASA) . . . . . . . . . . . 27
3.
3
Calibration Results . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.
4
Comparisons, Considerations and Shortcomings . . . . . . . . . . 29
3.
5
Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Conclusion 33
iv
Contents
Appendix 34
A.
1
Simulation of Probability Densities . . . . . . . . . . . . . . . . . 34
A.
2
Generating Volatility Surfaces and Skews . . . . . . . . . . . . . 35
A.
3
Evaluation of the ClosedForm Solution . . . . . . . . . . . . . . 37
A.
3
.
1
European Call using FFT . . . . . . . . . . . . . . . . . . 37
A.
3
.
2
European Call using Numerical Integration . . . . . . . . 40
A.
4
Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
A.
4
.
1
Using Matlab’s lsqnonlin . . . . . . . . . . . . . . . 41
A.
4
.
2
Adaptive Simulated Annealing (ASA) in MATLAB . . . . 43
References 46
v
Introduction
The Heston Model is one of the most widely used stochastic volatility (SV)
models today. Its attractiveness lies in the powerful duality of its tractability and
robustness relative to other SV models.
This project initially begun as one that addressed the calibration problem of
this model. Attempting to solve such a problem was an impossible task due to the
lack of exposure to such ‘advanced’ models.
I, therefore, decided to take a slight digression into the world of Heston and
stochastic volatility. Enroute I realised that fundamental information that one
would require to gain an intuitive understanding of such a model was very dis
joint and hence incomplete. This project, therefore, evolved into something that
could ﬁll this gap.
A practical approach has been adopted since the focus of calibration is quite
practical itself. All the relevant tools are provided to facilitate this calibration
process, including MATLAB code. This code has been conﬁned to the appendix to
keep the main body clutter free and ‘quicktoread’.
All the functions and spreadsheets herein mentioned are included on the at
tached CD so that the reader is not conﬁned to this document and has some sort
of practical reference when approaching this subject.
1
CHAPTER I
A Brief Overview
The purpose of this section is to give the reader a succinct overview of the Heston
Model. A ‘broadbrush’, pragmatic approach is adopted to give the reader an
intuitive understanding of the model, rather than an overly technical one, so that
the sections that follow are easily absorbed. If further technical details are desired,
the reader is directed to the relevant references.
1.
1
The Heston Model
(Heston 1993) proposed the following the model:
dS
t
= µS
t
dt +
_
V
t
S
t
dW
1
t
(1.1)
dV
t
= κ(θ −V
t
)dt +σ
_
V
t
dW
2
t
(1.2)
dW
1
t
dW
2
t
= ρdt (1.3)
where {S
t
}
t≥0
and {V
t
}
t≥0
are the price and volatility processes, respectively, and
{W
1
t
}
t≥0
, {W
2
t
}
t≥0
are correlated Brownian motion processes (with correlation
parameter ρ). {V
t
}
t≥0
is a square root mean reverting process, ﬁrst used by (Cox,
Ingersoll & Ross 1985), with longrun mean θ, and rate of reversion κ. σ is
referred to as the volatility of volatility. All the parameters, viz. µ, κ, θ, σ, ρ, are
time and state homogenous.
1.
2
Motivation and Parameters
There are many economic, empirical, and mathematical reasons for choosing a
model with such a form (see (Cont 2001) for a detailed statistical/ empirical analy
sis).
Empirical studies have shown that an asset’s logreturn distribution is non
Gaussian. It is characterised by heavy tails and high peaks (leptokurtic). There
is also empirical evidence and economic arguments that suggest that equity re
turns and implied volatility are negatively correlated (also termed ‘the leverage
effect’). This departure from normality plagues the BlackScholesMerton model
with many problems.
In contrast, Heston’s model can imply a number of different distributions. ρ,
which can be interpreted as the correlation between the logreturns and volatility
2
1.2 Motivation and Parameters 3
of the asset, affects the heaviness of the tails. Intuitively, if ρ > 0, then volatility
will increase as the asset price/return increases. This will spread the right tail
and squeeze the left tail of the distribution creating a fat righttailed distribution.
Conversely, if ρ < 0, then volatility will increase when the asset price/return
decreases, thus spreading the left tail and squeezing the right tail of the distribution
creating a fat lefttailed distribution (emphasising the fact that equity returns and
its related volatility are negatively correlated). ρ, therefore, affects the skewness
of the distribution. Figure 1.1 shows this effect for different values ρ. Matlab
code for this simulation can be found in the appendix, § A.
1
.
9 9.5 10 10.5 11
0
0.01
0.02
0.03
0.04
0.05
0.06
ρ = 0.9
ρ = 0
ρ = −0.9
Figure 1.1: The eﬀect of ρ on the skewness of the
density function
The effect of changing the skewness of the distribution also impacts on the
shape of the implied volatility surface. Hence, ρ also affects this. Figures 1.2,
1.3 and 1.4 show the effect of varying ρ. As can be seen, the model can im
ply a variety of volatility surfaces and hence addresses another shortcoming of
the BlackScholesMerton model, viz., constant volatility across differing strike
levels. Matlab code for generation of the volatility surfaces can be found in §
A.
2
.
σ affects the kurtosis (peak) of the distribution. When σ is 0 the volatility is
deterministic and hence the logreturns will be normally distributed. Increasing σ
will then increase the kurtosis only, creating heavy tails on both sides. Figure 1.5
shows the effect of varying σ. Matlab code for this simulation can be found in
the appendix, § A.
1
.
1.2 Motivation and Parameters 4
0
1
2
3
0.8
0.9
1
1.1
1.2
0.185
0.19
0.195
0.2
0.205
0.21
Maturity(years)
ρ = 0.5
Strike
I
m
p
l
i
e
d
V
o
l
a
t
i
l
i
t
y
Figure 1.2: Implied volatility surface, ρ =
1
2
, κ = 2,
θ = 0.04, σ = 0.1, V
0
= 0.04, r = 1%, S
0
=1, strikes
: 0.8 −1.2, maturities : 0.5 −3 years
0
1
2
3
0.8
0.9
1
1.1
1.2
0.199
0.2
0.201
0.202
Maturity(years)
ρ = 0
Strike
I
m
p
l
i
e
d
V
o
l
a
t
i
l
i
t
y
Figure 1.3: Implied volatility surface, ρ = 0, κ = 2,
θ = 0.04, σ = 0.1, V
0
= 0.04, r = 1%, S
0
=1, strikes
: 0.8 −1.2, maturities : 0.5 −3 years
Again, the effect of changing the kurtosis of the distribution impacts on the
implied volatility. Figures 1.6, 1.7 and 1.8 show how σ affects the ‘signiﬁcance’
of the smile/skew. Higher σ makes the skew/smile more prominent. This makes
sense relative to the leverage effect. Higher σ means that the volatility is more
volatile. This means that the market has a greater chance of extreme movements.
So, writers of puts must charge more and those of calls, less, for a given strike.
1.2 Motivation and Parameters 5
0
1
2
3
0.8
0.9
1
1.1
1.2
0.19
0.195
0.2
0.205
0.21
0.215
Maturity(years)
ρ = −0.5
Strike
I
m
p
l
i
e
d
V
o
l
a
t
i
l
i
t
y
Figure 1.4: Implied volatility surface, ρ = −
1
2
, κ =
2, θ = 0.04, σ = 0.1, V
0
= 0.04, r = 1%, S
0
=1,
strikes : 0.8 −1.2, maturities : 0.5 −3 years
0.092 0.094 0.096 0.098 0.1 0.102 0.104 0.106 0.108 0.11
0
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
σ = 0
σ = 0.1
σ = 0.25
Figure 1.5: The eﬀect of σ on the kurtosis of the
density function
Matlab code for generation of the volatility smiles/skews can be found in § A.
2
.
κ, the mean reversion parameter, can be interpreted as representing the degree
of ‘volatility clustering’. This is something that has been observed in the market,
viz., large price variations are more likely to be followed by large price variations
1.2 Motivation and Parameters 6
0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2
0.17
0.18
0.19
0.2
0.21
0.22
0.23
I
m
p
l
i
e
d
V
o
l
a
t
i
l
i
t
y
Strike
ρ = 0.5
σ = 0.1
σ = 0.2
σ = 0.3
σ = 0.4
Figure 1.6: Implied volatility surface, ρ =
1
2
, κ = 2,
θ = 0.04, σ = 0.1, V
0
= 0.04, r = 1%, S
0
=1, strikes
: 0.8 −1.2, maturities : 0.5 −3 years
0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2
0.19
0.195
0.2
0.205
I
m
p
l
i
e
d
V
o
l
a
t
i
l
i
t
y
Strike
ρ = 0
σ = 0.1
σ = 0.2
σ = 0.3
σ = 0.4
Figure 1.7: Implied volatility surface, ρ = 0, κ = 2,
θ = 0.04, σ = 0.1, V
0
= 0.04, r = 1%, S
0
=1, strikes
: 0.8 −1.2, maturities : 0.5 −3 years
(Cont 2001).
A computationally convenient feature of the model is that it provides a closed
1.3 Pricing Options 7
0.8 0.85 0.9 0.95 1 1.05 1.1 1.15 1.2
0.17
0.18
0.19
0.2
0.21
0.22
0.23
I
m
p
l
i
e
d
V
o
l
a
t
i
l
i
t
y
Strike
ρ = −0.5
σ = 0.1
σ = 0.2
σ = 0.3
σ = 0.4
Figure 1.8: Implied volatility surface, ρ = −
1
2
, κ =
2, θ = 0.04, σ = 0.1, V
0
= 0.04, r = 1%, S
0
=1,
strikes : 0.8 −1.2, maturities : 0.5 −3 years
form solution for European options, making it more tractable and easier to imple
ment than other stochastic volatility models
1
.
The aforementioned features of this model enables it to produce a barrage of
distributions. This makes the model very robust and hence addresses the short
comings of the BlackScholesMerton model. It provides a framework to price a
variety of options that is closer to reality.
1.
3
Pricing Options
In the BlackScholesMerton model, a contingent claim is dependent on one or
more tradable assets. The randomness in the option value is solely due to the
randomness of these assets. Since the assets are tradable, the option can be hedged
by continuously trading the underlyings. This makes the market complete, i.e.,
every contingent claim can be replicated.
In a stochastic volatility model, a contingent claim is dependent on the ran
domness of the asset ({S
t
}
t≥0
) and the randomness associated with the volatil
ity of the asset’s return ({V
t
}
t≥0
). Only one of these is tradable, viz., the asset.
Volatility is not a traded asset. This renders the market incomplete and has many
1
more speciﬁcally, it provides a closedform solution for any value of ρ. Models like
Hull and White only provide such closedform solutions for certain values of ρ.
1.3 Pricing Options 8
implications to the pricing of options.
1.
3
.
1
PDE approach
For purposes of brevity, the derivation of the PDE is not done here. The reader
is directed to (Black & Scholes 1973), (Gatheral 2004), (Majmin 2005) or (Xu
2003) for further details. Under the Heston model, the value of any option,
U(S
t
, V
t
, t, T), must satisfy the following partial differential equation,
1
2
V S
2
∂
2
U
∂S
2
+ ρσV S
∂
2
U
∂S∂V
+
1
2
σ
2
V
∂
2
U
∂V
2
+ rS
∂U
∂S
+{κ[θ −V ] −Λ(S, V, t)σ
√
V }
∂U
∂V
−rU +
∂U
∂t
= 0 (1.4)
Λ(S, V, t) is called the market price of volatility risk. Heston assumes that the
market price of volatility risk is proportional to volatility, i.e.
Λ(S, V, t) = k
√
V for some constant k
⇒ Λ(S, V, t)σ
√
V = kσV
t
= λ(S, V, t), say
λ(S, V, t) therefore represents the market price of volatility risk. This parameter
does not appear in (1.1), (1.2) or (1.3) but does appear in the pricing formula, (2.1),
and hence needs to be approximated. This is no easy task as it well known that
the market price of volatility risk is nearly impossible to estimate. This problem is
overcome due to the parametric nature of the model and the existence of a closed
form solution (see § 3.
1
and § 2.
1
).
1.
3
.
2
Risk Neutral approach
Risk neutral valuation is the pricing of a contingent claim in an equivalent martin
gale measure (EMM). The price is evaluated as the expected discounted payoff of
the contingent claim
2
, under the EMMQ, say. So,
Option Value = E
Q
t
[e
r(T−t)
H(T)] (1.5)
where H(T) is the payoff of the option at time T and r is the risk free rate of
interest over [t, T] (we are assuming, of course, that interest rates are deterministic
and previsible, and that the numeraire is the money market instrument).
2
this is referred to as the ‘Law of the Unconscious Financial Mathematician’
1.3 Pricing Options 9
Moving from a real world measure to an EMM is achieved by Girsavov’s
Theorem. In particular, we have
d
˜
W
1
t
= dW
1
t
+ϑ
t
dt (1.6)
d
˜
W
2
t
= dW
2
t
+ Λ(S, V, t)dt (1.7)
dQ
dP
= exp
_
−
1
2
_
t
0
(ϑ
s
2
+ Λ(S, V, s)
2
)ds −
_
t
0
ϑ
s
dW
1
s
−
_
t
0
Λ(S, V, t)dW
2
s
_
(1.8)
ϑ
t
=
µ −r
√
V
t
(1.9)
where P is the real world measure and {
˜
W
1
t
}
t≥0
and {
˜
W
2
t
}
t≥0
are QBrownian
Motions. Under measure Q, (1.1), (1.2), and (1.3) become,
dS
t
= rS
t
dt +
_
V
t
S
t
d
˜
W
1
t
(1.10)
dV
t
= κ
∗
(θ
∗
−V
t
)dt + σ
_
V
t
d
˜
W
2
t
(1.11)
d
˜
W
1
t
d
˜
W
2
t
= ρdt (1.12)
where,
κ
∗
= κ +λ
θ
∗
=
κθ
κ + λ
This is an important result. Under the riskneutral measure, λ has effectively been
‘eliminated’.
In a complete market, it can be shown that every asset/option has the same
market price of risk (i.e.,
µ
F
−r
σ
F
is constant for any asset F). Since volatility isn’t a
traded asset, the market is incomplete and Λ(S, V, t) isn’t constant. It is clear that
(1.6), (1.7), and (1.8) solely determine the EMM. This implies that the EMM is
not unique and is dependent on the value of Λ(S, V, t).
The implications are that the different EMM’s will produce different option
prices, depending on the value of Λ(S, V, t). This, initially, poses a problem.
Again, due to the parametric nature of the model and the existence of a closed
form solution, we can work around this (see § 2.
1
and § 3.
1
).
CHAPTER II
Computational Evaluation
In order to practically implement such a model, one needs to be able to compute
the price of vanilla options implied by it. This is used in the calibration process to
obtain parameter values, which in turn will be used to price other exotic options.
This section, therefore, provides the tools required to perform such calculations.
2.
1
The ClosedForm Solution
The closedformsolution of a European call option on a nondividend paying asset
for the Heston model is:
C(S
t
, V
t
, t, T) = S
t
P
1
−Ke
−r(T−t)
P
2
(2.1)
where,
P
j
(x, V
t
, T, K) =
1
2
+
1
π
_
∞
0
Re
_
e
−iφln (K)
f
j
(x, V
t
, T, φ)
iφ
_
dφ (2.2)
x = ln (S
t
)
f
j
(x, V
t
, T, φ) = exp {C(T −t, φ) + D(T −t, φ)V
t
+ iφx}
C(T −t, φ) = rφir +
a
σ
2
_
(b
j
−ρσφi + d)τ −2 ln
_
1 −ge
dr
1 −g
__
D(T −t, φ) =
b
j
−ρσφi + d
σ
2
_
1 −e
dr
1 −ge
dr
_
g =
b
j
−ρσφi + d
b
j
−ρσφi −d
d =
_
(ρσφi −b
j
)
2
−σ
2
(2u
j
φi −φ
2
)
for j = 1,2, where,
u
1
=
1
2
, u
2
= −
1
2
, a = κθ, b
1
= κ + λ −ρσ, b
2
= κ + λ
Such a formula looks intimidating, but in reality is quite ‘explicit’ and easy to
evaluate in Matlab. The only part that poses a slight problem is the limits of
the integral in (2.2). This integral cannot be evaluated exactly, but can be approx
imated with reasonable accuracy by using some numerical integration technique,
e.g., Gauss Lagendre or Gauss Lobatto integration.
10
2.2 Fast Fourier Transform (FFT) 11
Under the EMMQ some parameter simpliﬁcation takes place viz,
a = κ
∗
θ
∗
, b
1
= κ
∗
−ρσ, b
2
= κ
∗
Again, it can be seen that, effectively, the parameter λ has been eliminated.
A method to evaluate formulas in the form of (2.1) has been proposed by (Carr
& Madan 1999). This method is much quicker than using a numerical method for
the said integrals.
2.
2
Fast Fourier Transform (FFT)
This method has been proposed by (Carr & Madan 1999). We ﬁrst begin with
some basic deﬁnitions.
Deﬁnition 2.1. The Fourier transform (F{·}) and inverse Fourier trans
form (F
−
1{·}) of an integrable function, f(x), is
F{f(x)} =
_
∞
−∞
e
iφx
f(x)dx = F(φ) (2.3)
F
−1
{F(φ)} =
1
2π
_
∞
−∞
e
−iφx
F(φ)dφ = f(x) (2.4)
In our framework, f(x) is the risk neutral density function of the logreturn
of the underlying and F(φ) is called the characteristic function of f(x). It should
be noted that even if a random variable is not absolutely continuous
3
, its charac
teristic function exists. For absolutely continuous random variables (say X), the
characteristic function can be expressed as an expectation, viz.,
E[e
iφX
]
FFT is an efﬁcient algorithm used to calculate summations of the following
form:
w(k) =
N
j=1
e
−i
2π
N
(j−1)(k−1)
x(j) (2.5)
It is a type of discrete approximation to a Fourier transform. Carr and Madan have
the following to say regarding their method:
‘...ﬁnd that the use of the FFT is considerably faster than most avail
able methods and furthermore, the traditional method described in
Heston , Bates , Bakshi and Madan , and Scott can be both slow and
inaccurate...’
3
A random variable is absolutely continuous if it has a density function.
2.2 Fast Fourier Transform (FFT) 12
Option pricing lends itself well to this sort of application due to the form of (1.5).
Let x
t
:= ln S
t
and k := ln K, where K is the strike price of the option. Then the
value of a European call, with maturity T, as a function of k is,
C
T
(k) = e
−rT
_
∞
k
(e
x
T
−e
k
)f
T
(x
T
)dx
T
(2.6)
where f
T
(x) is the risk neutral density function of x, deﬁned above. Carr and
Madan deﬁne a modiﬁed call price function
4
,
c
T
(k) = e
αk
C
T
(k), α > 0 (2.7)
We now expect c
T
(k) to be square integrable for a range of α values and ∀ k. α
is referred to as the dampening factor. The Fourier transform and inverse Fourier
transform of c
T
(k) is,
F
c
T
(φ) =
_
∞
−∞
e
iφk
c
T
(k)dk (2.8)
c
T
(k) =
1
2π
_
∞
−∞
e
−iφk
F
c
T
(φ)dφ (2.9)
Substituting (2.9) into (2.7),
C
T
(k) = e
−αk
c
T
(k) (2.10)
= e
−αk
1
2π
_
∞
−∞
e
−iφk
F
c
T
(φ)dφ (2.11)
= e
−αk
1
π
_
∞
0
e
−iφk
F
c
T
(φ)dφ (2.12)
Substituting (2.6) and (2.7) into (2.8),
F
c
T
(φ) =
_
∞
−∞
e
iφk
e
αk
e
−rT
_
∞
k
(e
x
T
−e
k
)f
T
(x
T
)dx
T
dk
=
_
∞
−∞
e
−rT
f
T
(x
T
)
_
x
T
−∞
(e
x
T
+αk
−e
(α+1)k
)e
iφk
dkdx
T
=
e
−rT
α
2
+ α −φ
2
+i(2α + 1)φ
_
∞
−∞
e
(α+1+iφ)x
T
f
T
(x
T
)dx
T
=
e
−rT
α
2
+ α −φ
2
+i(2α + 1)φ
_
∞
−∞
e
(−αi−i+φ)ix
T
f
T
(x
T
)dx
T
=
e
−rT
F
C
T
(φ −(α + 1)i)
α
2
+ α −φ
2
+i(2α + 1)φ
4
because C
T
(k) is not square integrable
2.2 Fast Fourier Transform (FFT) 13
where F
C
T
(φ) is the characteristic function of x
T
, under Q, given by (Hong 2004):
F
C
T
(φ) = e
A(φ)+B(φ)+C(φ)
A(φ) = iφ(x
0
+ rT)
B(φ) =
2ζ(φ)(1 −e
−ψ(φ)T
)V
0
2ψ(φ) −(ψ(φ) −γ(φ))(1 −e
−ψ(φ)T
)
C(φ) = −
κθ
σ
2
_
2 log
_
2ψ(φ) −(ψ(φ) −γ(φ))(1 −e
−ψ(φ)T
)
2ψ(φ)
_
+
(ψ(φ) −γ(φ))T
_
ζ(φ) = −
1
2
(φ
2
+ iφ)
ψ(φ) =
_
γ(φ)
2
−2σ
2
ζ(φ)
γ(φ) = κ −ρσφi
(Carr & Madan 1999) show that,
C
T
(k
u
) ≈
e
−αk
u
π
N
j=1
e
−i
2π
N
(j−1)(u−1)
e
ibv
j
F
c
T
(v
j
)
η
3
(3 + (−1)
j
−δ
j−1
)
. ¸¸ .
(2.13)
where
5
,
v
j
= η(j −1)
η =
c
N
c = 600
N = 4096
b =
π
η
k
u
= −b +
2b
N
(u −1), u = 1, 2, . . . , N + 1
This is now a direct application of (2.5) and hence FFT. Matlab can perform
FFT using the fft(X) function, where X is the vector created from . fft(X)
returns a (1 × N) vector whose j
th
column corresponds to a logstrike of −b +
2b
N
(j − 1). The appendix, § A.
3
.
1
, contains the code for pricing a European Call
using FFT.
5
these parameters have been speciﬁed by Carr and Madan so that a balance is struck
between computational time and accuracy.
2.3 Numerical Integration  Quadrature Rules 14
All that remains is to choose the value of α. (Carr & Madan 1999) suggest
that α be chosen such that
E[S
α+1
T
] < ∞ (2.14)
⇒ F
C
T
(−(α + 1)i) < ∞
Carr goes further to provide FFT for outof the money options. He argues that
the above formula depends on the intrinsic value of the option. Since outofthe
money options have no intrinsic value, an FFT based on the time value of the
option has to be derived. The formula is presented here without derivation, for
completeness, as the author ﬁnds very little difference between the solutions of
the two methods. The Matlab code can also be found in § A.
3
.
1
.
C
T
(k
u
) ≈
1
π sinh(αk
u
)
N
j=1
e
−i
2π
N
(j−1)(u−1)
e
ibv
j
γ
T
(v
j
)
η
3
(3 + (−1)
j
−δ
j−1
)
γ
T
(v) =
ϕ
T
(v −iα) −ϕ
T
(v + iα)
2
ϕ
T
(v) = e
−rT
_
1
1 + iv
−
e
rT
iv
−
F
C
T
(v −i)
v
2
−iv
_
2.
3
Numerical Integration  Quadrature Rules
Numerical integration can be used to evaluate the integral in (2.2). Two techniques
are brieﬂy discussed together with their implementation.
2.
3
.
1
Adaptive Simpson’s Rule
The following is adapted from (Cheney & Kincaid 1999). The basic Simpson’s
Rule for numerical integration of a function, f(x), over two equal subintervals,
with partition points a, a + h, and a + 2h (we choose this form of partition for
ease of calculation and notation. A general formula will be given later), is
_
a+2h
a
f(x)dx ≈
h
3
[f(a) + 4f(a +h) + f(a + 2h)] (2.15)
The error of the above approximate can be established with a basic Taylor
6
6
no relation to the internal supervisor of this document.
2.3 Numerical Integration  Quadrature Rules 15
series. Consider,
f(a +h) = f(a) + hf
(a) +
1
2!
h
2
f
(a) +
1
3!
h
3
f
(a) +
1
4!
h
4
f
(4)
(a) + . . .
f(a + 2h) = f(a) + 2hf
(a) + 2h
2
f
(a) +
4
3
h
3
f
(a) +
2
4
4!
h
4
f
(4)
(a) + . . .
So,
RHS of (2.15) = 2hf + 2h
2
f
+
4
3
h
3
f
+
2
3
h
4
f
+
20
3.4!
h
5
f
(4)
(a) + . . .
(2.16)
Now, deﬁne
F(x) :=
_
x
a
f(t)dt
Again, using a Taylor series,
F(a+2h) = F(a)+2hF
(a)+2h
2
F
(a)+
4
3
h
3
F
(a)+
2
3
h
4
F
(4)
(a)+
2
5
5!
h
5
F
(5)
(a) . . .
Noting, by the Fundamental Theorem of Calculus, that F
(n+1)
(a) = f
(n)
(a) and
F(a) = 0 we have
_
a+2h
a
f(x)dx = F(a + 2h)
= 2hf(a) + 2h
2
f
(a) +
4
3
h
3
f
(a) +
2
3
h
4
f
(a) + . . .
(2.17)
Subtracting (2.16) from (2.17), we get,
Error in approximation = −
h
5
90
f
(4)
(ξ) = O(h
5
), ξ ∈ (a, a + 2h)
We now state a general result for the basic Simpson’s Rule,
_
b
a
f(x)dx ≈
b −a
6
_
f(a) + 4f
_
a + b
2
_
+ f(b)
_
Error = −
1
90
_
b −a
2
_
5
f
(4)
(ξ), ξ ∈ (a, b)
An Adaptive Simpson’s Rule divides the interval of integration into more than
2 subintervals. The number of subintervals is dependent on the required accuracy
2.3 Numerical Integration  Quadrature Rules 16
of the estimate. This is quantiﬁed by the error term given above. The function
will, in general, behave differently over different parts of the interval and hence
the intervals chosen will not be of uniform length.
The Matlab function quad(@fun,a,b) uses an Adaptive Simpson’s Rule
to numerically integrate @fun over [a,b]. It produces a result that has an error
less than 10
−6
or a user deﬁned tolerance level which is prescribed by a fourth
argument.
2.
3
.
2
Adaptive Gaussian Quadrature Rules
Gaussian quadrature rules approximate the integral of a function, f(x), over [a, b]
by:
_
b
a
f(x)dx ≈
n
i=0
A
i
f(x
i
) (2.18)
where,
A
i
=
_
b
a
i
(x)dx
i
(x) =
n
j=0
j=i
_
x −x
j
x
i
−x
j
_
where {x
i
}
0≤i≤n
, termed nodes or abscissae, are the zeros of a Lagrange interpo
lating polynomial.
ALagrange interpolating polynomial is a polynomial of order n−1 that passes
through n given points. Examples can be seen in ﬁgure 2.1.
The approximation in (2.18) is a weighted average of the function at dis
crete nodes, {x
i
}
0≤i≤n
, with weights {A
i
}
0≤i≤n
. The interpolating polynomial,
p
n+1
(x), of degree n + 1 must satisfy:
_
b
a
x
k
p(x)dx = 0, (0 ≤ k ≤ n)
It is quite intuitive that the choice of the polynomials will determine the accuracy
of the estimate in (2.18). The most popular choice of these polynomials are the
Legendre polynomials. These are generated by setting the interval of integration
to [−1, 1] and standardising p
n
(x) such that p
n
(1) = 1. The roots of these polyno
mials will then be used as nodes in the Gaussian quadrature over [−1, 1]. A simple
linear transformation can translate the original integral over [a, b] to [−1, 1].
2.3 Numerical Integration  Quadrature Rules 17
0 2 4 6
0
2
4
6
n=2
0 2 4 6
0
5
10
15
20
n=3
0 2 4 6
0
5
10
15
20
n=4
0 2 4 6
−100
0
100
200
300
400
500
n=5
Figure 2.1: Lagrange interpolating polynomials for
n = 2, 3, 4 and 5 points. These polynomials are of
order 1, 2, 3 and 4 respectively.
The Matlab function quadl(@fun,a,b) implements an adaptive Gauss Lo
batto quadrature rule on the function @fun over the interval [a, b]. It’s deﬁned as
the Gaussian quadrature presented above, with a speciﬁc form for the weights and
nodes. The integral is evaluated over [−1, 1] with nodes that are from the Legen
dre polynomials. The nodes are symmetric about the origin and also include the
endpoints of the interval. The error in the estimate is given by,
Error = −
n(n −1)
3
2
2n−1
((n −2)!)
4
(2n −1)((2n −2)!)
3
f
(2n−2)
(ξ)
where n = number of nodes, and ξ ∈ (−1, 1). The rule is adaptive as it divides the
original integral into smaller subintervals and performs Gauss Lobatto integration
with varying node quantities. This is performed to achieve an estimate whose error
is less than 10
−6
or a user deﬁned tolerance level prescribed by a fourth argument.
2.
3
.
3
Computation of the ‘Heston Integral’
In order to evaluate (2.1) we need to compute the integral in (2.2), viz.:
P
j
(x, V
t
, T, K) =
1
2
+
1
π
_
∞
0
Re
_
e
−iφln (K)
f
j
(x, V
t
, T, φ)
iφ
_
dφ (2.19)
2.4 Comparison of FFT and Numerical Integration 18
for j = 1, 2. This can be done in Matlab with the 2 functions, quad(@fun
a,b) and quadl(@fun,a,b), discussed above. A problem arises as (2.19) is
an improper integral and the argument b cannot be speciﬁed as ‘inﬁnity’ i.e.,
quad(@fun,a,b) evaluates only proper integrals. A quick plot of the integrand
will reveal that it converges very quickly to zero. Figure 2.2 shows the effect of
changing the parameters on the integrand. The parameters that were changed were
those that had the most signiﬁcant effect on the integrand.
So, for sufﬁciently large b, the integral of (2.19) can be evaluated with the
required accuracy. I have chosen b = 100 to be prudent.
Matlab code to price a European call option using Heston’s model via Adap
tive Gauss Lobatto integration/Simpson’s Rule can be found in the appendix, §
A.
3
.
2
.
2.
3
.
4
Comparison of Quadrature Rules
The purpose of this section is to gauge which quadrature rule to use. For a com
plete discussion refer to (Gander & Gautschi 1998).
Matlab deﬁnes the functions, quad and quadl, as low order and high order
quadrature rules. One would therefore expect quadl to be superior.
(Gander & Gautschi 1998) say that for extremely small tolerance levels quadl
outperforms quad in:
• efﬁciency as measured by the number of recursive steps required to compute
an answer within a certain tolerance level.
• reliability as measured by the extent to which the required tolerance is
achieved.
For large tolerance levels, quad is more efﬁcient (faster) than quadl, but less
reliable. Keeping in mind that we’re pricing options, we require an extremely low
tolerance level. Hence quadl would be better suited for our purposes.
2.
4
Comparison of FFT and Numerical Integration
It now remains to ﬁnd which method is better suited for our purposes.
FFT is faster in a sense that it generates a matrix of prices with differing
strikes. Thousands of European call option prices are immediately available. The
quadrature rule evaluates the option price only for a given set of parameters, i.e.,
2.4 Comparison of FFT and Numerical Integration 19
0 20 40 60 80 100
−5
0
5
10
15
x 10
−3
φ
σ = 0.1, strike = 100, maturity = 1 month
0 20 40 60 80 100
−0.05
0
0.05
0.1
0.15
φ
σ = 0.1, strike = 100, maturity = 1 year
0 20 40 60 80 100
−0.2
0
0.2
0.4
0.6
0.8
φ
σ = 0.1, strike = 50, maturity = 1 month
0 20 40 60 80 100
−0.4
−0.3
−0.2
−0.1
0
0.1
φ
σ = 0.1, strike = 150, maturity = 1 month
0 20 40 60 80 100
−0.05
0
0.05
0.1
0.15
φ
σ = 0.9, strike = 100, maturity = 1 month
0 20 40 60 80 100
−5
0
5
10
15
x 10
−3
φ
σ = 0.1, strike = 100, maturity = 1 month
Figure 2.2: The Integrand of (2.19). Notice how
quickly this integrand converges to zero. Parame
ters that were kept constant : κ = 2, θ = 0.04, ρ =
−0.5, V
0
= 0.05, S
0
= 100, r = 0.1
only for one strike price at a time. The time difference is extremely signiﬁcant.
For a given set of parameters, FFT calculates prices for 4097 different strikes
in approximately 0.14 seconds. The quadrature rule takes approximately 281.89
seconds to perform the same calculation. FFT is faster by a factor of 2014.
FFT, in this application, suffers from one drawback, i.e., accuracy. The solu
tions produced are depend on the choice of α (ﬁgure 2.3 shows the price produced
by FFT as a function of α). From (2.14) we can also see that α is depend on the set
of parameters. The relationship between α and these parameters is not as trivial
2.4 Comparison of FFT and Numerical Integration 20
to identify as is done in (Carr & Madan 1999) for the VarianceGamma model.
We are therefore left with the quadrature rule as our primary tool for evalua
tion. If an α can be found that satisﬁes (2.14), then FFT is far superior.
0 1 2 3 4 5
30
31
32
33
34
35
36
37
38
39
α
p
r
i
c
e
Figure 2.3: This illustrates how the price of an
option is depend on the choice of α
CHAPTER III
Calibration of the Model
3.
1
The Calibration Problem
The price to pay for more realistic models is the increased complexity of model
calibration. Often, the estimation method becomes as crucial as the model itself
(Cont 2005).
The Heston model has six parameters that need estimation, viz., κ, θ, σ, V
0
,
ρ, λ. Research has shown that the implied parameters (i.e. those parameters that
produce the correct vanilla option prices) and their timeseries estimate counter
parts are different (see (Bakshi, Cao & Chen 1997)). So one cannot just use
empirical estimates for the parameters.
This leads to a complication that plagues stochastic volatility models in gen
eral
7
. A common solution is to ﬁnd those parameters which produce the correct
market prices of vanilla options. This is called an inverse problem, as we solve
for the parameters indirectly through some implied structure
8
.
The most popular approach to solving this inverse problem is to minimise the
error or discrepancy between model prices and market prices. This usually turns
out to be a nonlinear leastsquares optimisation problem. More speciﬁcally, the
squared differences between vanilla option market prices and that of the model
are minimised over the parameter space, i.e., we evaluate
min
Ω
S(Ω) = min
Ω
N
i=1
w
i
_
C
Ω
i
(K
i
, T
i
) −C
M
i
(K
i
, T
i
)
¸
2
(3.1)
where Ω is a vector of parameter values, C
Ω
i
(K
i
, T
i
) and C
M
i
(K
i
, T
i
) are the i
th
option prices from the model and market, respectively, with strike K
i
and maturity
T
i
. N is the number of options used for calibration, and the w
i
’s are weights (the
choice of these weights will be discussed later).
The question now arises as to what market prices to use in this calibration
process, as for any given option there exists a bid and ask price. This may seem
as a problem but it actually allows ﬂexibility in the calibration process.
7
On the positive side, we need not estimate the market price of volatility risk, which
is near impossible to do in practice.
8
eg. solving for a polynomial with given roots is an inverse problem.
21
3.2 Calibration methods 22
We will use the midprice of the option but accept a parameter set, Ω
0
, given
that
N
i=1
w
i
_
C
Ω
0
i
(K
i
, T
i
) −C
M
i
(K
i
, T
i
)
¸
2
≤
N
i=0
w
i
[bid
i
−ask
i
]
2
(3.2)
where bid
i
/ask
i
are the bid/ask prices of the i
th
option. This means that we do
not require the model to match the midprices exactly, but fall, on average, within
the bidoffer spread. This is not an unreasonable relaxation of the calibration
process. We should bare in mind that the modeling process should produce the
required estimates within a certain tolerance level. Accuracy beyond this could be
spurious and hence produce less accurate exotic prices.
The minimisation mentioned above is not as trivial as it would seem. In gen
eral, S(Ω) is neither convex nor does it have any particular structure. This poses
some complications:
• Finding the minimum of S(Ω) is not as simple as ﬁnding those parameter
values that make the gradient of S(Ω) zero. This means that a gradient
based optimisation method will prove to be futile.
• Hence, ﬁnding a global minimum is difﬁcult (and very dependent on the
optimisation method used).
• Unique solutions to (3.1) need not necessarily exist, in which case only local
minima can be found. This has some implications regarding the stationarity
of parameter values which are important in these types of models. This is
discussed later.
The last two points make this an illposed problem. This is therefore an in
verse, illposed problem termed the calibration problem.
Figure 3.1 plots S(Ω) as a function of κ and σ. It is easy to see that gradient
based optimisers will struggle to ﬁnd a global minimum. Notice, also, the number
of points that are nondifferentiable. This poses a further problem for gradient
based optimisers. The graph presents a graphical idea of the nature of S(Ω) as
a function of two of its parameters, but it is important to remember that S(Ω) is
5dimensional and as such could be even nastier in its ‘true’ form.
The aim is therefore to identify optimisation methods that can deal with the
peculiarities of the calibration problem.
3.
2
Calibration methods
Before discussing the calibration methods, we address some technical issues.
3.2 Calibration methods 23
0
5
10
15
0
5
10
0
1
2
3
4
x 10
4
σ
κ
W
e
i
g
h
t
e
d
S
q
u
a
r
e
d
E
r
r
o
r
s
Figure 3.1: The Heston error surface as a function
of κ and σ
The calibration problem has a slight simpliﬁcation when we price options un
der an EMM, i.e., we can evaluate (3.1) using the C
Ω
i
(K
i
, T
i
)’s under an EMM.
As mentioned in § 1.
3
.
2
, evaluation under an EMM effectively reduces the number
of estimated parameters to ﬁve. The following must therefore hold:
OptionValue
P
(κ, θ, σ, V
0
, ρ, λ) = OptionValue
Q
(κ
∗
, θ
∗
, σ, V
0
, ρ, 0)
We also address the choice of the weights in (3.1). We choose the w
i
’s to be
1
bid
i
−ask
i

. This choice is quite intuitive. If the spread is great, we have a wider
range of prices that the model can imply. In other words the model is allowed to
imply a wider range of prices around the midprice. This means that less weight
should be placed on such a price, and viceversa. (Cont 2005) suggests using the
implied volatilities as weights.
We also need a constraint on the parameters to prevent the volatility reaching
zero. (Mikhailov & N¨ ogel 2003) suggest that this constraint be 2κθ > σ
2
.
3.
2
.
1
Regularisation
This method is discussed brieﬂy for completeness. For a detailed discussion refer
to (Chiarella, Craddock & ElHassan 2000).
Regularisation involves adding a penalty function, p(Ω), to (3.1) such that
N
i=1
w
i
_
C
Ω
i
(K
i
, T
i
) −C
M
i
(K
i
, T
i
)
¸
2
+ αp(Ω) (3.3)
3.2 Calibration methods 24
is convex. α, here, is called the regularisation parameter.
The philosophy behind this strategy is one of pragmatism. We cannot hope
to determine the exact solution to our problem because of its very nature. Conse
quently, we attempt to ﬁnd an approximation which is as close to the true solution
as possible. To achieve this we are moved to replace our problem with one which
is close to the original, but does not possess the ill conditioning which the makes
the original intractable. In other words: Don’t try and solve the given problem,
try and solve a different one whose solution is close to that of your problem. This
is the essence of all regularisation methods (Chiarella et al. 2000).
When applied to a given set of market prices, these methods yield a single
set of model parameters calibrated to the market but also require the extra step of
determining the regularisation parameter, α (Cont 2005).
(Mikhailov & N¨ ogel 2003) suggest using αp(Ω) = Ω−Ω
0

2
, where Ω
0
is
an initial estimate of the parameters. This method is therefore dependent on the
choice of the the initial parameters. It is, in a sense, a local minimum optimiser.
Equation (3.3) can be minimised in MATLAB using the function lsqnonlin().
3.
2
.
2
Matlab’s lsqnonlin
MATLAB’S leastsquares, nonlinear optimiser is the function lsqnonlin(fun,
x0,lb,ub). It minimises the vectorvalued function, fun, using the vector of
initial parameter values, x0, where the lower and upper bounds of the parameters
are speciﬁed in vectors lb and ub, respectively.
lsqnonlin uses an interiorreﬂective Newton method for large scale prob
lems. MATLAB deﬁnes a large scale problem as one containing bounded / un
bounded parameters, where the system is not underdetermined, i.e., where the
number of equations to solve is more than the required parameters. Given that the
underlying of the model is liquidly traded, there should exist a rich set of market
prices for calibration. So, hopefully, our system will never be underdetermined
9
.
MATLAB suggests (Coleman & Li 1996) and (Coleman & Li 1994) for further
reference on these methods.
The result produced by lsqnonlin is dependent on the choice of x0, the initial
estimate. This is, therefore, not a global optimiser, but rather, a local one. We have
no way of knowing whether the solution is a global/local minimum, but if (3.2)
is satisﬁed, the solution is acceptable. If not, then the calibration process would
have to be rerun with a different x0.
9
in fact, all one needs is ﬁve or more market prices
3.2 Calibration methods 25
The appendix, § A.
4
.
1
, contains information and code on using lsqnonlin
for calibration. § 3.
3
contains a comparison of this method to the others presented
here.
3.
2
.
3
Excel’s Solver
The standard Solver supplied with Excel contains an optimiser that can be used
for calibration under speciﬁc circumstances. It uses a Generalized Reduced Gra
dient (GRG) method and hence is a local optimiser (for more information go to
www.solver.com). The calibration results are therefore extremely sensitive to the
initial estimates of the parameters. This optimiser should only be used when one
is sure that the initial estimates are quite close to the optimal parameter set.
The author has used MATLAB’S Excel Link to link the function HestonCall
Quad between Excel and MATLAB. The spreadsheets HestonCalibration1 and
HestonCalibration2 use this function to calculate the model prices. Solver can
then be run to calibrate the model.
The attractiveness of using Excel and Solver is that most people are comfort
able with them and they are available on almost every computer in a workplace.
On the down side, Excel is useless at handling calculations with very small num
bers. These sort of calculations do appear during the calibration process, e.g.,
calculating the bound 2κθ > σ
2
, and hence can make your result suspect!
Overall, Excel provides a quick and dirty solution to our problem, under cer
tain conditions. These conditions must be met in order to motivate its use. An
advanced version of Solver can be purchased which contains a global optimiser. §
3.
3
contains a comparison of this method to the others presented here.
3.
2
.
4
Simulated Annealing (SA)
Simulated Annealing is a probabilitybased, nonlinear, optimiser inspired by the
physical process of annealing. Its attractiveness lies in the fact that it can:
• process objective functions (eg. (3.1)) possessing quite arbitrary degrees of
nonlinearities, discontinuities, and stochasticity.
• process quite arbitrary boundary conditions and constraints imposed on
these objective functions.
• be implemented quite easily with the degree of coding quite minimal, rela
tive to other nonlinear optimisation algorithms.
3.2 Calibration methods 26
• statistically guarantee ﬁnding an optimal solution.
Annealing is a formal term for the ancient art of heating and/or cooling mate
rials to forge pottery, tools, weapons, and works of art (Frost & Heineman 1997).
In a typical annealing process melted metal is allowed to cool subject to differ
ing temperatures and pressures. The different combinations of these temperatures
and pressures determine the structural properties of the cooled product. Simulated
Annealing was borne out of the need to model such processes thereby advancing
the types of said materials produced. Annealing has played a key role in human
history: entire nations have been won and lost on the abilities of craftsmen to
produce ﬁt materials (Frost & Heineman 1997).
The algorithm was ﬁrst developed by (Metropolis, Rosenbluth, Rosenbluth,
Teller & Teller 1953) as a means of ﬁnding the equilibrium conﬁguration of a
collection of atoms at a given temperature for the actual annealing process. It
was (Kirkpatrick, Jr. & Vecchi 1983) who realised the algorithms application to
optimisation in general.
The algorithm works in the following way:
1. First the objective function is evaluated at the userspeciﬁed initial parame
ter estimates.
2. Next a random set of parameters is generated based on point 1 above.
3. If the value of the objective function is less than that of point 1, then we
‘accept’ the parameter set from point 2, else, the parameter set is accepted
with probability exp {−
δf
T
k
}, where δf is the difference between the ob
jective functions using the parameter sets in points 1 and 2, and T
k
is the
temperature
10
parameter at iteration k, speciﬁed by the algorithm.
4. This process is iterated, with the temperature parameter decreased at each
iteration, until a termination condition is met (usually a speciﬁed value of
the temperature parameter).
The above algorithm not only ‘accepts’ parameter sets that decrease the ob
jective function, but also that which increases it (subject to the probability con
straints). This ensures that the algorithm does not get stuck in a local minimum.
It helps to imagine the objective function, that we want to minimise, as a
geographical terrain. We want to ﬁnd the deepest valley of this terrain. Simulated
Annealing approaches this problem in the same way that a bouncing ball can
10
termed this because of obvious historical reasons.
3.2 Calibration methods 27
bounce over mountains, from valley to valley. Initially, when the temperature is
high, the ball has a lot of energy and can bounce from any valley to any other
valley. As time progresses, and the temperature parameter decreases, the ball
loses energy and settles down in relatively smaller ranges of valleys.
The algorithm requires only the value of the objective function for a given set
of parameters. It does not require the form of this objective function. This, in
a sense, makes the function a ‘blackbox’ to the optimiser. Constraints are en
capsulated within the ‘blackbox’. This means that the objective function should
be able to tell the optimiser whether a set of parameters lies within the required
parameter space (in our case, whether 2κθ > σ
2
), and hence limits the search to a
feasible space.
Parameters that are determined by the model (eg. the temperature parameter)
are collectively known as the annealing scheme. The annealing scheme broadly
determines the efﬁciency and accuracy of the algorithm. For example, it deter
mines the degree of ‘uphill’ movement and the rate of decrease of temperature,
which in turn affects how long the algorithm runs for. It is therefore obvious that
the annealing scheme be optimally speciﬁed. Such a speciﬁcation isn’t obvious
since parameters like temperature don’t have an explicit/implicit mathematical
relationship with the objective function. This sort of speciﬁcation has therefore
become an art form.
To reduce the subjective nature of the aforementioned speciﬁcation, adaptive
methods of Simulated Annealing have been developed. The most famous and
widely used of these is Adpative Simulated Annealing.
3.
2
.
5
Adaptive Simulated Annealing (ASA)
ASA was developed by the theoretical physicist Lester Ingber. ASA is similar to
SA except that it uses statistical measures of the algorithm’s current performance
to modify its control parameters i.e. the annealing scheme.
A proof is provided by that Ingber shows that ASA is a global optimiser. He
also provides arguments for ASA’s computational effeciency and accuracy.
The C++ code is opensource and available from www.ingber.com. It has
always been opensource and hence Ingber has had a lot of feedback from users
of ASA. Over the years it has, therefore, been modiﬁed to a point where it is now
perfect. ASA works quite well in it’s ‘standard’ form, but also allows the user to
tweak the annealing scheme for greater efﬁciency. For a detailed discussion on
ASA the reader is referred to (Ingber 1993) and (Ingber 1995).
3.3 Calibration Results 28
ASA can be implemented in MATLAB by downloading the function asamin,
written by Shinichi Sakata. asamin is a MATLAB gateway function to ASA. This
means that asamin uses the actual C++ code of Ingeber’s ASA through MAT
LAB. Detailed instructions on how to install and use ASA on one’s computer and
asamin into MATLAB can be found in (Moins 2002). The MATLAB code for cal
ibrating the model using ASA can be found in § A.
4
.
2
.
Given the thin requirements of the objective function, ASA lends itself well to
a variety of applications in different disciplines. Ingber has consulted on projects,
where he has successfully implemented ASA, in the following ﬁelds:
• Circuit design
• Mathematics/combinatorics
• Data analysis
• Imaging
• Neural networks
• Biology
• Physics
• Geophysics
• Finance
• Military
3.
3
Calibration Results
Having an artillery of calibration methods at our disposal we can proceed to cali
brate the model and compare the results. Vanilla calls on Anglo American shares,
listed on the LSE, was used as market data. An example of this data can be found
at the end of § A.
4
.
1
.
lsqnonlin, Solver and ASA were run with the same initial estimates on 2
sets of data. The results are as follows:
3.4 Comparisons, Considerations and Shortcomings 29
Method κ θ σ ρ V
0
S(Ω) Time
11 October 2005
Initial Estimate 3 0.05 0.5 0.5 0.15 386.10
lsqnonlin 4.0481 0.0487 0.6066 0.8061 0.1450 87.50 62.63 sec
ASA 21.3108 0.1034 2.0099 0.4998 0.1583 81.80 4.7 hrs
Solver 5.7369 0.0579 0.8141 0.74783 0.1568 78.10 10 mins
20 October 2005
Initial Estimate 5 0.057 0.7 0.75 0.16 148.32
lsqnonlin 15.096 0.1604 2.0859 0.7416 0.1469 88.58 6 mins
ASA 10 0.1072 1.4189 0.8236 0.1829 77.38 3.5 hours
Solver 7.3284 0.0745 1.0227 0.7670 0.1938 89.88 20 mins
where Time is the running time of the calibration process
11
. As can be seen,
ASA gives the best result in minimising S(Ω), on average, but is far more com
putationally demanding. At this point it should be noted that ASA statistically
guarantees to ﬁnd an optimal solution. On the 11 October ASA doesn’t produce
the lowest S(Ω), but is very close. Although Solver produces the best parameter
set, the results will be quite different for a different set of initial estimates. ASA
will provide the best estimate if the annealing scheme is optimised.
The reason that ASA runs so long is because it searches the entire parameter
space for a global minimum, unlike lsqnonlin and Solver which settles down
quite quickly into a local minimum. Figures 3.2 and 3.3 illustrate this point. No
tice that lsqnonlin drops down very quickly to a local minimum whereas ASA
keeps on searching for other minima and hence oscillates.
3.
4
Comparisons, Considerations and Shortcomings
Relative to ASA, lsqnonlin and Solver don’t perform that badly in minimising
S(Ω) . Given that they are far quicker than ASA, the difference in S(Ω) is accept
able. This conclusion can only be made for the given set of initial parameters. One
should be careful and not generalise such a conclusion as the solutions presented
by lsqnonlin and Solver are very dependent on the initial parameters. If these
were chosen differently, then lsqnonlin and Solver’s solutions could have been
very far off from ASA’s. There have been trial runs where the differences between
lsqnonlin, Solver and ASA were quite signiﬁcant (ASA producing the best es
timate). As mentioned above, lsqnonlin and Solver should only be used when
one is conﬁdent that the solution to (3.1) isn’t very far from the initial estimates.
11
This was run on a Pentium M 1.6 Ghz, 512MB RAM.
3.4 Comparisons, Considerations and Shortcomings 30
0 100 200 300 400 500 600 700 800
0
200
400
600
800
1000
1200
1400
Iteration
O
b
j
e
c
t
i
v
e
F
u
n
c
t
i
o
n
Figure 3.2: This illustrates how the objective func
tion is minimised when using lsqnonlin.
0 0.5 1 1.5 2 2.5
x 10
4
0
2
4
6
8
10
12
x 10
4
Iteration
O
b
j
e
c
t
i
v
e
F
u
n
c
t
i
o
n
Figure 3.3: This illustrates how the objective func
tion is minimised when using ASA.
It should also be noted that ASA is being used in its raw form. There has been
no tweaking of the annealing schedule which can result in a signiﬁcant decrease
in runtime. Also, for a random guess of the initial parameters (e.g. this would be
done when the model is calibrated for the very ﬁrst time), ASA is the best option
3.4 Comparisons, Considerations and Shortcomings 31
The obvious question is, which method do we use? There isn’t a straight
answer to this. The choice of method should be dependent on the amount of in
formation available related to parameter values and the state of the market. If a
global minimum was obtained yesterday (by using ASA), and the market condi
tions are quite normal (i.e. no crashes or dramatic movements since yesterday)
then lsqnonlin and Solver can quite safely be used. We expect that today’s para
meters are in a small neighborhood around yesterday’s. If there has been a crash
or dramatic market movement then such an expectation is unreal. In this case ASA
would have to be used. So, there should be a marriage of the different methods to
create efﬁciency and not sacriﬁce accuracy.
Another issue to consider is the stationarity of parameters. Due to time con
straints placed on such an honours project, such a task wasn’t able to perform. But,
(Mikhailov & N¨ ogel 2003) say that the parameters aren’t stationary, and hence the
comment above about calibrating the model each day. The stationarity that most
practitioners on this topic refer to is that of the parameters that solve (3.1). But, a
parameter set that we use need not be this set. An acceptable set is one that satis
ﬁes (3.2). An initial problem with ASA, lsqnonlin and Solver is that they don’t
tell us anything about the multiplicity of solutions of the calibration problem. But
we can employ a clever trick and adapt ASA and lsqnonlin to do this.
First, calculate the RHS of (3.2). Call this value SumBidOffer. Remem
ber that the objective function is the LHS of (3.2) that is evaluated at each itera
tion. By adding the following logical test in functions HestonDifference and
HestonCostFunc we can store those parameter sets that satisfy (3.2):
if (sum(PriceDifference.^2) < SumBidOffer
PossibleSolutions{j} = input;
j = j+1
end
where j is the appropriate index of the cell matrix
12
PossibleSolutions. The
model should now be calibrated every day/month until enough PossibleSo
lutions matices are available. Comparing the PossibleSolutions matrices
over the different days/months it could be possible to extract a set of parameters
that are more or less an element of each PossibleSolutions. This creates a
stationary set of parameters that satisfy (3.2).
Extracting the common set of parameters is not as trivial as it may seem. We
seek a 5dimensional set of stationary parameters and hence the usual arguments
12
a cell matrix in Matlab is a matrix of matrices
3.5 Other Methods 32
that are used in such stationarity tests, in the 1dimensional case, are not that
helpful.
3.
5
Other Methods
For completeness a few of the other calibration methods will be presented.
(Shu & Zhang 2004) propose a 2step Indirect Inference method of cal
ibrating the model. First, the recently developed simulationbased “indirect in
ference method” (timeseries relative) is used to estimate the parameters for the
dynamics of the asset. A nonlinear least squares method is then used to calibrate
the remaining parameters, similar to what is presented above.
As mentioned before, the parameters have no relation to their timeseries
counterparts, so it seems counterintuitive to estimate some of the parameters us
ing some timeseries method. But it is exactly for this reason that we can estimate
a few of the parameters by some other method and then use a nonlinear least
squares method to ﬁt the model. This effectively reduces the dimension over
which (3.1) has to be minimised.
This seems like an extension to the method presented here and could be an
interesting extension to this project.
(Johnson & Lee 2004) proposes calibrating the model using an Ensemble
method. This method does not involve ﬁtting the parameters to market data as
most methods do. Rather, it uses an ensemble of parameter sets. Each set of
the ensemble is assigned a weight which is attained by just one matrix inversion.
The calibrated ensemble will then reproduce exact market prices. (Johnson & Lee
2004) state that the attractiveness in the model lies in it’s simplicity and robustness
in being able to calibrate to any type of instrument, e.g., barrier options, forward
starting options, etc. Also, hedge ratios are easily calculated.
Lastly, while reading through the Wilmott forums, it seems that the calculation
of (3.1) can be carried out using genetic algorithms. MATLAB contains some
genetic algorithms in the Direct Search Toolbox which is an extension of the Op
timisation Toolbox. However, (Ingber 1993) notes that these algorithms are much
slower that ASA, though.
Conclusion
As Mathematicians (or students thereof) we can get caught up in the magic of
Mathematics. It is important to remember that the Heston model is, essentially, a
model. It is a mathematical tool that models something that is inﬁnitely complex.
It therefore cannot wholly capture the complicated and diverse dynamics that exist
in reality, of volatility.
Calibration of the model is an important task. Energy should not be wasted,
though, on overﬁtting the model. Such efforts can lead to spurious results. After
all, one is trying to perfectly ﬁt a model that doesn’t perfectly explain the real
world.
This doesn’t make stochastic models, in general, useless. If the underlying
assumptions are carefully understood and its application carefully applied then
stochastic models are powerful tools. They are the best that we have in an unpre
dictable world without which we would be far worse off!
33
Appendix
A.
1
Simulation of Probability Densities
Monte Carlo simulation was performed by discretising the stochastic processes
using the EulerMaruyama method. This resulted in,
S
t
= S
t−1
+ rS
t−1
dt +
_
V
t−1
S
t−1
√
dtZ
1
t
V
t
= V
t−1
+ κ(θ −V
t−1
)dt + σ
_
V
t−1
√
dtZ
2
t
where {Z
1
t
}
t≥0
and {Z
2
t
}
t≥0
are standard normal random variables with correla
tion ρ. The above can be made computationally easier by expressing {Z
1
t
}
t≥0
and
{Z
2
t
}
t≥0
, as a function of independent standard normal random variables, using
the Cholesky decomposition,
Z
1
t
= φ
1
t
Z
2
t
= ρφ
1
t
+
_
1 −ρ
2
φ
2
t
where {φ
1
t
}
t≥0
and {φ
2
t
}
t≥0
are independent standard normal random variables.
Matlab code for the simulation of ﬁgure 1.1 is as follows:
S0 = 10; V0 = .01; r = 0; k = 2;
theta =.01; sigma= .1; delT = .02; rho =0.9;
numberOfSimulations = 1000000;
i = 1:numberOfSimulations;
NormRand1 = randn(1,numberOfSimulations);
NormRand2 = randn(1,numberOfSimulations);
S = zeros(1,numberOfSimulations);
V = zeros(1,numberOfSimulations);
V(i) = V0 + k*(theta  V0)*delT + sigma*sqrt(V0)* ...
(rho*NormRand1 + sqrt(1 rho^2)*NormRand2)*sqrt(delT);
V = abs(V); %prevents negative volatilities
S(i) = S0 + r*S0*delT + S0*V.^(0.5).*NormRand1*sqrt(delT);
The code is broadly similar for the simulation of ﬁgure 1.5.
34
A.2 Generating Volatility Surfaces and Skews 35
A.
2
Generating Volatility Surfaces and Skews
Prices of the European call options are calculated, using the Heston closedform
solution (§ 2.
1
), at different maturities and strikes. These prices are then equated
to the BlackScholesMerton (BSM) solution and the volatility that satisﬁes this
equation is evaluated. The function blsimpv returns the BSM implied volatility
for a given set of parameters. The following script ﬁle, VolSmile.m generates the
volatility surfaces of § 1.
2
(ﬁgures 1.3, 1.2, 1.4).
strikes = linspace(.8,1.2,11);
mats = linspace(.3,3,11); %maturities
for i = 1:11
for j = 1:11
price = HestonCallQuad(2,.04,.1,0.5,.04,.01,mats(i),1...
,strikes(j));
prices(i,j) = price;
Volatility(i,j) = blsimpv(1, strikes(j), 0.01 , ...
mats(i), price);
end
end
[strike mat] = meshgrid(strikes,mats);
surf(mat,strike,Volatility),xlabel(’Maturity(years)’), ...
ylabel(’Strike’),Title(’\rho = 0.5’),zlabel(’Implied ...
Volatility’);
figure;
for i = 1:11
for j = 1:11
price = HestonCallQuad(2,.04,.1,0,.04,.01,mats(i),1...
,strikes(j));
prices(i,j) = price;
Volatility(i,j) = blsimpv(1, strikes(j), 0.01 , ...
mats(i), price);
end
end
surf(mat,strike,Volatility),xlabel(’Maturity(years)’),
ylabel(’Strike’),Title(’\rho = 0’),zlabel(’Implied ...
Volatility’);
figure;
for i = 1:11
for j = 1:11
price = HestonCallQuad(2,.04,.1,0.5,.04,.01,mats(i),...
1,strikes(j));
A.2 Generating Volatility Surfaces and Skews 36
prices(i,j) = price;
Volatility(i,j) = blsimpv(1, strikes(j), 0.01 ,...
mats(i), price);
end
end
surf(mat,strike,Volatility),xlabel(’Maturity(years)’),
ylabel(’Strike’),Title(’\rho = 0.5’),zlabel(’Implied...
Volatility’);
The following script, HestonVolSmileVolVol.m, generates ﬁgures 1.6, 1.7
and 1.8 of § 1.
2
.
strikes = linspace(.8,1.2,11);
volvols = [.1:.1:.4];
styleV = {[’’][’’] [’.’] [’:’]};
colourV = {[’k’] [’b’] [’r’] [’m’]};
for i = 1:4
for j = 1:11
price = HestonCallQuad(2,.04,volvols(i),0.5,.04, ...
.01,1,1,strikes(j));
prices(i,j) = price;
Volatility(i,j) = blsimpv(1, strikes(j), 0.01 , ...
1, price);
end
plot(strikes,Volatility(i,:),[char(colourV(i)), ...
char(styleV(i))]),ylabel(’Implied Volatility’), ...
xlabel(’Strike’),Title(’\rho = 0.5’);
hold on;
end
legend(’\sigma = 0.1’,’\sigma = 0.2’,’\sigma = 0.3’, ...
’\sigma = 0.4’) figure;
for i = 1:4
for j = 1:11
price = HestonCallQuad(2,.04,volvols(i),0,.04, ...
.01,1,1,strikes(j));
prices(i,j) = price;
Volatility(i,j) = blsimpv(1, strikes(j), 0.01 , ...
1, price);
end
plot(strikes,Volatility(i,:),[char(colourV(i)), ...
char(styleV(i))]),ylabel(’Implied Volatility’), ...
xlabel(’Strike’),Title(’\rho = 0’);
A.3 Evaluation of the ClosedForm Solution 37
hold on;
end
legend(’\sigma = 0.1’,’\sigma = 0.2’,’\sigma = 0.3’, ...
’\sigma = 0.4’) figure;
for i = 1:4
for j = 1:11
price = HestonCallQuad(2,.04,volvols(i),0.5,.04,...
.01,1,1,strikes(j));
prices(i,j) = price;
Volatility(i,j) = blsimpv(1, strikes(j), 0.01 , ...
1, price);
end
plot(strikes,Volatility(i,:),[char(colourV(i)), ...
char(styleV(i))]),ylabel(’Implied Volatility’), ...
xlabel(’Strike’),Title(’\rho = 0.5’);
hold on;
end
legend(’\sigma = 0.1’,’\sigma = 0.2’,’\sigma = 0.3’, ...
’\sigma = 0.4’)
A.
3
Evaluation of the ClosedForm Solution
Presented here are the two methods discussed in § 2.
2
and § 2.
3
for computation
ally evaluating the closedform solution for a European call.
A.
3
.
1
European Call using FFT
The following function calculates atthemoney and inthemoney European call
prices using FFT.
function CallValue = HestonCallFft(kappa,theta,sigma,rho,r ...
,v0,s0,strike,T)
%kappa = rate of reversion
%theta = long run variance
%sigma = Volatility of volatility
%v0 = initial Variance
%rho = correlation
%T = Time till maturity
A.3 Evaluation of the ClosedForm Solution 38
%r = interest rate
%s0 = initial asset price
x0 = log(s0);
alpha = 1.25;
N= 4096;
c = 600;
eta = c/N;
b =pi/eta;
u = [0:N1]*eta;
lambda = 2*b/N;
position = (log(strike) + b)/lambda + 1; %position of call
%value in FFT
%matrix
v = u  (alpha+1)*i;
zeta = .5*(v.^2 +i*v);
gamma = kappa  rho*sigma*v*i;
PHI = sqrt(gamma.^2  2*sigma^2*zeta);
A = i*v*(x0 + r*T);
B = v0*((2*zeta.*(1exp(PHI.*T)))./(2*PHI  ...
(PHIgamma).*(1exp(PHI*T))));
C = kappa*theta/sigma^2*(2*log((2*PHI  ...
(PHIgamma).*(1exp(PHI*T)))./ ...
(2*PHI)) + (PHIgamma)*T);
charFunc = exp(A + B + C);
ModifiedCharFunc = charFunc*exp(r*T)./(alpha^2 ...
+ alpha  u.^2 + i*(2*alpha +1)*u);
SimpsonW = 1/3*(3 + (i).^[1:N]  [1, zeros(1,N1)]);
FftFunc = exp(i*b*u).*ModifiedCharFunc*eta.*SimpsonW;
payoff = real(fft(FftFunc));
CallValueM = exp(log(strike)*alpha)*payoff/pi;
format short;
CallValue = CallValueM(round(position));
The following function calculates outofthemoney European call prices us
ing FFT.
function CallValue = HestonCallFftTimeValue(kappa,theta,...
sigma,rho,r,v0,s0,strike,T)
%kappa = rate of reversion
%theta = long run variance
%sigma = Volatility of volatility
%v0 = initial Variance
A.3 Evaluation of the ClosedForm Solution 39
%rho = correlation
%T = Time till maturity
%r = interest rate
%s0 = initial asset price
x0 = log(s0);
alpha = 1.25;
N= 4096;
c = 600;
eta = c/N;
b =pi/eta;
u = [0:N1]*eta;
lambda = 2*b/N;
position = (log(strike) + b)/lambda + 1; %position of call
%value in FFT matrix
w1 = ui*alpha;
w2 = u+i*alpha;
v1 = ui*alpha i;
v2 = u+i*alpha i;
zeta1 = .5*(v1.^2 +i*v1);
gamma1 = kappa  rho*sigma*v1*i;
PHI1 = sqrt(gamma1.^2  2*sigma^2*zeta1);
A1 = i*v1*(x0 + r*T);
B1 = v0*((2*zeta1.*(1exp(PHI1.*T)))./(2*PHI1  ...
(PHI1gamma1).*(1exp(PHI1*T))));
C1 = kappa*theta/sigma^2*(2*log((2*PHI1  ...
(PHI1gamma1).*(1exp(PHI1*T)))./(2*PHI1)) ...
+ (PHI1gamma1)*T);
charFunc1 = exp(A1 + B1 + C1);
ModifiedCharFunc1 = exp(r*T)*(1./(1+i*w1)  ...
exp(r*T)./(i*w1)  charFunc1./(w1.^2  i*w1));
zeta2 = .5*(v2.^2 +i*v2);
gamma2 = kappa  rho*sigma*v2*i;
PHI2 = sqrt(gamma2.^2  2*sigma^2*zeta2);
A2 = i*v2*(x0 + r*T);
B2 = v0*((2*zeta2.*(1exp(PHI2.*T)))./(2*PHI2  ...
(PHI2gamma2).*(1exp(PHI2*T))));
C2 = kappa*theta/sigma^2*(2*log((2*PHI2  ...
(PHI2gamma2).*(1exp(PHI2*T)))./(2*PHI2)) ...
+ (PHI2gamma2)*T);
charFunc2 = exp(A2 + B2 + C2);
ModifiedCharFunc2 = exp(r*T)*(1./(1+i*w2)  ...
exp(r*T)./(i*w2)  charFunc2./(w2.^2  i*w2));
ModifiedCharFuncCombo = (ModifiedCharFunc1  ...
ModifiedCharFunc2)/2 ;
A.3 Evaluation of the ClosedForm Solution 40
SimpsonW = 1/3*(3 + (1).^[1:N]  [1, zeros(1,N1)]);
FftFunc = exp(i*b*u).*ModifiedCharFuncCombo*eta.*...
SimpsonW;
payoff = real(fft(FftFunc));
CallValueM = payoff/pi/sinh(alpha*log(strike));
format short;
CallValue = CallValueM(round(position));
A.
3
.
2
European Call using Numerical Integration
The function HestonCallQuad(kappa,theta,sigma,rho,v0,r,T,s0,K) cal
culates the value of a European call. It calls HestonP(kappa,theta,sigma,
rho,v0,r,T,s0,K,type), where type = 1,2, which evaluates (2.19), either us
ing an adaptive Gauss Lobatto rule or adaptive Simpson’s Rule. This, in turn, calls
HestonPIntegrand(phi,kappa,theta,sigma,rho,v0,r,T,s0,K,type), wh
ich evaluates the integrand of (2.19). This, in turn calls Hestf(phi,kappa,theta,
sigma,rho,v0,r,T,s0,type), which evaluates the ‘f’ function in the integrand
of (2.19). All variable names are the same as used in (Heston 1993).
function call = HestonCallQuad(kappa,theta,sigma,rho,v0,r,T,...
s0,K)
warning off;
call = s0*HestonP(kappa,theta,sigma,rho,v0,r,T,s0,K,1)  ...
K*exp(r*T)*HestonP(kappa,theta,sigma,rho,v0,r,T,s0,K,2);
function ret = HestonP(kappa,theta,sigma,rho,v0,r,T,s0,K,type)
ret = 0.5 + 1/pi*quadl(@HestonPIntegrand,0,100,[],[],kappa, ...
theta,sigma,rho,v0,r,T,s0,K,type);
function ret = HestonPIntegrand(phi,kappa,theta,sigma,rho, ...
v0,r,T,s0,K,type)
ret = real(exp(i*phi*log(K)).*Hestf(phi,kappa,theta,sigma, ...
rho,v0,r,T,s0,type)./(i*phi));
function f = Hestf(phi,kappa,theta,sigma,rho,v0,r,T,s0,type);
if type == 1
u = 0.5;
b = kappa  rho*sigma;
else
u = 0.5;
b = kappa;
A.4 Calibration 41
end
a = kappa*theta; x = log(s0);
d = sqrt((rho*sigma*phi.*ib).^2sigma^2*(2*u*phi.*iphi.^2));
g = (brho*sigma*phi*i + d)./(brho*sigma*phi*i  d);
C = r*phi.*i*T + a/sigma^2.*((b rho*sigma*phi*i + d)*T  ...
2*log((1g.*exp(d*T))./(1g)));
D = (brho*sigma*phi*i + d)./sigma^2.*((1exp(d*T))./ ...
(1g.*exp(d*T)));
f = exp(C + D*v0 + i*phi*x);
A.
4
Calibration
The following contains the MATLAB code for calibrating the Heston model.
A.
4
.
1
Using Matlab’s lsqnonlin
The script ﬁle HestonLsCalibration.m initiates the calibration process. It cre
ates a handle on the function HestonDifferences that calculates the differences
between the model and market prices within lsqnonlin. The ‘load OptionD
ata.txt’ line imports the strikes, maturities, market prices, bid and offers, etc.,
of the options and underlying from the ﬁle OptionData.txt
13
. The ﬁrst parame
ter of input that MATLAB sends into HestonDifference is 2κθ −σ
2
. It is done
here in this way because it is easier to encapsulate the constraint 2κθ − σ
2
> 0.
Reasonable bounds on the parameters were chosen relative to this.
clear;
global OptionData;
global NoOfOptions;
global NoOfIterations;
global PriceDifference;
NoOfIterations = 0;
load OptionData.m ;
%OptionData = [r,T,S0,K,Option Value,bid,offer]
Size = size(OptionData);
NoOfOptions = Size(1);
13
an example of the composition of OptionData.m is presented at the end of this sub
section
A.4 Calibration 42
%input sequence in initial vectors [2*kappa*theta  sigma^2,...
% theta,sigma,rho,v0]
x0 = [6.5482 0.0731 2.3012 0.4176 0.1838];
lb = [0 0 0 1 0];
ub = [20 1 5 0 1];
options = optimset(’MaxFunEvals’,20000);
%sets the max no. of iteration to 20000 so that termination
%doesn’t take place early.
tic;
Calibration = lsqnonlin(@HestonDifferences,x0,lb,ub);
toc;
Solution = [(Calibration(1)+Calibration(3)^2)/ ...
(2*Calibration(2)), Calibration(2:5)];
function ret = HestonDifferences(input)
global NoOfOptions;
global OptionData;
global NoOfIterations;
global PriceDifference;
NoOfIterations = NoOfIterations + 1;
%counts the no of iterations run to calibrate model
for i = 1:NoOfOptions
PriceDifference(i) = (OptionData(i,5)HestonCallQuad( ...
(input(1)+input(3)^2)/(2*input(2)),input(2), ...
input(3),input(4),input(5), ...
OptionData(i,1),OptionData(i,2),OptionData(i,3), ...
OptionData(i,4)))/sqrt((abs(OptionData(i,6) ...
OptionData(i,7))));
%input matrix = [kappa theta sigma rho v0]
end
ret = PriceDifference’;
As mentioned before, the ﬁle OptionData.m is a text ﬁle containing the mar
ket data for calibration. Vanilla calls written on Anglo American shares that trade
on the LSE have been used. For illustrative purposes, OptionData contains the
following information:
A.4 Calibration 43
rq Term Spot Strike Mid Price Bid Offer
2.2685% 0.126027 1544.50 1000.00 559.00 553.00 565.00
2.2685% 0.126027 1544.50 1050.00 509.50 503.50 515.50
2.2685% 0.126027 1544.50 1100.00 460.00 454.00 466.00
2.2685% 0.126027 1544.50 1150.00 411.00 405.00 417.00
2.2685% 0.126027 1544.50 1200.00 362.50 356.50 368.50
2.2342% 0.375342 1544.50 1200.00 386.00 378.50 393.50
2.2685% 0.126027 1544.50 1250.00 315.00 309.00 321.00
2.2342% 0.375342 1544.50 1250.00 345.50 338.00 353.00
2.2685% 0.126027 1544.50 1300.00 269.50 263.50 275.50
2.2342% 0.375342 1544.50 1300.00 300.50 293.00 308.00
2.2685% 0.126027 1544.50 1350.00 223.00 217.00 229.00
2.2342% 0.375342 1544.50 1350.00 259.00 251.50 266.50
2.1947% 0.627397 1544.50 1350.00 281.00 272.00 290.00
2.2685% 0.126027 1544.50 1400.00 179.00 176.00 182.00
2.2342% 0.375342 1544.50 1400.00 221.00 213.50 228.50
2.1947% 0.627397 1544.50 1400.00 244.00 235.00 253.00
2.2685% 0.126027 1544.50 1450.00 140.00 136.00 144.00
2.2342% 0.375342 1544.50 1450.00 180.00 174.00 186.00
2.1947% 0.627397 1544.50 1450.00 207.50 198.50 216.50
2.2685% 0.126027 1544.50 1500.00 105.00 102.00 108.00
2.2342% 0.375342 1544.50 1500.00 149.50 145.00 154.00
2.1947% 0.627397 1544.50 1500.00 173.00 166.00 180.00
2.2685% 0.126027 1544.50 1600.00 56.50 51.50 61.50
2.2342% 0.375342 1544.50 1600.00 96.00 92.00 100.00
2.1947% 0.627397 1544.50 1600.00 121.00 114.00 128.00
2.2685% 0.126027 1544.50 1700.00 23.50 20.50 26.50
2.2342% 0.375342 1544.50 1700.00 57.25 51.00 63.50
2.1947% 0.627397 1544.50 1700.00 81.50 77.00 86.00
2.2685% 0.126027 1544.50 1800.00 10.00 7.00 13.00
2.2342% 0.375342 1544.50 1800.00 32.50 28.00 37.00
2.1947% 0.627397 1544.50 1800.00 50.50 44.50 56.50
2.2685% 0.126027 1544.50 1900.00 4.50 2.00 7.00
2.2342% 0.375342 1544.50 1900.00 18.25 14.50 22.00
2.1947% 0.627397 1544.50 1900.00 35.50 29.50 41.50
A.
4
.
2
Adaptive Simulated Annealing (ASA) in MATLAB
The scheme that controls the ‘acceptance’ of new solutions is so simple that the
cost of implementing ASA is purely dependent on the computational efﬁciency of
A.4 Calibration 44
evaluating the objective function. In our case, calculation of the objective function
for a given set of parameters entails the evaluation of a large number of options.
This makes ASA very computationally demanding and time consuming. The fol
lowing script, HestonASACalibration, calibrates the model using ASA. It uses
the function HestonCostFunc
clear;
global OptionData;
global NoOfOptions;
global NoOfIterations;
global PriceDifference;
global ObjectiveFunc;
NoOfIterations = 0;
load OptionData.m ;
%OptionData = [r,T,S0,K,Option Value,bid,offer]
Size = size(OptionData);
NoOfOptions = Size(1);
%input sequence in initial vectors [kappa,theta,sigma,rho,v0]
x0 = [0.030854841 0.999999922 0.248415019 1 0.08977599];
lb = [0 0 0 1 0];
ub = [10 1 5 0 1];
asamin(’set’,’test_in_cost_func’,0)
tic;
[fstar, xstar, grad, hessian, state] = asamin(’minimize’,...
’HestonCostFunc’,x0’,lb’,ub’,1*ones(5,1));
toc;
function [cost , flag] = HestonCostFunc(input)
global NoOfOptions;
global OptionData;
global NoOfIterations;
global PriceDifference;
global ObjectiveFunc;
%input matrix = [kappa theta sigma rho v0]
NoOfIterations = NoOfIterations + 1;
if (2*input(1)*input(2)<=input(3)^2) %test for constraint
flag = 0; %flag = 0 if contraint is violated, else = 1
A.4 Calibration 45
cost = 0
else
for i = 1:NoOfOptions
PriceDifference(i) = (OptionData(i,5)HestonCallQuad(...
input(1),input(2),input(3),input(4),input(5), ...
OptionData(i,1),OptionData(i,2),OptionData(i,3),...
OptionData(i,4)))/sqrt((abs(OptionData(i,6) ...
OptionData(i,7))));
end
cost = sum(PriceDifference.^2)
ObjectiveFunc(NoOfIterations) = cost; %stores the path of
flag = 1; %the optimiser
end
References
Bakshi, G., Cao, C. & Chen, Z. (1997), ‘Empirical performance of alternative
option pricing models’, Journal of Finance 52, 20032049.
Black, F. & Scholes, M. (1973), ‘Valuation of options and corporate liabilities’,
Journal of Political Economy 81, 637–654.
Carr, P. & Madan, D. B. (1999), ‘Option evaluation the using fast fourier trans
form’, Journal of Computational Finance 2(4), 61–73.
Cheney, W. & Kincaid, D. (1999), Numerical Mathematics and Computing, 4 edn,
Brooks/Cole Publishing Company.
Chiarella, C., Craddock, M. & ElHassan, N. (2000), The calibration of stock
option pricing models using inverse problem methodology, Research Paper
Series 39, Quantitative Finance Research Centre, University of Technology,
Sydney. http://ideas.repec.org/p/uts/rpaper/39.html.
Coleman, T. F. & Li, Y. (1994), ‘On the convergence of reﬂective newton meth
ods for largescale nonlinear minimization subject to bounds’, Mathematical
Programming.
Coleman, T. F. & Li, Y. (1996), ‘An interior, trust region approach for nonlinear
minimization subject to bounds’, SIAMJournal on Optimization 6, 418–445.
Cont, R. (2001), ‘Empirical properties of asset returns: stylized facts and statisti
cal issues’, Quantitative Finance 1, 223–236.
Cont, R. (2005), ‘Recovering volatilty from option prices by evolutionary optimi
sation’, Research Paper Series.
Cox, J. C., Ingersoll, J. E. & Ross, S. A. (1985), ‘A theory of the term structure of
interest rates’, Econometrica 53, 385–407.
Frost, R. & Heineman, P. (1997), Simulated annealing: A heuristic for parallel
stochastic optimization., in ‘PDPTA’, pp. 1595–.
Gander, W. & Gautschi, W. (1998), Adaptve quadrature  revisited, Technical
report, Departement Informatik, ETH Z¨ urich.
46
References 47
Gatheral, J. (2004), ‘Lecture 1: Stochastic volatility and local volatility’, Case
Studies in Financial Modelling Notes, Courant Institute of Mathematical
Sciences.
Heston, S. L. (1993), ‘A closedform solution for options with stochastic volatility
with applications to bonds and currency options’, The Review of Financial
Studies 6(2), 327–343.
Hong, G. (2004), ‘Forward smile and derivative pricing’.
Ingber, A. L. (1993), ‘Simulated annealing: Practice versus theory’, Journal of
Mathematical Computational Modelling 18(11), 29–57.
Ingber, A. L. (1995), ‘Adaptive simulated annealing (asa): Lessons learned’, Con
trol and Cybernetics.
Johnson, S. & Lee, H. (2004), ‘Capturing the smile’, Risk Magazine March, 89–
93.
Kirkpatrick, S., Jr., C. D. G. & Vecchi, M. P. (1983), ‘Optimization by simulated
annealing’, Science 220(4598), 671–680.
Majmin, L. (2005), Local and stochastic volatility models: An investigation into
the pricing of exotic equity options, Master’s thesis, University of the Wit
watersrand, South Africa.
Metropolis, N., Rosenbluth, A., Rosenbluth, M., Teller, A. & Teller, E. (1953),
‘Equation of state calculations by fast computing machines’, Journal of
Chemisry and Physics 21(6), 1087–1092.
Mikhailov, S. & N¨ ogel, U. (2003), ‘Hestons stochastic volatility model implemen
tation, calibration and some extensions’, Wilmott.
Moins, S. (2002), Implementation of a simulated annealing algorithm for MAT
LAB, Technical report, Link¨ oping Institute of Technology.
Shu, J. & Zhang, J. E. (2004), ‘Pricing s&p 500 index options under stochastic
volatility with the indirect inference method’, Journal of Derivatives Ac
counting 1(2), 1–16.
Xu, J. (2003), Pricing and hedging under stochastic volatility, Master’s thesis,
Peking University, China.
An Honours Project
submitted to the
Faculty of Science, University of the Witwatersrand, Johannesburg, South Africa,
in partial fulﬁllment of the requirements of the
Bachelor of Science Honours, Programme in Advanced Mathematics of Finance
by
Nimalin Moodley
nimalin@yahoo.com
Acknowledgements My gratitude and appreciation goes out to the following people: My Internal Supervisor and ‘Chief’ of Maths of Finance, Prof. David Taylor, for running the slickest department ever, his advice and motivation. Dr Graeme West (aka Supa G), for his help, advice, selﬂessness, and inspiration. Grant Lotter, the A A Don of LTEX, for inspiring me to further my LTEX skills. Ulrich N¨ gel of o FraunhoferInstitut f¨ r Technound Wirtschaftsmathematik for his advice and u encouragement. The Class of 2005 for creating an environment that encouraged learning and challenged my thinking thus enabling me to achieve greater things. My family and Adisha, for all their love and support. Oscar (PhD Chaos Theory), for sitting by me while I researched. Marchand van Rooyen, for suggesting the topic.
i
“If I have seen further it is by standing on the shoulders of Giants.” Sir Isaac Newton This project is dedicated to my Grandfather. Thank you for being that intellectual Giant.
ii
A BSTRACT
This document covers various aspects the Heston model. The structure and topics covered is as follows: Chapter 1 introduces the model and provides theoretical and graphical motivation for its robustness and hence popularity. It also discusses pricing using the Partial Differential Equation and Equivalent Martingale Measure techniques Chapter 2 discusses how the different components of the model can be evaluated computationally and how this can be achieved with different methods. These methods are then compared to each other. Chapter 3 addresses the calibration problem. Different methods are presented as well as practical implementation, results thereof, and comparisons. All the M ATLAB code required to implement the model is provided in the appendix
iii
Contents
Introduction I. A Brief Overview 1.1 The Heston Model . . . . . . 1.2 Motivation and Parameters . . 1.3 Pricing Options . . . . . . . . 1.3 .1 PDE approach . . . . 1.3 .2 Risk Neutral approach 1 2 2 2 7 8 8 10 10 11 14 14 16 17 18 18 21 21 22 23 24 25 25 27 28 29 32 33 iv
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
II. Computational Evaluation 2.1 The ClosedForm Solution . . . . . . . . . . . 2.2 Fast Fourier Transform (FFT) . . . . . . . . . . 2.3 Numerical Integration  Quadrature Rules . . . 2.3 .1 Adaptive Simpson’s Rule . . . . . . . . 2.3 .2 Adaptive Gaussian Quadrature Rules . 2.3 .3 Computation of the ‘Heston Integral’ . 2.3 .4 Comparison of Quadrature Rules . . . . 2.4 Comparison of FFT and Numerical Integration III Calibration 3.1 The Calibration Problem . . . . . . . . . . . . 3.2 Calibration methods . . . . . . . . . . . . . . . 3.2 .1 Regularisation . . . . . . . . . . . . . 3.2 .2 Matlab’s lsqnonlin . . . . . . . . . 3.2 .3 Excel’s Solver . . . . . . . . . . . . . 3.2 .4 Simulated Annealing (SA) . . . . . . . 3.2 .5 Adaptive Simulated Annealing (ASA) . 3.3 Calibration Results . . . . . . . . . . . . . . . 3.4 Comparisons, Considerations and Shortcomings 3.5 Other Methods . . . . . . . . . . . . . . . . . Conclusion
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . .1 Using Matlab’s lsqnonlin . A. . . . . . . . . . . . . . .2 Generating Volatility Surfaces and Skews . . . . . . . . . . . . . . . . A.Contents Appendix A. . . . . . A. . . A. . . . .2 Adaptive Simulated Annealing (ASA) in M ATLAB References . . . . . . . . . . . . . . . . . . . A.4 . 34 34 35 37 37 40 41 41 43 46 v .4 . . . . . . . . . .2 European Call using Numerical Integration . . . .4 Calibration . . . . . . . . . . . . . . . . . . A. . .3 . . . . . . A. . .1 Simulation of Probability Densities .3 Evaluation of the ClosedForm Solution . . .1 European Call using FFT . . .3 . . . . . . . .
including M ATLAB code. I. Its attractiveness lies in the powerful duality of its tractability and robustness relative to other SV models. therefore. Attempting to solve such a problem was an impossible task due to the lack of exposure to such ‘advanced’ models. All the functions and spreadsheets herein mentioned are included on the attached CD so that the reader is not conﬁned to this document and has some sort of practical reference when approaching this subject. therefore. This code has been conﬁned to the appendix to keep the main body clutter free and ‘quicktoread’. All the relevant tools are provided to facilitate this calibration process.Introduction The Heston Model is one of the most widely used stochastic volatility (SV) models today. A practical approach has been adopted since the focus of calibration is quite practical itself. evolved into something that could ﬁll this gap. Enroute I realised that fundamental information that one would require to gain an intuitive understanding of such a model was very disjoint and hence incomplete. 1 . This project initially begun as one that addressed the calibration problem of this model. decided to take a slight digression into the world of Heston and stochastic volatility. This project.
In contrast. 1. {Wt2 }t≥0 are correlated Brownian motion processes (with correlation parameter ρ). are time and state homogenous. κ. If further technical details are desired. which can be interpreted as the correlation between the logreturns and volatility 2 . respectively. rather than an overly technical one. the reader is directed to the relevant references.1) (1. Empirical studies have shown that an asset’s logreturn distribution is nonGaussian. All the parameters. ρ.CHAPTER I A Brief Overview The purpose of this section is to give the reader a succinct overview of the Heston Model. It is characterised by heavy tails and high peaks (leptokurtic).1 The Heston Model (Heston 1993) proposed the following the model: dSt = µSt dt + Vt St dWt1 Vt dWt2 (1. σ. with longrun mean θ.2) (1. empirical. This departure from normality plagues the BlackScholesMerton model with many problems.2 Motivation and Parameters There are many economic. and {Wt1 }t≥0 . σ is referred to as the volatility of volatility. Ingersoll & Ross 1985). There is also empirical evidence and economic arguments that suggest that equity returns and implied volatility are negatively correlated (also termed ‘the leverage effect’). {Vt }t≥0 is a square root mean reverting process. and mathematical reasons for choosing a model with such a form (see (Cont 2001) for a detailed statistical/ empirical analysis). so that the sections that follow are easily absorbed. A ‘broadbrush’. Heston’s model can imply a number of different distributions.3) dVt = κ(θ − Vt )dt + σ 1 dWt dWt2 = ρdt where {St }t≥0 and {Vt }t≥0 are the price and volatility processes. θ. pragmatic approach is adopted to give the reader an intuitive understanding of the model. 1. ρ. ﬁrst used by (Cox. viz. and rate of reversion κ. µ.
03 0. viz. thus spreading the left tail and squeezing the right tail of the distribution creating a fat lefttailed distribution (emphasising the fact that equity returns and its related volatility are negatively correlated). Matlab code for this simulation can be found in the appendix.5 10 10. This will spread the right tail and squeeze the left tail of the distribution creating a fat righttailed distribution. Figure 1. Matlab code for generation of the volatility surfaces can be found in § A. Conversely. Increasing σ will then increase the kurtosis only. ρ also affects this.1: The eﬀect of ρ on the skewness of the density function The effect of changing the skewness of the distribution also impacts on the shape of the implied volatility surface. affects the skewness of the distribution.9 0.04 0. Figure 1. if ρ < 0. then volatility will increase when the asset price/return decreases.3 and 1. ρ.4 show the effect of varying ρ. therefore..2 Motivation and Parameters 3 of the asset. When σ is 0 the volatility is deterministic and hence the logreturns will be normally distributed.5 shows the effect of varying σ. creating heavy tails on both sides. Intuitively.1 shows this effect for different values ρ. .5 11 Figure 1.06 ρ = 0.1 .1.2. Hence. Figures 1. § A. As can be seen. if ρ > 0.01 0 9 9.05 0.1 . 1. 0. the model can imply a variety of volatility surfaces and hence addresses another shortcoming of the BlackScholesMerton model.9 ρ=0 ρ = −0.02 0. § A.2 . Matlab code for this simulation can be found in the appendix. constant volatility across differing strike levels. then volatility will increase as the asset price/return increases. affects the heaviness of the tails. σ affects the kurtosis (peak) of the distribution.
19 0. strikes : 0. σ = 0. κ = 2.8 show how σ affects the ‘signiﬁcance’ of the smile/skew. ρ = 0.04. This means that the market has a greater chance of extreme movements. Higher σ makes the skew/smile more prominent.2: Implied volatility surface.199 0. r = 1%. Figures 1.1 Strike 1.1. S0 =1.5 − 3 years Again. So. ρ = 1 . This makes sense relative to the leverage effect. maturities : 0. S0 =1.2. θ = 0.195 0.2 0 1 Maturity(years) 2 3 Figure 1.8 0. maturities : 0. for a given strike.2.1.205 Implied Volatility 0.8 − 1. r = 1%.8 0.2 0.202 Implied Volatility 0.5 4 0.1 Strike 1.201 0.9 1 1.2 Motivation and Parameters ρ = 0. the effect of changing the kurtosis of the distribution impacts on the implied volatility.21 0.04.2 0.7 and 1. less.185 0. V0 = 0.9 1 1.2 0 1 Maturity(years) 2 3 Figure 1.3: Implied volatility surface. 2 θ = 0.04.1.6. σ = 0.04. . writers of puts must charge more and those of calls. κ = 2.8 − 1. Higher σ means that the volatility is more volatile. strikes : 0. V0 = 0.5 − 3 years ρ=0 0. 1.
1.05 0.08 0.. This is something that has been observed in the market. can be interpreted as representing the degree of ‘volatility clustering’.205 0.2 0.19 0. r = 1%.098 0.106 0.01 0 0. large price variations are more likely to be followed by large price variations .108 0. V0 = 0.03 0.1 σ = 0.06 0.195 0. θ = 0. κ.5 5 0.5: The eﬀect of σ on the kurtosis of the density function Matlab code for generation of the volatility smiles/skews can be found in § A.215 0.094 0.2.1.11 Figure 1.9 1 1.5 − 3 years 0. κ = 2 2.25 0. σ = 0.4: Implied volatility surface. S0 =1.21 Implied Volatility 0.2 0 1 Maturity(years) 2 3 Figure 1.096 0.8 − 1.07 0. ρ = − 1 .092 σ=0 σ = 0. maturities : 0.104 0. the mean reversion parameter.1 0.2 .04 0. strikes : 0.102 0.8 0.2 Motivation and Parameters ρ = −0. viz.1 Strike 1.02 0.04.04.
3 σ = 0.9 0.195 0.8 0.1.04.2 Motivation and Parameters ρ = 0.23 σ = 0.5 − 3 years ρ=0 0.1.8 0.2 0. maturities : 0.2 Figure 1.8 − 1.95 1 Strike 1. A computationally convenient feature of the model is that it provides a closed .04. ρ = 1 .2.15 1.15 1. ρ = 0.05 1.8 − 1.2 Figure 1.18 0.4 6 0. V0 = 0. strikes : 0.205 σ = 0.19 0.05 1. strikes : 0.2 σ = 0.1.17 0.22 0. V0 = 0. σ = 0.6: Implied volatility surface. θ = 0.1 σ = 0.1 1.85 0.04.85 0. r = 1%.9 0.4 0.1 1.2 Implied Volatility 0.7: Implied volatility surface.5 − 3 years (Cont 2001). S0 =1. 2 θ = 0.19 0.1 σ = 0. κ = 2.2.04. S0 =1. r = 1%.21 Implied Volatility 0.95 1 Strike 1. σ = 0.3 σ = 0.2 σ = 0.5 0. κ = 2. maturities : 0.
This makes the model very robust and hence addresses the shortcomings of the BlackScholesMerton model.8 − 1.05 1..18 0.8: Implied volatility surface.1.1. the option can be hedged by continuously trading the underlyings.04. the asset.19 0.85 0. In a stochastic volatility model.5 0.2 Figure 1. V0 = 0.9 0.15 1.95 1 Strike 1. it provides a closedform solution for any value of ρ.e.1 σ = 0. Since the assets are tradable.2.8 0. 1.2 σ = 0. i. This makes the market complete. Models like Hull and White only provide such closedform solutions for certain values of ρ.17 0.21 Implied Volatility 0. ρ = − 1 ..4 7 0. r = 1%. 1 . maturities : 0. viz. every contingent claim can be replicated. Volatility is not a traded asset. It provides a framework to price a variety of options that is closer to reality.3 Pricing Options In the BlackScholesMerton model. making it more tractable and easier to implement than other stochastic volatility models1 .3 Pricing Options ρ = −0. a contingent claim is dependent on the randomness of the asset ({St }t≥0 ) and the randomness associated with the volatility of the asset’s return ({Vt }t≥0 ).22 0.3 σ = 0. This renders the market incomplete and has many more speciﬁcally.1 1. κ = 2 2. a contingent claim is dependent on one or more tradable assets. Only one of these is tradable. S0 =1. The aforementioned features of this model enables it to produce a barrage of distributions. strikes : 0. The randomness in the option value is solely due to the randomness of these assets.04.5 − 3 years form solution for European options. θ = 0.2 0. σ = 0.23 σ = 0.
V. Option Value = EQ [er(T −t) H(T )] t (1. V.5) where H(T ) is the payoff of the option at time T and r is the risk free rate of interest over [t. say.3 . T ] (we are assuming. t) therefore represents the market price of volatility risk. V. that interest rates are deterministic and previsible. under the EMM Q.3 . This is no easy task as it well known that the market price of volatility risk is nearly impossible to estimate. t) is called the market price of volatility risk. (Majmin 2005) or (Xu 2003) for further details. (2. of course. The reader is directed to (Black & Scholes 1973). the derivation of the PDE is not done here. t)σ V = kσVt = λ(S. The price is evaluated as the expected discounted payoff of the contingent claim2 .3 Pricing Options 8 implications to the pricing of options.1). 1. and that the numeraire is the money market instrument). i. must satisfy the following partial differential equation. say λ(S.1 PDE approach For purposes of brevity.3) but does appear in the pricing formula. t)σ V } − rU + =0 ∂V ∂t (1. Under the Heston model.1 ). and hence needs to be approximated. V. V. t) = k V for some constant k √ ⇒ Λ(S.e.2) or (1. Heston assumes that the market price of volatility risk is proportional to volatility.1 and § 2. This problem is overcome due to the parametric nature of the model and the existence of a closedform solution (see § 3. t.1.2 Risk Neutral approach Risk neutral valuation is the pricing of a contingent claim in an equivalent martingale measure (EMM). t). (1.4) Λ(S.1). the value of any option. 1. 2 1 ∂ 2U 1 2 ∂ 2U ∂U 2∂ U VS + ρσV S + σ V + rS 2 ∂S 2 ∂S∂V 2 ∂V 2 ∂S √ ∂U ∂U +{κ[θ − V ] − Λ(S. V. (Gatheral 2004). This parameter does not appear in (1. So. √ Λ(S. T ). U (St . Vt . 2 this is referred to as the ‘Law of the Unconscious Financial Mathematician’ .
Under measure Q. (1. t) isn’t constant. Since volatility isn’t a σ traded asset. κ∗ = κ + λ κθ θ∗ = κ+λ This is an important result. V.e. µF F is constant for any asset F ).6) (1.9) ϑt = µ−r √ Vt ˜ ˜ where P is the real world measure and {Wt1 }t≥0 and {Wt2 }t≥0 are QBrownian Motions. V. t). V. V. Under the riskneutral measure. we can work around this (see § 2.6).3 Pricing Options 9 Moving from a real world measure to an EMM is achieved by Girsavov’s Theorem. (1.1 ). dSt = rSt dt + ∗ ∗ ˜ Vt St dWt1 ˜ Vt dWt2 (1.7). initially. t)dt dQ 1 t 2 = exp − (ϑs + Λ(S. poses a problem. due to the parametric nature of the model and the existence of a closedform solution.1).1 and § 3. The implications are that the different EMM’s will produce different option prices. It is clear that (1. λ has effectively been ‘eliminated’.7) ϑs dWs1 − t 0 Λ(S. V. Again.2).1. s)2 )ds − dP 2 0 t 0 (1. In particular.10) (1. V. the market is incomplete and Λ(S. we have ˜ dWt1 = dWt1 + ϑt dt ˜ dWt2 = dWt2 + Λ(S. and (1. t). t)dWs2 (1. . and (1. depending on the value of Λ(S.8) (1. In a complete market.8) solely determine the EMM. (1.11) (1. This. it can be shown that every asset/option has the same −r market price of risk (i. This implies that the EMM is not unique and is dependent on the value of Λ(S.3) become.12) dVt = κ (θ − Vt )dt + σ ˜ 1 dW 2 = ρdt dWt ˜t where..
therefore. Gauss Lagendre or Gauss Lobatto integration.. K) = x = fj (x. This integral cannot be evaluated exactly. which in turn will be used to price other exotic options. 2. φ) 1 1 ∞ Re + dφ 2 π 0 iφ ln (St ) exp {C(T − t. 2 1 u2 = − . one needs to be able to compute the price of vanilla options implied by it. φ) = C(T − t. This is used in the calibration process to obtain parameter values. where. φ)Vt + iφx} 1 − gedr a rφir + 2 (bj − ρσφi + d)τ − 2 ln σ 1−g dr bj − ρσφi + d 1 − e σ2 1 − gedr bj − ρσφi + d bj − ρσφi − d (ρσφi − bj )2 − σ 2 (2uj φi − φ2 ) (2.g.2) (2. b1 = κ + λ − ρσ. T. T ) = St P1 − Ke−r(T −t) P2 where. 1 u1 = . Pj (x. Vt .CHAPTER II Computational Evaluation In order to practically implement such a model. φ) + D(T − t. provides the tools required to perform such calculations. T. This section. but in reality is quite ‘explicit’ and easy to evaluate in Matlab. φ) = D(T − t. Vt . Vt .2. The only part that poses a slight problem is the limits of the integral in (2. Vt . b2 = κ + λ e−iφ ln (K) fj (x. e. φ) = g = d = for j = 1. t. T.1 The ClosedForm Solution The closedform solution of a European call option on a nondividend paying asset for the Heston model is: C(St . but can be approximated with reasonable accuracy by using some numerical integration technique. 2 a = κθ. 10 .2).1) Such a formula looks intimidating.
the parameter λ has been eliminated. viz. A method to evaluate formulas in the form of (2. its characteristic function exists. b2 = κ∗ Again.1. This method is much quicker than using a numerical method for the said integrals. 2.2 Fast Fourier Transform (FFT) This method has been proposed by (Carr & Madan 1999).. We ﬁrst begin with some basic deﬁnitions.’ 3 A random variable is absolutely continuous if it has a density function.2.3) (2.4) F −1 {F (φ)} = 1 2π e−iφx F (φ)dφ = f (x) In our framework.2 Fast Fourier Transform (FFT) 11 Under the EMM Q some parameter simpliﬁcation takes place viz. The Fourier transform (F{·}) and inverse Fourier transform (F − 1{·}) of an integrable function. effectively. a = κ∗ θ∗ .. the characteristic function can be expressed as an expectation.1) has been proposed by (Carr & Madan 1999). Bates . . Bakshi and Madan . Carr and Madan have the following to say regarding their method: ‘. b1 = κ∗ − ρσ. it can be seen that. E[eiφX ] FFT is an efﬁcient algorithm used to calculate summations of the following form: N w(k) = j=1 e−i N (j−1)(k−1) x(j) 2π (2.ﬁnd that the use of the FFT is considerably faster than most available methods and furthermore.. Deﬁnition 2. It should be noted that even if a random variable is not absolutely continuous3 . For absolutely continuous random variables (say X)... the traditional method described in Heston . f (x). is ∞ F{f (x)} = −∞ eiφx f (x)dx = F (φ) ∞ −∞ (2. and Scott can be both slow and inaccurate. f (x) is the risk neutral density function of the logreturn of the underlying and F (φ) is called the characteristic function of f (x).5) It is a type of discrete approximation to a Fourier transform.
10) (2. Then the value of a European call.5). as a function of k is.7) into (2.9) −∞ 1 2π e−iφk FcT (φ)dφ CT (k) = e−αk cT (k) ∞ 1 e−iφk FcT (φ)dφ = e−αk 2π −∞ 1 ∞ −iφk = e−αk e FcT (φ)dφ π 0 Substituting (2.12) FcT (φ) = = eiφk eαk e−rT e−rT fT (xT ) (exT − ek )fT (xT )dxT dk (exT +αk − e(α+1)k )eiφk dkdxT ∞ −∞ ∞ −∞ −∞ ∞ −∞ xT −∞ e−rT = 2 α + α − φ2 + i(2α + 1)φ e−rT = 2 α + α − φ2 + i(2α + 1)φ e−rT FCT (φ − (α + 1)i) = 2 α + α − φ2 + i(2α + 1)φ 4 e(α+1+iφ)xT fT (xT )dxT e(−αi−i+φ)ixT fT (xT )dxT because CT (k) is not square integrable . ∞ ∞ k (2.8) (2.7). Let xt := ln St and k := ln K. Carr and Madan deﬁne a modiﬁed call price function4 . cT (k) = eαk CT (k).2 Fast Fourier Transform (FFT) 12 Option pricing lends itself well to this sort of application due to the form of (1.11) (2.2.9) into (2.7) We now expect cT (k) to be square integrable for a range of α values and ∀ k. eiφk cT (k)dk ∞ −∞ (2.6) and (2. α is referred to as the dampening factor. The Fourier transform and inverse Fourier transform of cT (k) is. with maturity T . where K is the strike price of the option.6) where fT (x) is the risk neutral density function of x. ∞ FcT (φ) = cT (k) = Substituting (2. CT (k) = e−rT k ∞ (exT − ek )fT (xT )dxT (2. α>0 (2.8). deﬁned above.
. N 2π η e−i N (j−1)(u−1) eibvj FcT (vj ) (3 + (−1)j − δj−1 ) (2. under Q.1 . given by (Hong 2004): FCT (φ) = eA(φ)+B(φ)+C(φ) A(φ) = iφ(x0 + rT ) 2ζ(φ)(1 − e−ψ(φ)T )V0 B(φ) = 2ψ(φ) − (ψ(φ) − γ(φ))(1 − e−ψ(φ)T ) κθ 2ψ(φ) − (ψ(φ) − γ(φ))(1 − e−ψ(φ)T ) C(φ) = − 2 2 log σ 2ψ(φ) (ψ(φ) − γ(φ))T 1 ζ(φ) = − (φ2 + iφ) 2 ψ(φ) = γ(φ)2 − 2σ 2 ζ(φ) γ(φ) = κ − ρσφi (Carr & Madan 1999) show that. fft(X) returns a (1 × N ) vector whose j th column corresponds to a logstrike of −b + 2b (j − 1).2 Fast Fourier Transform (FFT) 13 where FCT (φ) is the characteristic function of xT . § A. .13) 3 j=1 + N u = 1.3 . these parameters have been speciﬁed by Carr and Madan so that a balance is struck between computational time and accuracy. 2. N + 1 This is now a direct application of (2. where X is the vector created from . contains the code for pricing a European Call N using FFT.2. . 5 . . Matlab can perform FFT using the fft(X) function. vj = η(j − 1) c η = N c = 600 N = 4096 π b = η 2b ku = −b + (u − 1). e−αku CT (ku ) ≈ π where5 . The appendix.5) and hence FFT.
Two techniques are brieﬂy discussed together with their implementation.2). with partition points a. The Matlab code can also be found in § A. f (x). for completeness.3 Numerical Integration . Since outofthemoney options have no intrinsic value. The formula is presented here without derivation. over two equal subintervals. 1 CT (ku ) ≈ π sinh(αku ) γT (v) = 2π η e−i N (j−1)(u−1) eibvj γT (vj ) (3 + (−1)j − δj−1 ) 3 j=1 N ϕT (v − iα) − ϕT (v + iα) 2 1 erT FC (v − i) − − T ϕT (v) = e−rT 1 + iv iv v 2 − iv 2.14) Carr goes further to provide FFT for outof the money options.Quadrature Rules Numerical integration can be used to evaluate the integral in (2. He argues that the above formula depends on the intrinsic value of the option. . and a + 2h (we choose this form of partition for ease of calculation and notation.3 Numerical Integration .1 Adaptive Simpson’s Rule The following is adapted from (Cheney & Kincaid 1999).Quadrature Rules 14 All that remains is to choose the value of α.3 .1 . A general formula will be given later).15) The error of the above approximate can be established with a basic Taylor6 6 no relation to the internal supervisor of this document. 2. as the author ﬁnds very little difference between the solutions of the two methods. (Carr & Madan 1999) suggest that α be chosen such that α+1 E[ST ] < ∞ ⇒ FCT (−(α + 1)i) < ∞ (2. a + h.3 . The basic Simpson’s Rule for numerical integration of a function. an FFT based on the time value of the option has to be derived.2. is a+2h f (x)dx ≈ a h [f (a) + 4f (a + h) + f (a + 2h)] 3 (2.
a + 2h) We now state a general result for the basic Simpson’s Rule. . we get. 3 3 (2. . by the Fundamental Theorem of Calculus. that F (n+1) (a) = f (n) (a) and F (a) = 0 we have a+2h f (x)dx = F (a + 2h) a 4 2 = 2hf (a) + 2h2 f (a) + h3 f (a) + h4 f (a) + . 3 4! f (a + h) = f (a) + hf (a) + So. .3 Numerical Integration . 4 2 20 5 (4) RHS of (2.4! (2. An Adaptive Simpson’s Rule divides the interval of integration into more than 2 subintervals. deﬁne F (x) := a x f (t)dt Again. .2. . 90 ξ ∈ (a. 3 3 3. 1 2 1 1 h f (a) + h3 f (a) + h4 f (4) (a) + . Error in approximation = − h5 (4) f (ξ) = O(h5 ). .16) Now. . Consider. using a Taylor series.17) Subtracting (2. The number of subintervals is dependent on the required accuracy . 4 2 25 F (a+2h) = F (a)+2hF (a)+2h2 F (a)+ h3 F (a)+ h4 F (4) (a)+ h5 F (5) (a) .15) = 2hf + 2h2 f + h3 f + h4 f + h f (a) + .17). b) 1 Error = − 90 f (4) (ξ). b f (x)dx ≈ a b−a f (a) + 4f 6 b−a 2 5 a+b 2 + f (b) ξ ∈ (a. .16) from (2. . 3 3 5! Noting.Quadrature Rules 15 series. 2! 3! 4! 4 3 24 4 (4) f (a + 2h) = f (a) + 2hf (a) + 2h2 f (a) + h f (a) + h f (a) + . .
(0 ≤ k ≤ n) It is quite intuitive that the choice of the polynomials will determine the accuracy of the estimate in (2. It produces a result that has an error less than 10−6 or a user deﬁned tolerance level which is prescribed by a fourth argument.b]. termed nodes or abscissae.Quadrature Rules 16 of the estimate. 1].18) where.3 Numerical Integration .2. over [a. This is quantiﬁed by the error term given above. in general. b] to [−1. The function will.a.1. with weights {Ai }0≤i≤n .18). b Ai = a n i (x) i (x)dx = j=0 j=i x − xj xi − xj where {xi }0≤i≤n .b) uses an Adaptive Simpson’s Rule to numerically integrate @fun over [a. 1] and standardising pn (x) such that pn (1) = 1. The most popular choice of these polynomials are the Legendre polynomials. These are generated by setting the interval of integration to [−1. of degree n + 1 must satisfy: b a xk p(x)dx = 0. A Lagrange interpolating polynomial is a polynomial of order n−1 that passes through n given points. pn+1 (x). f (x). A simple linear transformation can translate the original integral over [a. The roots of these polynomials will then be used as nodes in the Gaussian quadrature over [−1.3 . behave differently over different parts of the interval and hence the intervals chosen will not be of uniform length. . The interpolating polynomial.2 Adaptive Gaussian Quadrature Rules Gaussian quadrature rules approximate the integral of a function. are the zeros of a Lagrange interpolating polynomial. {xi }0≤i≤n . b] by: b n f (x)dx ≈ a i=0 Ai f (xi ) (2. The approximation in (2. 1]. Examples can be seen in ﬁgure 2. The Matlab function quad(@fun. 2.18) is a weighted average of the function at discrete nodes.
These polynomials are of order 1. with a speciﬁc form for the weights and nodes. The nodes are symmetric about the origin and also include the endpoints of the interval. 2. K) = 1 1 + 2 π Re 0 e−iφ ln (K) fj (x. n(n − 1)3 22n−1 ((n − 2)!)4 (2n−2) Error = − f (ξ) (2n − 1)((2n − 2)!)3 where n = number of nodes. The integral is evaluated over [−1.2). This is performed to achieve an estimate whose error is less than 10−6 or a user deﬁned tolerance level prescribed by a fourth argument. 4 and 5 points. 3. Vt . It’s deﬁned as the Gaussian quadrature presented above.1) we need to compute the integral in (2. 3 and 4 respectively.: ∞ Pj (x. 1). 2.1: Lagrange interpolating polynomials for n = 2. The error in the estimate is given by. Vt .a.Quadrature Rules n=2 6 20 15 4 10 2 5 0 0 n=3 17 0 2 n=4 4 6 0 2 n=5 4 6 20 15 500 400 300 10 5 200 100 0 0 0 2 4 6 −100 0 2 4 6 Figure 2. T.3 Computation of the ‘Heston Integral’ In order to evaluate (2.3 Numerical Integration .b) implements an adaptive Gauss Lobatto quadrature rule on the function @fun over the interval [a. φ) dφ iφ (2. and ξ ∈ (−1.3 . The Matlab function quadl(@fun. viz. The rule is adaptive as it divides the original integral into smaller subintervals and performs Gauss Lobatto integration with varying node quantities. 1] with nodes that are from the Legendre polynomials.2.19) . b]. T.
b) evaluates only proper integrals.e.a.4 Comparison of FFT and Numerical Integration 18 for j = 1.b) and quadl(@fun. the integral of (2. § A. Matlab deﬁnes the functions.2.a.3 . for sufﬁciently large b. Figure 2.. FFT is faster in a sense that it generates a matrix of prices with differing strikes. as low order and high order quadrature rules. 2. One would therefore expect quadl to be superior.19) can be evaluated with the required accuracy.4 Comparison of FFT and Numerical Integration It now remains to ﬁnd which method is better suited for our purposes. The parameters that were changed were those that had the most signiﬁcant effect on the integrand. quad(@fun. discussed above.3 . For a complete discussion refer to (Gander & Gautschi 1998). 2. A problem arises as (2. quad(@fun a. I have chosen b = 100 to be prudent.4 Comparison of Quadrature Rules The purpose of this section is to gauge which quadrature rule to use. quad is more efﬁcient (faster) than quadl. Matlab code to price a European call option using Heston’s model via Adaptive Gauss Lobatto integration/Simpson’s Rule can be found in the appendix.. (Gander & Gautschi 1998) say that for extremely small tolerance levels quadl outperforms quad in: • efﬁciency as measured by the number of recursive steps required to compute an answer within a certain tolerance level. but less reliable.b).2 .19) is an improper integral and the argument b cannot be speciﬁed as ‘inﬁnity’ i. quad and quadl. we require an extremely low tolerance level. Thousands of European call option prices are immediately available. 2. • reliability as measured by the extent to which the required tolerance is achieved. . The quadrature rule evaluates the option price only for a given set of parameters. Keeping in mind that we’re pricing options. This can be done in Matlab with the 2 functions. Hence quadl would be better suited for our purposes.e. So. i. For large tolerance levels.2 shows the effect of changing the parameters on the integrand. A quick plot of the integrand will reveal that it converges very quickly to zero.
1 only for one strike price at a time.14 seconds. The relationship between α and these parameters is not as trivial .4 x 10 15 Comparison of FFT and Numerical Integration −3 19 σ = 0.14) we can also see that α is depend on the set of parameters.15 15 x 10 −3 σ = 0. FFT calculates prices for 4097 different strikes in approximately 0. The quadrature rule takes approximately 281. strike = 50.2 −0. FFT.1. maturity = 1 month 0. FFT is faster by a factor of 2014.6 0.2 60 80 100 −0.1 0 −0.89 seconds to perform the same calculation.05 5 0 0 −0.05 0 20 40 φ 60 80 100 −5 0 20 40 φ 60 80 100 Figure 2. V0 = 0. Parameters that were kept constant : κ = 2. For a given set of parameters. strike = 100.2: The Integrand of (2.3 shows the price produced by FFT as a function of α).05 0 0 −5 0 20 40 φ σ = 0.4 0 20 40 φ 60 80 100 0 20 40 φ 60 80 100 σ = 0. The solutions produced are depend on the choice of α (ﬁgure 2.05.e. S0 = 100.19). r = 0. strike = 100. strike = 100.1. strike = 150. θ = 0.04.3 −0.9.4 0. maturity = 1 month 0. in this application.2 0 −0. strike = 100. Notice how quickly this integrand converges to zero.15 10 0. suffers from one drawback. maturity = 1 month 0.5.1. maturity = 1 month 0.1.1. The time difference is extremely signiﬁcant.1 10 0. i.1 5 0. From (2.8 0. maturity = 1 month 0. accuracy. maturity = 1 year σ = 0.05 0 20 40 φ 60 80 100 σ = 0..1 −0.2. ρ = −0.
If an α can be found that satisﬁes (2.4 Comparison of FFT and Numerical Integration 20 to identify as is done in (Carr & Madan 1999) for the VarianceGamma model. 39 38 37 36 35 34 33 32 31 30 price 0 1 2 α 3 4 5 Figure 2.14).2.3: This illustrates how the price of an option is depend on the choice of α . We are therefore left with the quadrature rule as our primary tool for evaluation. then FFT is far superior.
So one cannot just use empirical estimates for the parameters. Often. The question now arises as to what market prices to use in this calibration process. λ. Ti ) are the ith option prices from the model and market. The most popular approach to solving this inverse problem is to minimise the error or discrepancy between model prices and market prices. Ti ) 2 (3.e. and the wi ’s are weights (the choice of these weights will be discussed later). This may seem as a problem but it actually allows ﬂexibility in the calibration process. with strike Ki and maturity Ti . Ti ) and CiM (Ki . solving for a polynomial with given roots is an inverse problem. the squared differences between vanilla option market prices and that of the model are minimised over the parameter space. CiΩ (Ki .1 The Calibration Problem The price to pay for more realistic models is the increased complexity of model calibration.CHAPTER III Calibration of the Model 3. More speciﬁcally. i. The Heston model has six parameters that need estimation.1) where Ω is a vector of parameter values. viz. θ. This usually turns out to be a nonlinear leastsquares optimisation problem. V0 . A common solution is to ﬁnd those parameters which produce the correct market prices of vanilla options. we need not estimate the market price of volatility risk. σ. This leads to a complication that plagues stochastic volatility models in general7 . This is called an inverse problem. Cao & Chen 1997)). On the positive side. 8 eg. Ti ) − CiM (Ki .. Research has shown that the implied parameters (i. the estimation method becomes as crucial as the model itself (Cont 2005). we evaluate N min S(Ω) = min Ω Ω i=1 wi CiΩ (Ki . 7 21 . N is the number of options used for calibration. ρ. respectively. those parameters that produce the correct vanilla option prices) and their timeseries estimate counterparts are different (see (Bakshi. as we solve for the parameters indirectly through some implied structure 8 .e. which is near impossible to do in practice. as for any given option there exists a bid and ask price. κ..
• Hence. on average. also. we address some technical issues. The last two points make this an illposed problem. This poses a further problem for gradient based optimisers. within the bidoffer spread. This is discussed later. In general. Ti ) − CiM (Ki . 3.1 plots S(Ω) as a function of κ and σ. This means that we do not require the model to match the midprices exactly. The graph presents a graphical idea of the nature of S(Ω) as a function of two of its parameters. The minimisation mentioned above is not as trivial as it would seem. illposed problem termed the calibration problem. Notice. The aim is therefore to identify optimisation methods that can deal with the peculiarities of the calibration problem. ﬁnding a global minimum is difﬁcult (and very dependent on the optimisation method used).1) need not necessarily exist. This has some implications regarding the stationarity of parameter values which are important in these types of models. in which case only local minima can be found. It is easy to see that gradient based optimisers will struggle to ﬁnd a global minimum.2 Calibration methods 22 We will use the midprice of the option but accept a parameter set. This means that a gradient based optimisation method will prove to be futile. but fall.2 th Calibration methods Before discussing the calibration methods. given that N wi CiΩ0 (Ki . We should bare in mind that the modeling process should produce the required estimates within a certain tolerance level. S(Ω) is neither convex nor does it have any particular structure. Ω0 . This is not an unreasonable relaxation of the calibration process.3. This is therefore an inverse. .2) where bidi /aski are the bid/ask prices of the i option. • Unique solutions to (3. Figure 3. Accuracy beyond this could be spurious and hence produce less accurate exotic prices. This poses some complications: • Finding the minimum of S(Ω) is not as simple as ﬁnding those parameter values that make the gradient of S(Ω) zero. but it is important to remember that S(Ω) is 5dimensional and as such could be even nastier in its ‘true’ form. the number of points that are nondifferentiable. Ti ) i=1 2 N ≤ i=0 wi [bidi − aski ]2 (3.
o 3. ρ.3) . We also need a constraint on the parameters to prevent the volatility reaching zero. i. This means that less weight should be placed on such a price. Ti ) i=1 2 + αp(Ω) (3. σ. Craddock & ElHassan 2000). evaluation under an EMM effectively reduces the number of estimated parameters to ﬁve.1 Regularisation This method is discussed brieﬂy for completeness. and viceversa. If the spread is great.2 Calibration methods 23 x 10 4 Weighted Squared Errors 4 3 2 10 1 5 5 0 0 10 κ 15 0 σ Figure 3. In other words the model is allowed to imply a wider range of prices around the midprice. (Mikhailov & N¨ gel 2003) suggest that this constraint be 2κθ > σ 2 . σ. θ∗ . V0 . p(Ω). θ.3.3 . ρ. V0 .2 . The following must therefore hold: OptionValueP (κ. λ) = OptionValueQ (κ∗ .e. This choice is quite intuitive.1). to (3. we have a wider bidi −aski  range of prices that the model can imply. Ti )’s under an EMM. 0) We also address the choice of the weights in (3.1) such that N wi CiΩ (Ki . We choose the wi ’s to be 1 . Regularisation involves adding a penalty function.. (Cont 2005) suggests using the implied volatilities as weights. Ti ) − CiM (Ki . For a detailed discussion refer to (Chiarella.1: The Heston error surface as a function of κ and σ The calibration problem has a slight simpliﬁcation when we price options under an EMM.1) using the CiΩ (Ki . As mentioned in § 1.2 . we can evaluate (3.
The result produced by lsqnonlin is dependent on the choice of x0. To achieve this we are moved to replace our problem with one which is close to the original. In other words: Don’t try and solve the given problem. So. nonlinear optimiser is the function lsqnonlin(fun.2 Matlab’s lsqnonlin M ATLAB ’ S leastsquares. It minimises the vectorvalued function. all one needs is ﬁve or more market prices . where the system is not underdetermined. there should exist a rich set of market prices for calibration. Given that the underlying of the model is liquidly traded. respectively.. We have no way of knowing whether the solution is a global/local minimum. x0. This method is therefore dependent on the choice of the the initial parameters. Equation (3.3. lsqnonlin uses an interiorreﬂective Newton method for large scale problems. hopefully. therefore. M ATLAB deﬁnes a large scale problem as one containing bounded / unbounded parameters. where the number of equations to solve is more than the required parameters. where Ω0 is o an initial estimate of the parameters. but if (3. try and solve a different one whose solution is close to that of your problem. i.lb. a local minimum optimiser. x0. The philosophy behind this strategy is one of pragmatism. M ATLAB suggests (Coleman & Li 1996) and (Coleman & Li 1994) for further reference on these methods. using the vector of initial parameter values.2 Calibration methods 24 is convex. our system will never be underdetermined9 . where the lower and upper bounds of the parameters are speciﬁed in vectors lb and ub. in a sense. the initial estimate. Consequently. We cannot hope to determine the exact solution to our problem because of its very nature. fun. not a global optimiser.2 . these methods yield a single set of model parameters calibrated to the market but also require the extra step of determining the regularisation parameter. It is. 3. α (Cont 2005).ub).e. a local one. 9 in fact. here. but rather. When applied to a given set of market prices. This is the essence of all regularisation methods (Chiarella et al. is called the regularisation parameter. If not.2) is satisﬁed. (Mikhailov & N¨ gel 2003) suggest using αp(Ω) = Ω − Ω0 2 . This is. we attempt to ﬁnd an approximation which is as close to the true solution as possible. 2000).3) can be minimised in M ATLAB using the function lsqnonlin(). then the calibration process would have to be rerun with a different x0. but does not possess the ill conditioning which the makes the original intractable. α. the solution is acceptable.
4 Simulated Annealing (SA) Simulated Annealing is a probabilitybased.1 . § A. An advanced version of Solver can be purchased which contains a global optimiser. • process quite arbitrary boundary conditions and constraints imposed on these objective functions. Solver can then be run to calibrate the model. • be implemented quite easily with the degree of coding quite minimal. nonlinear. These conditions must be met in order to motivate its use. The author has used M ATLAB ’ S Excel Link to link the function HestonCallQuad between Excel and M ATLAB. It uses a Generalized Reduced Gradient (GRG) method and hence is a local optimiser (for more information go to www.g.2 . Its attractiveness lies in the fact that it can: • process objective functions (eg. discontinuities. This optimiser should only be used when one is sure that the initial estimates are quite close to the optimal parameter set. 3. .3 contains a comparison of this method to the others presented here. On the down side. e. relative to other nonlinear optimisation algorithms.3 contains a comparison of this method to the others presented here. Excel provides a quick and dirty solution to our problem.2 Calibration methods 25 The appendix. and stochasticity.com). § 3. calculating the bound 2κθ > σ 2 . and hence can make your result suspect! Overall.4 . Excel is useless at handling calculations with very small numbers.3.solver. under certain conditions. 3. The spreadsheets HestonCalibration1 and HestonCalibration2 use this function to calculate the model prices. The calibration results are therefore extremely sensitive to the initial estimates of the parameters. optimiser inspired by the physical process of annealing. contains information and code on using lsqnonlin for calibration. The attractiveness of using Excel and Solver is that most people are comfortable with them and they are available on almost every computer in a workplace. § 3. These sort of calculations do appear during the calibration process.. (3.2 .3 Excel’s Solver The standard Solver supplied with Excel contains an optimiser that can be used for calibration under speciﬁc circumstances.1)) possessing quite arbitrary degrees of nonlinearities.
3. and Tk is the temperature10 parameter at iteration k. & Vecchi 1983) who realised the algorithms application to optimisation in general. tools. . with the temperature parameter decreased at each iteration. This process is iterated. weapons. Rosenbluth. Simulated Annealing approaches this problem in the same way that a bouncing ball can 10 termed this because of obvious historical reasons. The algorithm was ﬁrst developed by (Metropolis. 2. Rosenbluth. as a geographical terrain. If the value of the objective function is less than that of point 1.2 Calibration methods 26 • statistically guarantee ﬁnding an optimal solution. The algorithm works in the following way: 1. else. In a typical annealing process melted metal is allowed to cool subject to differing temperatures and pressures. The above algorithm not only ‘accepts’ parameter sets that decrease the objective function. speciﬁed by the algorithm. It was (Kirkpatrick. The different combinations of these temperatures and pressures determine the structural properties of the cooled product. Teller & Teller 1953) as a means of ﬁnding the equilibrium conﬁguration of a collection of atoms at a given temperature for the actual annealing process. then we ‘accept’ the parameter set from point 2. This ensures that the algorithm does not get stuck in a local minimum. Jr. First the objective function is evaluated at the userspeciﬁed initial parameter estimates. Annealing has played a key role in human history: entire nations have been won and lost on the abilities of craftsmen to produce ﬁt materials (Frost & Heineman 1997). where δf is the difference between the objective functions using the parameter sets in points 1 and 2. but also that which increases it (subject to the probability constraints). 3. and works of art (Frost & Heineman 1997). Simulated Annealing was borne out of the need to model such processes thereby advancing the types of said materials produced. until a termination condition is met (usually a speciﬁed value of the temperature parameter). It helps to imagine the objective function. Annealing is a formal term for the ancient art of heating and/or cooling materials to forge pottery. Next a random set of parameters is generated based on point 1 above. 4. We want to ﬁnd the deepest valley of this terrain. that we want to minimise. the parameter set is accepted δf with probability exp {− Tk }.
the temperature parameter) are collectively known as the annealing scheme. Such a speciﬁcation isn’t obvious since parameters like temperature don’t have an explicit/implicit mathematical relationship with the objective function. The C++ code is opensource and available from www. which in turn affects how long the algorithm runs for. As time progresses. whether 2κθ > σ 2 ). Initially. It is therefore obvious that the annealing scheme be optimally speciﬁed. therefore. it determines the degree of ‘uphill’ movement and the rate of decrease of temperature. This means that the objective function should be able to tell the optimiser whether a set of parameters lies within the required parameter space (in our case.2 .e. The most famous and widely used of these is Adpative Simulated Annealing. The algorithm requires only the value of the objective function for a given set of parameters. in a sense. ASA is similar to SA except that it uses statistical measures of the algorithm’s current performance to modify its control parameters i. the ball has a lot of energy and can bounce from any valley to any other valley. This sort of speciﬁcation has therefore become an art form. been modiﬁed to a point where it is now perfect. Over the years it has. . It does not require the form of this objective function.com. Parameters that are determined by the model (eg. makes the function a ‘blackbox’ to the optimiser.3. when the temperature is high. adaptive methods of Simulated Annealing have been developed. and hence limits the search to a feasible space. ASA works quite well in it’s ‘standard’ form. For example.ingber. and the temperature parameter decreases. For a detailed discussion on ASA the reader is referred to (Ingber 1993) and (Ingber 1995). Constraints are encapsulated within the ‘blackbox’. but also allows the user to tweak the annealing scheme for greater efﬁciency. from valley to valley. the annealing scheme.2 Calibration methods 27 bounce over mountains. 3. It has always been opensource and hence Ingber has had a lot of feedback from users of ASA. A proof is provided by that Ingber shows that ASA is a global optimiser. This.5 Adaptive Simulated Annealing (ASA) ASA was developed by the theoretical physicist Lester Ingber. He also provides arguments for ASA’s computational effeciency and accuracy. the ball loses energy and settles down in relatively smaller ranges of valleys. To reduce the subjective nature of the aforementioned speciﬁcation. The annealing scheme broadly determines the efﬁciency and accuracy of the algorithm.
An example of this data can be found at the end of § A. Solver and ASA were run with the same initial estimates on 2 sets of data.4 . This means that asamin uses the actual C++ code of Ingeber’s ASA through M ATLAB .3. listed on the LSE. in the following ﬁelds: • Circuit design • Mathematics/combinatorics • Data analysis • Imaging • Neural networks • Biology • Physics • Geophysics • Finance • Military 3.3 Calibration Results 28 ASA can be implemented in M ATLAB by downloading the function asamin.1 . ASA lends itself well to a variety of applications in different disciplines. The M ATLAB code for calibrating the model using ASA can be found in § A.3 Calibration Results Having an artillery of calibration methods at our disposal we can proceed to calibrate the model and compare the results. Ingber has consulted on projects. Given the thin requirements of the objective function. was used as market data. Vanilla calls on Anglo American shares. written by Shinichi Sakata. asamin is a M ATLAB gateway function to ASA.2 . Detailed instructions on how to install and use ASA on one’s computer and asamin into M ATLAB can be found in (Moins 2002). lsqnonlin. where he has successfully implemented ASA.4 . The results are as follows: .
7 0.4998 0.1469 88. ASA gives the best result in minimising S(Ω). the results will be quite different for a different set of initial estimates.88 20 mins where Time is the running time of the calibration process11 . on average. Notice that lsqnonlin drops down very quickly to a local minimum whereas ASA keeps on searching for other minima and hence oscillates.057 0. unlike lsqnonlin and Solver which settles down quite quickly into a local minimum.75 0.1450 ASA 21.3 illustrate this point. the difference in S(Ω) is acceptable.4 Comparisons.3.8141 0.4 Comparisons.5 hours 0.15 lsqnonlin 4. At this point it should be noted that ASA statistically guarantees to ﬁnd an optimal solution.63 sec 81. This conclusion can only be made for the given set of initial parameters.0227 0.1034 2.4189 0. As mentioned above.6 Ghz. On the 11 October ASA doesn’t produce the lowest S(Ω).1) isn’t very far from the initial estimates. Although Solver produces the best parameter set.74783 0. 11 This was run on a Pentium M 1.0481 0. but is far more computationally demanding.096 10 7. One should be careful and not generalise such a conclusion as the solutions presented by lsqnonlin and Solver are very dependent on the initial parameters. Figures 3.8061 0.32 0.7670 0. ASA will provide the best estimate if the annealing scheme is optimised.0859 0.1072 1.5 0.1938 89.3108 0.6066 0. Given that they are far quicker than ASA. lsqnonlin and Solver should only be used when one is conﬁdent that the solution to (3.2 and 3.10 10 mins 5 15. As can be seen. Considerations and Shortcomings 29 V0 S(Ω) Time Method κ θ σ ρ 11 October 2005 Initial Estimate 3 0. There have been trial runs where the differences between lsqnonlin.1604 2.3284 0. Considerations and Shortcomings Relative to ASA.10 87.80 4.0487 0. 3. then lsqnonlin and Solver’s solutions could have been very far off from ASA’s.50 62.38 3. but is very close.0745 1.05 0.5 0.1829 77. .1583 Solver 5. 512MB RAM.1568 20 October 2005 Initial Estimate lsqnonlin ASA Solver 386.16 148.0579 0.7369 0.58 6 mins 0. The reason that ASA runs so long is because it searches the entire parameter space for a global minimum.7416 0.7 hrs 78.0099 0. If these were chosen differently. Solver and ASA were quite signiﬁcant (ASA producing the best estimate).8236 0. lsqnonlin and Solver don’t perform that badly in minimising S(Ω) .
g.2: This illustrates how the objective function is minimised when using lsqnonlin. for a random guess of the initial parameters (e.5 1 Iteration 1. x 10 4 12 10 Objective Function 8 6 4 2 0 0 0. Also.5 x 10 4 Figure 3. this would be done when the model is calibrated for the very ﬁrst time).3. ASA is the best option . It should also be noted that ASA is being used in its raw form.3: This illustrates how the objective function is minimised when using ASA.5 2 2. There has been no tweaking of the annealing schedule which can result in a signiﬁcant decrease in runtime. Considerations and Shortcomings 1400 30 1200 1000 Objective Function 800 600 400 200 0 0 100 200 300 400 Iteration 500 600 700 800 Figure 3.4 Comparisons.
(Mikhailov & N¨ gel 2003) say that the parameters aren’t stationary.^2) < SumBidOffer PossibleSolutions{j} = input. We seek a 5dimensional set of stationary parameters and hence the usual arguments 12 a cell matrix in Matlab is a matrix of matrices . there should be a marriage of the different methods to create efﬁciency and not sacriﬁce accuracy. and the market conditions are quite normal (i. The stationarity that most practitioners on this topic refer to is that of the parameters that solve (3. An acceptable set is one that satisﬁes (3. Comparing the PossibleSolutions matrices over the different days/months it could be possible to extract a set of parameters that are more or less an element of each PossibleSolutions. We expect that today’s parameters are in a small neighborhood around yesterday’s. Extracting the common set of parameters is not as trivial as it may seem. a parameter set that we use need not be this set. Another issue to consider is the stationarity of parameters. If there has been a crash or dramatic market movement then such an expectation is unreal.1).4 Comparisons. First. Considerations and Shortcomings 31 The obvious question is. Call this value SumBidOffer.2) that is evaluated at each iteration.e. The model should now be calibrated every day/month until enough PossibleSolutions matices are available. An initial problem with ASA. But. But. If a global minimum was obtained yesterday (by using ASA). By adding the following logical test in functions HestonDifference and HestonCostFunc we can store those parameter sets that satisfy (3.2). In this case ASA would have to be used. So. lsqnonlin and Solver is that they don’t tell us anything about the multiplicity of solutions of the calibration problem. Remember that the objective function is the LHS of (3. j = j+1 end where j is the appropriate index of the cell matrix12 PossibleSolutions.2): if (sum(PriceDifference. But we can employ a clever trick and adapt ASA and lsqnonlin to do this. and hence the o comment above about calibrating the model each day. The choice of method should be dependent on the amount of information available related to parameter values and the state of the market. Due to time constraints placed on such an honours project.2). calculate the RHS of (3. which method do we use? There isn’t a straight answer to this. such a task wasn’t able to perform.2). This creates a stationary set of parameters that satisfy (3. no crashes or dramatic movements since yesterday) then lsqnonlin and Solver can quite safely be used.3.
g. forward starting options. . However. Lastly.3. are not that helpful.. though. etc. the parameters have no relation to their timeseries counterparts. First.1) has to be minimised. the recently developed simulationbased “indirect inference method” (timeseries relative) is used to estimate the parameters for the dynamics of the asset. But it is exactly for this reason that we can estimate a few of the parameters by some other method and then use a nonlinear least squares method to ﬁt the model.1) can be carried out using genetic algorithms. The calibrated ensemble will then reproduce exact market prices. This method does not involve ﬁtting the parameters to market data as most methods do. Each set of the ensemble is assigned a weight which is attained by just one matrix inversion. so it seems counterintuitive to estimate some of the parameters using some timeseries method. Rather. e. hedge ratios are easily calculated. M ATLAB contains some genetic algorithms in the Direct Search Toolbox which is an extension of the Optimisation Toolbox. it seems that the calculation of (3. This effectively reduces the dimension over which (3. it uses an ensemble of parameter sets. (Johnson & Lee 2004) proposes calibrating the model using an Ensemble method. This seems like an extension to the method presented here and could be an interesting extension to this project.5 Other Methods For completeness a few of the other calibration methods will be presented. similar to what is presented above. (Ingber 1993) notes that these algorithms are much slower that ASA. barrier options. in the 1dimensional case. (Johnson & Lee 2004) state that the attractiveness in the model lies in it’s simplicity and robustness in being able to calibrate to any type of instrument. while reading through the Wilmott forums. Also.5 Other Methods 32 that are used in such stationarity tests. (Shu & Zhang 2004) propose a 2step Indirect Inference method of calibrating the model. 3. A nonlinear least squares method is then used to calibrate the remaining parameters. As mentioned before.
They are the best that we have in an unpredictable world without which we would be far worse off! 33 . After all.Conclusion As Mathematicians (or students thereof) we can get caught up in the magic of Mathematics. It is a mathematical tool that models something that is inﬁnitely complex. essentially. though. It is important to remember that the Heston model is. This doesn’t make stochastic models. in general. Such efforts can lead to spurious results. Energy should not be wasted. a model. one is trying to perfectly ﬁt a model that doesn’t perfectly explain the real world. of volatility. If the underlying assumptions are carefully understood and its application carefully applied then stochastic models are powerful tools. useless. It therefore cannot wholly capture the complicated and diverse dynamics that exist in reality. on overﬁtting the model. Calibration of the model is an important task.
^(0. theta =. r = 0. numberOfSimulations = 1000000. V(i) = V0 + k*(theta . delT = . Zt1 = φ1 t Zt2 = ρφ1 + t 1 − ρ2 φ2 t where {φ1 }t≥0 and {φ2 }t≥0 are independent standard normal random variables.1. V0 = .V0)*delT + sigma*sqrt(V0)* . %prevents negative volatilities S(i) = S0 + r*S0*delT + S0*V. rho =0. NormRand2 = randn(1. √ Vt−1 St−1 dtZt1 √ = Vt−1 + κ(θ − Vt−1 )dt + σ Vt−1 dtZt2 St = St−1 + rSt−1 dt + Vt where {Zt1 }t≥0 and {Zt2 }t≥0 are standard normal random variables with correlation ρ.numberOfSimulations).9. The code is broadly similar for the simulation of ﬁgure 1.numberOfSimulations).1 Simulation of Probability Densities Monte Carlo simulation was performed by discretising the stochastic processes using the EulerMaruyama method. V = abs(V).rho^2)*NormRand2)*sqrt(delT).1 is as follows: S0 = 10.5). using the Cholesky decomposition. sigma= . t t Matlab code for the simulation of ﬁgure 1.numberOfSimulations)..Appendix A. i = 1:numberOfSimulations.01.numberOfSimulations). S = zeros(1.*NormRand1*sqrt(delT). 34 . (rho*NormRand1 + sqrt(1. The above can be made computationally easier by expressing {Zt1 }t≥0 and {Zt2 }t≥0 .02. NormRand1 = randn(1. as a function of independent standard normal random variables.5. k = 2.01. V = zeros(1. This resulted in..
..01... strikes(j).. price).j) = price. using the Heston closedform solution (§ 2.. . Volatility(i... mats(i). mats = linspace(.04.5’).11)..mats(i). . Volatility(i. .04.strikes(j))..xlabel(’Maturity(years)’).8. .04.Title(’\rho = 0’).Volatility). price).mats). 0. The function blsimpv returns the BSM implied volatility for a given set of parameters.1.1.0.01 . mats(i).4)..xlabel(’Maturity(years)’).3..strikes(j)).j) = price..1.zlabel(’Implied . strikes(j)..01 .2 Generating Volatility Surfaces and Skews Prices of the European call options are calculated.04.zlabel(’Implied ..11). prices(i. Volatility’).strike.1. ylabel(’Strike’).. end end [strike mat] = meshgrid(strikes.1. VolSmile. prices(i. The following script ﬁle. figure.1.2.01.mats(i)...2 Generating Volatility Surfaces and Skews 35 A.04. %maturities for i = 1:11 for j = 1:11 price = HestonCallQuad(2.. at different maturities and strikes.3. Volatility’)..strikes(j)). These prices are then equated to the BlackScholesMerton (BSM) solution and the volatility that satisﬁes this equation is evaluated.2..A.m generates the volatility surfaces of § 1.j) = blsimpv(1. 1.04.0. 1... for i = 1:11 for j = 1:11 price = HestonCallQuad(2.5..Volatility).j) = blsimpv(1.strike. strikes = linspace(. . ylabel(’Strike’).mats(i).. 0.Title(’\rho = 0. for i = 1:11 for j = 1:11 price = HestonCallQuad(2..5.01.1 ). .3. figure. end end surf(mat..0.2 (ﬁgures 1.. 1. surf(mat..
j) = blsimpv(1. . strikes(j).Title(’\rho = 0. char(styleV(i))]).0.j) = blsimpv(1. . strikes = linspace(.strike. .m. styleV = {[’’][’’] [’. .’\sigma = 0.7 and 1.[char(colourV(i)). 1. mats(i).8. Volatility(i. 1.04.’\sigma = 0. char(styleV(i))]). strikes(j). 0..01 . price). for i = 1:4 for j = 1:11 price = HestonCallQuad(2. .1.Title(’\rho = 0.Volatility(i. . .ylabel(’Implied Volatility’).1.2 Generating Volatility Surfaces and Skews prices(i.1.1’.Volatility(i... The following script.1:. . Volatility(i.04. ’\sigma = 0.. strikes(j).[char(colourV(i)).3’.04. xlabel(’Strike’)..strikes(j))..8 of § 1.1:.:). xlabel(’Strike’).01 .5.zlabel(’Implied.ylabel(’Implied Volatility’). end legend(’\sigma = 0.. . prices(i. Volatility’).11).Title(’\rho = 0’).2’. hold on.volvols(i).01 . price)..j) = price..j) = price.4’) figure. ..:). . 0... ..01. ylabel(’Strike’).. colourV = {[’k’] [’b’] [’r’] [’m’]}.A.strikes(j)).. generates ﬁgures 1.01. end 36 end surf(mat. for i = 1:4 for j = 1:11 price = HestonCallQuad(2. Volatility(i.5’).. prices(i. end plot(strikes. volvols = [... end plot(strikes.2..1. HestonVolSmileVolVol. price)..xlabel(’Maturity(years)’).j) = blsimpv(1....2 .1. 0..’] [’:’]}.j) = price.5’).volvols(i).04..0. 1.6..4]..Volatility).
.strikes(j))..1’.’\sigma = 0.3 .:).1.rho. end legend(’\sigma = 0...4’) 37 A..v0.5.j) = price. xlabel(’Strike’)....04. 0. A.3 for computationally evaluating the closedform solution for a European call. for i = 1:4 for j = 1:11 price = HestonCallQuad(2.. ..0. Volatility(i.volvols(i)..Volatility(i. char(styleV(i))]).1. .01 .1 European Call using FFT The following function calculates atthemoney and inthemoney European call prices using FFT.j) = blsimpv(1. . hold on..sigma.r .’\sigma = 0.3 Evaluation of the ClosedForm Solution Presented here are the two methods discussed in § 2.theta.strike.ylabel(’Implied Volatility’). . 1.04.2’.. function CallValue = HestonCallFft(kappa. .3 Evaluation of the ClosedForm Solution hold on.T) %kappa %theta %sigma %v0 %rho %T = = = = = = rate of reversion long run variance Volatility of volatility initial Variance correlation Time till maturity .. strikes(j).s0. end plot(strikes.01..3’.A. end legend(’\sigma = 0..’\sigma = 0.2 and § 2. .Title(’\rho = 0.3’.4’) figure.2’. price). ’\sigma = 0..5’).1’. prices(i.[char(colourV(i)). ’\sigma = 0.’\sigma = 0. .
theta.A. (PHIgamma).. charFunc = exp(A + B + C). C = kappa*theta/sigma^2*(2*log((2*PHI .rho*sigma*v*i.*(1exp(PHI*T))). position = (log(strike) + b)/lambda + 1./(2*PHI . CallValueM = exp(log(strike)*alpha)*payoff/pi. FftFunc = exp(i*b*u). PHI = sqrt(gamma. sigma.*(1exp(PHI*T)))).*T))).^2 +i*v). alpha = 1.T) %kappa %theta %sigma %v0 = = = = rate of reversion long run variance Volatility of volatility initial Variance .^2 + i*(2*alpha +1)*u). zeros(1.rho. + alpha .. b =pi/eta. gamma = kappa ... format short./(alpha^2 .2*sigma^2*zeta). The following function calculates outofthemoney European call prices using FFT.strike.5*(v.*(1exp(PHI.s0.r.v0..(alpha+1)*i. CallValue = CallValueM(round(position)). B = v0*((2*zeta. %position of call %value in FFT %matrix v = u ...3 %r %s0 Evaluation of the ClosedForm Solution = interest rate = initial asset price 38 x0 = log(s0). lambda = 2*b/N..*SimpsonW.^[1:N] . zeta = .u. SimpsonW = 1/3*(3 + (i).. (PHIgamma).^2 . N= 4096..N1)]).*ModifiedCharFunc*eta./ .[1. ModifiedCharFunc = charFunc*exp(r*T).. function CallValue = HestonCallFftTimeValue(kappa. eta = c/N.. c = 600. payoff = real(fft(FftFunc)).25.. A = i*v*(x0 + r*T). (2*PHI)) + (PHIgamma)*T). u = [0:N1]*eta.
A2 = i*v2*(x0 + r*T)./(i*w1) ..*T))). u+i*alpha... ModifiedCharFuncCombo = (ModifiedCharFunc1 . position = (log(strike) + b)/lambda + 1. PHI2 = sqrt(gamma2.. (PHI1gamma1)./(2*PHI1 . . gamma2 = kappa . (PHI2gamma2). u+i*alpha i.^2 .*(1exp(PHI2*T)))...... C1 = kappa*theta/sigma^2*(2*log((2*PHI1 . (PHI2gamma2).2*sigma^2*zeta2)....^2 +i*v2).*T)))..*(1exp(PHI1*T))).^2 .charFunc2. zeta2 = . zeta1 = .3 %rho %T %r %s0 Evaluation of the ClosedForm Solution = = = = correlation Time till maturity interest rate initial asset price 39 x0 = log(s0).^2 +i*v1). gamma1 = kappa ./(i*w2) . A1 = i*v1*(x0 + r*T).. ModifiedCharFunc2 = exp(r*T)*(1.*(1exp(PHI2*T))))./(1+i*w2) . ModifiedCharFunc1 = exp(r*T)*(1.*(1exp(PHI1*T))))... + (PHI1gamma1)*T).rho*sigma*v2*i.25. u = [0:N1]*eta.i*w2)). B2 = v0*((2*zeta2.*(1exp(PHI1. charFunc1 = exp(A1 + B1 + C1)... charFunc2 = exp(A2 + B2 + C2)../(2*PHI2)) .^2 . (PHI1gamma1). B1 = v0*((2*zeta1.rho*sigma*v1*i. eta = c/N. %position of call %value in FFT matrix w1 w2 v1 v2 = = = = ui*alpha. c = 600. exp(r*T). + (PHI2gamma2)*T)./(1+i*w1) .A.... alpha = 1. ModifiedCharFunc2)/2 . N= 4096.*(1exp(PHI2./(w1. lambda = 2*b/N.i*w1)). exp(r*T)..2*sigma^2*zeta1)./(w2./(2*PHI1)) .. C2 = kappa*theta/sigma^2*(2*log((2*PHI2 .5*(v1. PHI1 = sqrt(gamma1./(2*PHI2 .^2 .. ui*alpha i.charFunc1. b =pi/eta.5*(v2.
.v0. SimpsonW. function ret = HestonP(kappa.. s0.r.5 + 1/pi*quadl(@HestonPIntegrand.v0. rho.sigma.. calls HestonPIntegrand(phi.sigma.type).T. where type = 1.T.s0... FftFunc = exp(i*b*u). == 1 0.sigma..T.rho.K.rho.rho.s0.3 Evaluation of the ClosedForm Solution SimpsonW = 1/3*(3 + (1).v0. K*exp(r*T)*HestonP(kappa.[].s0.kappa.sigma.K) warning off. theta.rho. format short./(i*phi)).type). .kappa. . call = s0*HestonP(kappa.T.100.v0.rho. This.1) ..r.T.rho.v0.A.5.r.19).type).K. function call = HestonCallQuad(kappa.sigma.theta.kappa.s0. which evaluates (2.sigma. rho. CallValue = CallValueM(round(position)).r.0.theta.theta. All variable names are the same as used in (Heston 1993).kappa. zeros(1. in turn.r.v0.T.r.sigma.r. which evaluates the integrand of (2. function ret = HestonPIntegrand(phi.theta.sigma.K) calculates the value of a European call.rho.rho.K..s0..3 . kappa .T.K.v0. It calls HestonP(kappa..s0.N1)]).*ModifiedCharFuncCombo*eta. CallValueM = payoff/pi/sinh(alpha*log(strike)).theta.type).s0.K.r.K.type).type) ret = real(exp(i*phi*log(K)).v0. v0.[].theta.2 European Call using Numerical Integration The function HestonCallQuad(kappa.theta.v0. kappa.K..theta.theta. in turn calls Hestf(phi..T.r.^[1:N] .kappa.T. function f if type u = b = else u = b = = Hestf(phi.s0.rho. .sigma.kappa.*. payoff = real(fft(FftFunc)).type). . 40 A. which evaluates the ‘f ’ function in the integrand of (2.5.r.*Hestf(phi.r.v0.v0.sigma. either using an adaptive Gauss Lobatto rule or adaptive Simpson’s Rule.r.19).2).rho*sigma. sigma.rho.sigma.type) ret = 0.19)..T.T.s0.2. 0.theta.[1.s0. This.theta.s0..T.
bid..*((b..T. global global global global OptionData. Reasonable bounds on the parameters were chosen relative to this.*ib). maturities. NoOfIterations.4 Calibration 41 end a = kappa*theta.txt13 . load OptionData. The ‘load OptionData./sigma^2. g = (brho*sigma*phi*i + d).*((1exp(d*T)).d). clear. f = exp(C + D*v0 + i*phi*x). etc.rho*sigma*phi*i + d)*T .Option Value.m is presented at the end of this subsection 13 . It is done here in this way because it is easier to encapsulate the constraint 2κθ − σ 2 > 0.^2)). A.*exp(d*T))).m .. an example of the composition of OptionData.*exp(d*T)).4 Calibration The following contains the M ATLAB code for calibrating the Heston model. d = sqrt((rho*sigma*phi. bid and offers. %OptionData = [r. NoOfOptions./(brho*sigma*phi*i ..offer] Size = size(OptionData). (1g.1 Using Matlab’s lsqnonlin The script ﬁle HestonLsCalibration.4 .. market prices. NoOfIterations = 0.A.^2sigma^2*(2*u*phi. D = (brho*sigma*phi*i + d).txt’ line imports the strikes.K. x = log(s0)./ .*i*T + a/sigma^2. NoOfOptions = Size(1).S0.*iphi. 2*log((1g. It creates a handle on the function HestonDifferences that calculates the differences between the model and market prices within lsqnonlin. The ﬁrst parameter of input that M ATLAB sends into HestonDifference is 2κθ − σ 2 . A.. of the options and underlying from the ﬁle OptionData. C = r*phi.m initiates the calibration process./(1g))). PriceDifference.
NoOfIterations.input(4). Vanilla calls written on Anglo American shares that trade on the LSE have been used.input(5)... ..v0] x0 = [6. (input(1)+input(3)^2)/(2*input(2)). For illustrative purposes. .0731 2. NoOfIterations = NoOfIterations + 1. OptionData(i.OptionData(i...m is a text ﬁle containing the market data for calibration.5)HestonCallQuad( .... %counts the no of iterations run to calibrate model for i = 1:NoOfOptions PriceDifference(i) = (OptionData(i..3). tic. toc. . Calibration = lsqnonlin(@HestonDifferences. As mentioned before.20000). Calibration(2:5)].lb.6).. PriceDifference.rho.. input(3). OptionData(i.1)...A. %sets the max no. function ret = HestonDifferences(input) global global global global NoOfOptions.OptionData(i.3012 0.sigma.4)))/sqrt((abs(OptionData(i.1838]. OptionData(i. the ﬁle OptionData. OptionData contains the following information: . ub = [20 1 5 0 1]..4 Calibration 42 %input sequence in initial vectors [2*kappa*theta .2).sigma^2.ub). %input matrix = [kappa theta sigma rho v0] end ret = PriceDifference’. OptionData.. % theta. options = optimset(’MaxFunEvals’.x0. (2*Calibration(2)).4176 0. of iteration to 20000 so that termination %doesn’t take place early.input(2). lb = [0 0 0 1 0]. Solution = [(Calibration(1)+Calibration(3)^2)/ .5482 0.7))))..
627397 0.2342% 2.50 86.50 51.627397 0.00 1150.627397 0.50 1500.00 51.50 1544.00 56.00 411.126027 0.50 378.50 Offer 565.00 44.50 1544.2685% 2.00 353.50 1544.00 57.1947% 2.00 1800.00 18.2685% 2.00 1400.50 272.50 309.2685% 2.50 454.50 1200.375342 0.2342% 2.00 263.00 1600.00 1250.50 1544.50 1544.375342 0.00 37.50 1544.00 145.00 35.50 466.2685% 2.50 rq 2.50 1544.00 26.50 1900.2685% 2.00 28.00 56.50 1544.50 1500.50 1544.00 515.00 154.00 1500.2685% 2.126027 0.00 14.2342% 2.00 61.50 1544.00 1700.1947% 2.627397 0.00 140.00 121.50 1544.00 77.50 1600.50 1544.00 207.00 503.00 186.627397 0.2685% 2.00 128.2342% 2.50 1900.1947% 2.50 1800.2 Adaptive Simulated Annealing (ASA) in M ATLAB The scheme that controls the ‘acceptance’ of new solutions is so simple that the cost of implementing ASA is purely dependent on the computational efﬁciency of .00 4.126027 0.00 180.1947% 2.50 1544.00 1350.375342 0.2685% 2.50 1544.126027 0.50 1544.2342% 2.00 174.50 108.2342% 2.50 1100.00 7.00 23.00 1450.00 41.00 20.00 362.50 393.1947% 2.627397 0.50 7.50 1544.00 179.375342 0.00 368.2685% 2.375342 0.00 1200.50 1544.50 1300.50 2.50 1544.00 251.2685% 2.25 1700.00 180.00 300.375342 0.00 81.627397 0.00 10.50 1544.00 266.00 1050.2685% 2.2342% 2.50 1700.4 .1947% 2.50 1544.2685% 2.00 338.50 Bid 553.00 386.00 173.2342% 2.50 290.126027 0.50 29.50 102.50 1544.00 559.00 315.00 96.50 293.50 92.2342% 2.2342% 2.126027 0.375342 0.00 149.00 22.50 308.50 1800.627397 Spot 1544.A.50 1544.126027 0.00 176.126027 0.126027 0.25 1900.2342% 2.375342 0.50 1544.50 1544.00 105.375342 0.375342 0.00 417.00 1600.4 Calibration 43 Term 0.00 1350.00 223.126027 0.126027 0.00 281.50 1300.50 1544.00 217.126027 0.126027 0.50 1544.2685% 2.00 216.00 509.2685% 2.00 213.00 136.50 1544.00 356.50 Strike Mid Price 1000.00 275.00 198.126027 0.2685% 2.00 460.00 166.00 405.50 100.00 50.00 244.50 63.375342 0.00 228.00 229.00 1450.50 1544.50 321.00 1250.00 259.00 269.50 1544.00 144.126027 0.50 253.00 114.00 182.50 1544.00 1400.00 32.00 345.00 13.00 1400.50 1544.50 1544.50 235.50 1544.00 221.1947% 2.1947% A.00 1450.50 1350.
1*ones(5. global OptionData.. In our case. ub = [10 1 5 0 1].theta. function [cost .m . %flag = 0 if contraint is violated.v0] x0 = [0. xstar. state] = asamin(’minimize’. calibrates the model using ASA. The following script.999999922 0.248415019 1 0. hessian. NoOfOptions = Size(1).Option Value.rho.A.S0.bid. [fstar. else = 1 .ub’.sigma. asamin(’set’. NoOfOptions. %OptionData = [r. global NoOfIterations. global ObjectiveFunc. %input matrix = [kappa theta sigma rho v0] NoOfIterations = NoOfIterations + 1.’test_in_cost_func’. lb = [0 0 0 1 0]. load OptionData. ObjectiveFunc. global PriceDifference. HestonASACalibration. if (2*input(1)*input(2)<=input(3)^2) %test for constraint flag = 0. global global global global global OptionData.030854841 0. It uses the function HestonCostFunc clear. calculation of the objective function for a given set of parameters entails the evaluation of a large number of options. %input sequence in initial vectors [kappa. flag] = HestonCostFunc(input) global NoOfOptions. ’HestonCostFunc’. PriceDifference.08977599]. NoOfIterations = 0.T.offer] Size = size(OptionData).x0’.K. toc. NoOfIterations.. grad.0) tic.1)).lb’.4 Calibration 44 evaluating the objective function. This makes ASA very computationally demanding and time consuming..
.7)))). %the optimiser end .. OptionData(i..6)..input(5)..3)...^2) ObjectiveFunc(NoOfIterations) = cost.OptionData(i.. input(1). OptionData(i.OptionData(i.input(4).4 Calibration 45 cost = 0 else for i = 1:NoOfOptions PriceDifference(i) = (OptionData(i.input(3).5)HestonCallQuad(.1).4)))/sqrt((abs(OptionData(i. %stores the path of flag = 1. ...2).A. OptionData(i.input(2). end cost = sum(PriceDifference.
F. Cheney. (1996). Ingersoll. trust region approach for nonlinear minimization subject to bounds’. (1973). C. ‘Recovering volatilty from option prices by evolutionary optimisation’. (1997). Y. A. Craddock. ‘Empirical properties of asset returns: stylized facts and statistical issues’. W. D. 4 edn.revisited. B. (1998). M. (1999).. 418–445. ‘A theory of the term structure of interest rates’. Frost. 20032049. T. Black. Coleman. & Li. http://ideas. & Li. Cao. 61–73. Journal of Finance 52. W. ‘On the convergence of reﬂective newton methods for largescale nonlinear minimization subject to bounds’. (2005). Econometrica 53. Coleman. Quantitative Finance 1. ‘Option evaluation the using fast fourier transform’. ‘Valuation of options and corporate liabilities’. & Scholes. 223–236. & Chen. F. 637–654. SIAM Journal on Optimization 6. Adaptve quadrature . University of Technology.org/p/uts/rpaper/39.html. Departement Informatik. Numerical Mathematics and Computing. (2001). Quantitative Finance Research Centre. S. Journal of Political Economy 81. & Kincaid. Mathematical Programming. Z. (1997). Gander. ETH Z¨ rich. F. N. J. pp. & ElHassan. Research Paper Series 39. & Gautschi. Research Paper Series. M. C. in ‘PDPTA’. Technical report. E.. 385–407.repec. R. (1994). ‘Empirical performance of alternative option pricing models’. (1999). G. (1985).References Bakshi. J. P. W. Chiarella. & Heineman. Cont. Cont. T. Sydney. C. Simulated annealing: A heuristic for parallel stochastic optimization. Cox. D.. R. & Madan. & Ross. Brooks/Cole Publishing Company. Journal of Computational Finance 2(4). 1595–. P.. u 46 . The calibration of stock option pricing models using inverse problem methodology. Carr. (2000). ‘An interior. Y. R.
Pricing and hedging under stochastic volatility. E. Journal of Derivatives Accounting 1(2). (1993). Case Studies in Financial Modelling Notes. Master’s thesis. Hong. (1995). & Zhang. Science 220(4598). J. Teller. U. S.. M. . Local and stochastic volatility models: An investigation into the pricing of exotic equity options. & N¨ gel. Courant Institute of Mathematical Sciences. A. J. (2004). (1993). The Review of Financial Studies 6(2). L. Risk Magazine March. A. (2003). D. L. & Lee. S. Rosenbluth. Moins. ‘Capturing the smile’. ‘Adaptive simulated annealing (asa): Lessons learned’.. (2002). Majmin. ‘Lecture 1: Stochastic volatility and local volatility’. ‘Hestons stochastic volatility model implemeno tation. Kirkpatrick. L. Mikhailov. Metropolis. H. Journal of Chemisry and Physics 21(6). A. L. Journal of Mathematical Computational Modelling 18(11). ‘Optimization by simulated annealing’. S. ‘A closedform solution for options with stochastic volatility with applications to bonds and currency options’. Link¨ ping Institute of Technology. A.. Control and Cybernetics. (2004). ‘Forward smile and derivative pricing’. Ingber. ‘Pricing s&p 500 index options under stochastic volatility with the indirect inference method’. M..References 47 Gatheral. G. South Africa. Heston. Ingber. Jr. Rosenbluth. G. ‘Equation of state calculations by fast computing machines’. (2004). E. 89– 93. Johnson. (1953). 1–16. N. J. & Vecchi. (2003). J.. Master’s thesis. (1983). 29–57. Xu. 671–680. o Shu. University of the Witwatersrand. ‘Simulated annealing: Practice versus theory’. & Teller. Wilmott. S. (2004). calibration and some extensions’. China. Technical report. Implementation of a simulated annealing algorithm for M ATLAB . 327–343. 1087–1092. S. (2005). P. Peking University. C.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.