Lecture11 IEOR4732
Lecture11 IEOR4732
irsa
Ali H
by
a n ce
Fin
Computational Methods in Finance o ds
in
t h
Lecture – Week 11 Me
n al
i o t
uta
o mp
C
ed
Financial titl
k Engineering
oo b
he
Industrial Engineering & Operations Research
o nt
se d Columbia University
a b
ly,
s on
os e
rp
pu
n al
io
cat
r edu
Fo
Calibration vs. Estimation Agenda Filtering Examples
Agenda
irsa
Ali H
by
a n ce
Fin
in
Fully vs. Partially Observed Processes ds
tho
l Me
Filtering n a
tio
Parameter Estimation p uta
m
Co
Examples i t l ed
t
ok
Filtering Techniques bo
t he
Kalman Filter on
a sed(KF)
b
Extended ly,Kalman Filter (EKF)
s on
os e
Unscented Kalman Filter (UKF)
urp
pSquare-Root Unscented Kalman Filter (SR-UKF
na l
ca tio Particle Filtering (PF)
r edu
Fo
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
Ali H
by
a n ce
Fin
in
o ds
t h
Me
n al
i o
tat
for partially observed processes, atomeach pu day in history, the aim
d C
is to calculate the hidden state itl on that day to best fit
e that
kt
day’s observation b oo
he
o nt
this procedure issecalled d filtering
b a
ly,
on
oses
rp
pu
n al
io
cat
r edu
Fo
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
Ali H
by
a n ce
Fin
given Θ, by filtering we can find the time seriesodsofin the hidden
state that gives the best fit over time eth
lM a
i on
tat
during filtering, the parameter set ispukept fixed over the entire
o m
time series of data ed
C
titl
k
one can repeat this procedure
oo by using different Θ for each
t heb
run and find the best
on fit for the corresponding Θ
sed a
the parameter , bset that maximizes likelihood or yields smallest
o nly
s
msre orosethe like is the optimal parameter set
urp
p
this al procedure of finding the optimal parameter is called
ti on
ca parameter estimation from historical time series of data
r edu
Fo
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
Ali H
by
Example (An example of a fully observed process)
a n ce
Fin
VG process X (t; σ, ν, θ) is obtained by evaluating Brownian motion
d s in with drift θ
and volatility σ at a random time given by a gamma process thoγ(t; 1, ν) with
mean rate unity and variance rate ν as l Me
n a
tio
p uta
X (t; σ, ν, θ) = θγ(t; 1, ν) + σW m (γ(t; 1, ν))
Co
i t l ed
Suppose the stock price process is given k t by the geometric VG law with
oo
parameters σ, ν, θ and the logthprice e b at time t is given by
n
do
ln St =blnaseS0 + (r − q + ω)t + X (t; σ, ν, θ)
ly,
s on
where s e
rpo
l pu 1
na ω = ln(1 − θν − σ 2 ν/2)
ca tio ν
du
re
Fo is the usual Jensen’s inequality correction ensuring that the mean rate of return
on the asset is risk neutral (r − q)
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
for variance gamma model, calling Ali H
by
a n ce
h Fin
xh = zk − (r − q)h − ln(1 − θν − σ 2 ν/2) in
ν o ds
t h
Me
where n al
i o
tat
m pu
zk = ln(S C k /Sk−1 )
o
ed
titl
h o= ok tk − tk−1
b
t he
provides the following on integrated density of stock return
a sed
b
ly, 2
2νh − 14
on 2e θxh /σ xh2 1
p
p(zk |z1:k−1 s)es= K h −1 xh2 (2σ 2 /ν + θ2 )
o h √ 2 2 2
rp ν ν 2πσΓ( νh ) 2σ /ν + θ ν 2 σ
pu
n al
io
cat where Kn (x ) is modified Bessel function of the second kind
r edu
Fo see that the dependence on the gamma distribution is
integrated out
hence, there would not be any need for filtering
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
Ali H
by
a n ce
Fin
given Θ, by filtering we can find the time seriesodsofin the hidden
state that gives the best fit over time eth
lM a
i on
tat
during filtering, the parameter set ispukept fixed over the entire
o m
time series of data ed
C
titl
k
one can repeat this procedure
oo by using different Θ for each
t heb
run and find the best
on fit for the corresponding Θ
sed a
the parameter , bset that maximizes likelihood or yields smallest
o nly
s
msre orosethe like is the optimal parameter set
urp
p
this al procedure of finding the optimal parameter is called
ti on
ca parameter estimation from historical time series of data
r edu
Fo
Calibration vs. Estimation Agenda Filtering Examples
s o80
rp ose
pu 70
n al
io
cat
60
r edu
Fo
50
40
30
50 100 150 200 250 300 350 400 450
Month
Calibration vs. Estimation Agenda Filtering Examples
s es h
e − ν t ν −1 dt
rp o h
Γ( ν )ν ν 0
pu
n al
tio = yt dt with
andcah(dt)
e du
r √
Fo dyt = κ(η − yt )dt + λ yt dWt
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
Ali H
by
a n ce
Assume the hidden state evolves according to the following Fin simple
d s in
linear model: tho
l Me
a
on
xt+1 = axt + wt+1putati
m
Co
2 t l ed
where wt+1 ∼ N (0, λ ) for some i
k t λ. Also assume the parameter
oo
bwe
set, Θ, is known. Moreover, he assume that factors at time t,
o nt
namely, xt , are given.sedNow given an observation at time t +1 we
a
want to calculate ,b
o nlythe best estimate of xt+1 , namely, x̂t+1 , that is,
s
ose
p urp
nal x̂t+1 = E (xt+1 | zt+1 )
ca tio
du
re
Fo where zt+1 is the observation at time t + 1
Calibration vs. Estimation Agenda Filtering Examples
Filtering
sa
Hir
assume model price is given by h(xt+1 ; Θ) where as earlier Ali
e by
stated Θ is the parameter set anc
n Fin
si
assumption in filtering is that the market priceod(observation)
e th
at time t + 1, zt+1 , is linked to the modelal M price via the
following relationship: a t ion
ut
mp
d Co
zt+1 = h(xt+1 e
titl ; Θ) + ut+1
ok
bo
where ut+1 ∼ N (0, nσt2h)e for some σ
do
both λ and σ, are b ase part of the parameter set Θ and therefore
ly
are already onestimated and known
oses
rp the evolution of x
knowing pu t+1 we first generate M samples for
n al
i
x .
t o
d uca t+1
re
Fo (i)
xt+1 = axt + N (0, λ2 )
for i = 1, . . . , M
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
(i)
Ali H
having M samples of xt+1 we can calculate M samples for by the
(i) a n ce
model price, namely h(xt+1 ; Θ) Fin
d s in
now we can generate M samples for ut+1 , having tho observed the
l Me
market price at time t +1: n a
tio
p uta
(i) m(i)
ut+1 = yt+1 −edh(x Co t+1 ; Θ)
t i t l
ok
define L(i) as the (conditional) e bo likelihood function
h
o nt
d
ase
b(i) (i) (i)
nly,L ≡ Likelihood ut+1 | xt+1
so
rp ose
pu (i) simply is
hence al L
ti on
ca
r edu (i) 2
Fo u
t+1
(i) e− 2σ 2
L = √
2πσ
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
Ali H
by
a n ce
Fin
in
therefore ds
tho
l Me
n a
x̂t+1 = tio )
E (xt+1 |utzat+1
PMCom (i) p
(i)
l d L × xt+1
ei=1
= ok t i t PM (i)
b o i=1 L
the
on
sed
this is the bestbaestimate of xt+1
ly,
for the next on
oses time step prediction what we just obtained is used
as atheurp
n l p best estimate of the current step and proceed
io
tsequentially
d uca
re
Fo
Calibration vs. Estimation Agenda Filtering Examples
it is obvious that it is assumed that at time step k, values of z1:k−1 are already
known
Calibration vs. Estimation Agenda Filtering Examples
Likelihood Function
irsa
Ali H
by
a n ce
Having posterior density, p(xk |z1:k ), at time tk we caninwrite Fin
s
likelihood lk od
eth M
al
Z
a t ion
t
`k = p(zk |z1:k−1 ) = p(zk |xk )p(x pu|x ,z )dxk (1)
C omk k−1 1:k−1
e d
itl
kt
and therefore the total likelihood b oo is
he
o nt
ed N
bas
X
nly, ln(L1:N ) = ln(`k )
o
oses k=1
rp
pu
n al
io
In practice, instead of trying to calculate the value of the
cat
e du
expression one uses a proxy for likelihood `k .
r
Fo
Calibration vs. Estimation Agenda Filtering Examples
Likelihood Function
irsa
Ali H
We assume the following generic models/equations for state eand by
a n c
observation: Fin
in
o ds
t h
xt+1 = f (xt , Θ, ut+1 ) al Me
o n
ti
tat+1
zt+1 = g(xt+1 , Θ, uv )
o mp
d C
itle
namely, state equation and measurement o kt equation, respectively.
e bo
Alternatively h
nt
se do
a
,b
p(zt+1o nly|xt+1 , Θ) observation density
oses
rp p(xt+1 |xt , Θ) state transition
pu
n al
io p(x0 ) initial distribution (prior)
cat
e du
r
Fo
In the case of a known parameter set we can write
p(xt |zt ) = p(xt |zt , Θ)
Calibration vs. Estimation Agenda Filtering Examples
Likelihood Function
irsa
Ali H
by
a n ce
Fin
in
o ds
t h
Me
there are 3 general approaches: n al
ti o
uta
(a) approximates the model via either o mp a linearization or by
approximate state variables dC
t itlewith a continuous distribution by a
discrete state Markovbochain; ok then apply a Kalman filter
t he
(b) numerical integration o n routines to approximate the integrals;
this could run a sedeasily into curse of dimensionality
,b
(c) MonteoCarlo, nly which leads to the particle filter
es
rp os
pu
al
ti on
ca
r edu
Fo
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
Ali H
Example (Filtering and parameter estimation of the discrete-time double by
gamma stochastic volatility model via likelihood) nce
F ina
suppose the interest rate rt prevailing over the next period ofodtime s in rate is a
t h
linear function of the factors xt , specifically. Me
n al
ti o
rt = ar + br> xt puta
o m
d C volatility model:
Assume the following discrete-time stochastic t itle
ok √
bo √
xt+1 = xt + t(b heγ − Bxt ) ∆t + Σ vt+1 ∆tzt+1
n
do 1
vt+1 ∼ b asegamma(λvt + x , )
ly, δ
o n
osesx ∼ gamma(γ, 1 )
rp
pu η
n al
ti o
ca 1
du zt+1 ∼ N (0, I) and the probability density of gamma(α, θ ) is
where
ore
F
θe −θt (θt)α−1 θα e −θt t α−1
f (t) = =
Γ(α) Γ(α)
Calibration vs. Estimation Agenda Filtering Examples
Filtering
irsa
Ali H
by
a n ce
Fin
in
o ds
t h
Me
in the filtering step, the assumption is tthat n al the parameter set,
i o
ta
Θ = {σ, γ, η, λ, δ, ar , br , bγ , B, Σ},omis pu known
dC
we also assume t-time factors t itlenamely, xt and vt , are given
ok
bo
now given observations t he at time t + 1 we wish to calculate
on
a sed
b
ly,(x̂t+1 , v̂t+1 ) = E (xt+1 , vt+1 | yt+1 )
s on
s e
rpo
l pu
a
ion
u cat
e d
r
Fo
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
Ali H
by
a n ce
assume that the model price is given by φ(xt+1 , vit+1
n ; Θ) Fin
o ds
where Θ is the parameter set et h
alM
moreover assume the market price (observation) ion at time t + 1,
u tat
p
yt+1 , is linked to the model priceCovia
m the following relationship:
d
itle
o kt
yt+1 = φ(x o , vt+1 ; Θ) + ut+1
bt+1
n the
do e 2
where ut+1 ∼, N bas(0, σ ) for some σ (the assumption is σ is
nly
part of the s oparameter set Θ and therefore already estimated
rp ose
andl pknown)
u
a
ion
u catstart by first generating M samples for xt+1 and vt+1 as
d
re follows:
Fo
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
Ali H
by
a n ce
Fin
in
o ds
t h
1 Me
x (i) ∼ gamma(γ, ) i o n al
η tat
m pu
(i) o 1
vt+1 ∼ gamma(λvt +itxle(i) d C, )
ok
t δ
bo √ 2
!
e
q
(i) t h (i)
xt+1 ∼ N d oxnt + (bγ − Bxt ) ∆t, Σ vt+1 ∆t
e
bas
nly,
so
for i =rpo1,se . . . , M
pu
al (i) (i)
ti on
having M samples of xt+1 and vt+1 we can calculate M
ca
r edu (i) (i)
Fo samples for the model price, namely, φ(xt+1 , vt+1 ; Θ)
Calibration vs. Estimation Agenda Filtering Examples
Example
Hi rsa
Ali
now we can generate M samples for ut+1 having observed the market price at
y
time t +1: b
ce an
(i) (i)
ut+1 = yt+1 − φ(xt+1 , vt+1 ; Θ)
(i) Fin
s in
d
tho
define L(i) as a (conditional) likelihood function Me
nal
tio
uta, v (i)
(i) (i) (i)
L ≡ Likelihood ut+1 |mxpt+1 t+1
o
dC
t itle
hence L(i) simply is k
b oo
n the u
(i)
2
o t+1
ed −
bas e
L(i) = √
2σ 2
nly, 2πσ
so
rp ose
therefore
pu x̂t+1 , v̂t+1 can be calculated as follows:
nal
ca tio (x̂t+1 , v̂t+1 ) = E (xt+1 , vt+1 | yt+1 )
r edu PM (i) (i)
Fo i=1
L(i) × (xt+1 , vt+1 )
= PM
i=1
L(i)
Example
irsa
Ali H
by
a n ce
Fin
in
o ds
t h
Me
n al
ti o
For parameter estimation, we start withmpsome uta parameter set
C o
e d
tl
Θ0 = {σ 0 , γ 0 , ηo0 ,okλt0i, δ 0 , bγ0 , B 0 , Σ0 , . . . }
b
he
o nt
as the prior and calculate ed the likelihood as follows:
bas
nly,
so
rp ose
pu
al
ti on
ca
du
ore
F
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
li H
for t = 0, . . . , T −1
for i = 1, . . . , M A
by
(i) 0 1
a n ce
x ∼ gamma(γ , )
η0 Fin
in
(i) 0 (i) (i) 1
o ds
vt+1 ∼ gamma(λ vt +x , ) t h
δ0
Me
on0 p al (i) √ 2
∆t,atiΣ
(i) (i) 0 0 (i)
xt+1 ∼ N xt + bγ − B xt vt+1 ∆t
t
m pu
(i) (i) (i) o
C0 )
ut+1 = yt+1 − φ(xt+1 , vt+1d; Θ
t it(ule(i) )2
ok t+1
bo e − 2σ2 (i)
η γ e −ηx (x (i) )γ−1
L(yt+1 , xt+1 , vt+1 ) the=
(i) (i)
√ ×
n
do
2πσ Γ(γ)
endfor
endfor
Calibration vs. Estimation Agenda Filtering Examples
Example
irsa
Ali H
by
a n ce
having log likelihood, can employ either the Nelder-Mead Fin
in
sparameter
simplex method or EM algorithm for estimating o d set
Meth
in the case of EM algorithm we minimize al
on the following
∗ u t ati
objective function starting from Θm0p:
Co
i t l ed
tM
−1k X
1 TXoo (i) (i)
Θ∗n+1 = min − the b log L(yt+1 , xt+1 , vt+1 , Θ|Θ∗n )
Θ onM
d t=0 i=1
ase
=nly min −E(log L(Θ|Θ∗n ))
, b
so Θ
rp ose
pu
that al
ti on is the combined E and M steps
ca ∗ ∗ ∗
r edu the optimal Θ is found until kΘn+1 − Θn k < where is a
Fo
threshold