an introduction to using sdes - ucl computer science · an introduction to using sdes l.m.harrison....
TRANSCRIPT
![Page 1: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/1.jpg)
An introduction to using SDEs
L.M.Harrison
![Page 2: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/2.jpg)
Outline
• Ito-Taylor expansion• Basic numerical schemes & convergence• Parameter estimation• Filtering• Local linearization
• Next meeting – Valdes Sosa (1999) paper
![Page 3: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/3.jpg)
Resources
• Kloeden & Platen• “An algorithmic introduction to numerical
simulation of SDEs” by Higham• “MAPLE and MATLAB for SDEs in finance” by
Higham & Kloeden• Jimenez. 1999 J. of Stat. Phys. Vol 94• Ozaki. 1992 Statistica Sinica 2 pp113-135• Ghahramani & Hinton. 1996 Technical report
CRG-TR-96-2
![Page 4: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/4.jpg)
Weiner process
• Properties
• Update equation0)))(((
~)(,0)(
1234
2
=!!
=
tttt
tt
WWWWE
tWEWE
T = 1; N = 500; dt = T/N; dW = sqrt(dt)*randn(1,N); % increments W = cumsum(dW); % cumulative sum plot([0:dt:T],[0,W],'r-') % plot W against t
0),1,0(~,0111=+=
+++ tttttWNtdWdWWW
nnnn
!
Normally distributed
Independent incrementsTtttt !<<<!
43210
![Page 5: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/5.jpg)
Weiner process
• Properties
• Update equation
0),1,0(~,0111=+=
+++ tttttWNtdWdWWW
nnnn
!
T = 1; N = 500; dt = T/N; dW = sqrt(dt)*randn(1,N); % increments W = cumsum(dW); % cumulative sum plot([0:dt:T],[0,W],'r-') % plot W against t
0)))(((
~)(,0)(
1234
2
=!!
=
tttt
tt
WWWWE
tWEWE Normally distributed
Independent incrementsTtttt !<<<!
43210
![Page 6: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/6.jpg)
Sample path of a Weiner process
![Page 7: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/7.jpg)
Scalar SDEs
• Integral form
• Differential form (symbolic)
!! ++=
t
t
ss
t
t
sttdWXbdsXaXX
00
0)()(
Stochastic integral
ttttdWXbdtXadX )()( +=
![Page 8: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/8.jpg)
Stochastic integrals
• Ito
• Stratonovich
)()()(1
1
00
nn tt
N
n
n
T
sWWthdWth !"
+#$!
=
)()()(1
1
02
1
0
nn tt
N
n
nt
nt
T
sWWhdWth !"
+#$!
=
++
![Page 9: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/9.jpg)
Example of difference
!"#
$%& '() TWdWW
T
T
ss
2
2
1
0
2
2
1
0
T
T
ssWdWW !"
• Ito
• Stratonovich
Additional term
Same as classicalcalculus
![Page 10: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/10.jpg)
Ito’s formula
• Function of SDE solution
• Ito’s formula
• Partial differential operators
xbL
xb
xa
tL
!
!=
!
!+
!
!+
!
!=
1
2
2
2
2
10
ttttttdWXbdtXadXXVV )()(),( +==
Additional termc.f. classical calculus
ttttdWXtVLdtXtVLdV ),(),( 10
+=
![Page 11: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/11.jpg)
Ito’s formula
• Ito stochastic integral equation
!! ++=
t
t
ss
t
t
sttdWXsVLdsXsVLVV
00
0),(),( 10
![Page 12: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/12.jpg)
Ito’s formula
• Ito stochastic integral equation
!! ++=
t
t
ss
t
t
sttdWXsVLdsXsVLVV
00
0),(),( 10
Stochastic integral
![Page 13: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/13.jpg)
Ito’s formula
• Ito stochastic integral equation
!! ++=
t
t
ss
t
t
sttdWXsVLdsXsVLVV
00
0),(),( 10
Stochastic integralCoefficient functions
![Page 14: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/14.jpg)
Ito’s formula - example
• SDE
• Change of variabletttt
dWXdtXdX !" +#= )(
XXV =)(
![Page 15: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/15.jpg)
Ito’s formula - example
• SDE
• Change of variable
• Ito’s formula
( )t
VVt
tttt
dWdtdV
Xx
VX
x
V
t
V
dWXVLdtXVLdV
!!"
2
1
2
1
8
24
2
3
4
1
2
2
2
1
2
1
10
,,0
)()(
+=
#=$
$=
$
$=
$
$
+=
##
##
ttttdWXdtXdX !" +#= )(
XXV =)(
![Page 16: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/16.jpg)
Higham’s code - chain.m
alpha = 2; beta = 1; T = 1; N = 200; dt = T/N; % Problem parameters Xzero = 1; Xzero2 = sqrt(Xzero); % Dt = dt; % EM steps of size Dt = dt Xem1 = zeros(1,N); Xem2 = zeros(1,N); % preallocate for efficiency Xtemp1 = Xzero; Xtemp2 = Xzero2; for j = 1:N Winc = sqrt(dt)*randn; f1 = (alpha-Xtemp1); g1 = beta*sqrt(abs(Xtemp1)); Xtemp1 = Xtemp1 + Dt*f1 + Winc*g1; Xem1(j) = Xtemp1; f2 = (4*alpha-beta^2)/(8*Xtemp2) - Xtemp2/2; g2 = beta/2; Xtemp2 = Xtemp2 + Dt*f2 + Winc*g2; Xem2(j) = Xtemp2; end
plot([0:Dt:T],[sqrt([Xzero,abs(Xem1)])],'b-',[0:Dt:T],[Xzero,Xem2],'ro')
ttttdWXdtXdX !" +#= )(
![Page 17: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/17.jpg)
Higham’s code - chain.m
alpha = 2; beta = 1; T = 1; N = 200; dt = T/N; % Problem parameters Xzero = 1; Xzero2 = sqrt(Xzero); % Dt = dt; % EM steps of size Dt = dt Xem1 = zeros(1,N); Xem2 = zeros(1,N); % preallocate for efficiency Xtemp1 = Xzero; Xtemp2 = Xzero2; for j = 1:N Winc = sqrt(dt)*randn; f1 = (alpha-Xtemp1); g1 = beta*sqrt(abs(Xtemp1)); Xtemp1 = Xtemp1 + Dt*f1 + Winc*g1; Xem1(j) = Xtemp1; f2 = (4*alpha-beta^2)/(8*Xtemp2) - Xtemp2/2; g2 = beta/2; Xtemp2 = Xtemp2 + Dt*f2 + Winc*g2; Xem2(j) = Xtemp2; end
plot([0:Dt:T],[sqrt([Xzero,abs(Xem1)])],'b-',[0:Dt:T],[Xzero,Xem2],'ro')
( )t
VVt
dWdtdV !!"
2
1
2
1
8
24 += #
#
![Page 18: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/18.jpg)
Higham’s code - chain.m
alpha = 2; beta = 1; T = 1; N = 200; dt = T/N; % Problem parameters Xzero = 1; Xzero2 = sqrt(Xzero); % Dt = dt; % EM steps of size Dt = dt Xem1 = zeros(1,N); Xem2 = zeros(1,N); % preallocate for efficiency Xtemp1 = Xzero; Xtemp2 = Xzero2; for j = 1:N Winc = sqrt(dt)*randn; f1 = (alpha-Xtemp1); g1 = beta*sqrt(abs(Xtemp1)); Xtemp1 = Xtemp1 + Dt*f1 + Winc*g1; Xem1(j) = Xtemp1; f2 = (4*alpha-beta^2)/(8*Xtemp2) - Xtemp2/2; g2 = beta/2; Xtemp2 = Xtemp2 + Dt*f2 + Winc*g2; Xem2(j) = Xtemp2; end
plot([0:Dt:T],[sqrt([Xzero,abs(Xem1)])],'b-',[0:Dt:T],[Xzero,Xem2],'ro')
ttXXV =)(
tV
![Page 19: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/19.jpg)
Compare V(t) using dX & dV
![Page 20: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/20.jpg)
Ito-Taylor expansion
• Iterated application of Ito’s formula
• Generalization of Taylor expansion
• Convenient notation– Coefficient functions & stochastic integrals
(Kloeden & Platen ch. 5)
![Page 21: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/21.jpg)
Ito-Taylor expansion
• SDE
• Ito-Taylor expansion
!! ++=
t
t
ss
t
t
sttdWXbdsXaXX
00
0)()(
!"#
=k
tttk XtfItX$
$$ ,0 00)],([)(
Series (hierarchy) of stochastic integrals
![Page 22: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/22.jpg)
Ito-Taylor expansion
• SDE
• Ito-Taylor expansion
!"#
=k
tttk XtfItX$
$$ ,0 00)],([)(
Stochastic integrals
Coefficient functions
Hierarchical set
!! ++=
t
t
ss
t
t
sttdWXbdsXaXX
00
0)()(
![Page 23: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/23.jpg)
Truncated expansion
• SDE
• e.g.
)1,1()1,1()0,1()0,1()1,0()1,0()0,0()0,0(
)1()1()0()0( ...0
IfIfIfIf
IfIfXX tt
+++
+++=
!! ++=
t
t
ss
t
t
sttdWXbdsXaXX
00
0)()(
![Page 24: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/24.jpg)
Coefficient functions
• Differential operators
• e.g.
xbL
xb
xa
tL
!
!=
!
!+
!
!+
!
!=
1
2
2
2
2
10,
bbidLLfabidLLf
bbbaidLLfabaaidLLf
xx
xx
′==′==
′′+′==′′+′==
11)1,1(
01)0,1(
22110
)1,0(2
2100
)0,0(
,
,
bidLfaidLf
xidxtf
xx
x
====
==
1
)1(
0
)0( ,
),(
![Page 25: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/25.jpg)
Coefficient functions
Euler-Maruyama
• Differential operators
• e.g.
xbL
xb
xa
tL
!
!=
!
!+
!
!+
!
!=
1
2
2
2
2
10,
MilsteinbbidLLfabidLLf
bbbaidLLfabaaidLLf
xx
xx
′==′==
′′+′==′′+′==
11)1,1(
01)0,1(
22110
)1,0(2
2100
)0,0(
,
,
bidLfaidLf
xidxtf
xx
x
====
==
1
)1(
0
)0( ,
),(
![Page 26: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/26.jpg)
Stochastic integrals
• Examples
( ){ }nn
t
t
tn
t
t
t
t
t
s
ntt
t
t
s
nnn
t
t
WdWWdWdWI
WWWdWI
ttdsI
n
n
n
n n
nn
n
n
n
n
!"!=!=##
$
%
&&
'
(=
!="==
!="==
)) )
)
)
++
+
+
+
+
2
)1,1(
)1(
1)0(
2
111
1
1
1
![Page 27: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/27.jpg)
Stochastic integrals
• Examples
( ){ }nn
t
t
tn
t
t
t
t
t
s
ntt
t
t
s
nnn
t
t
WdWWdWdWI
WWWdWI
ttdsI
n
n
n
n n
nn
n
n
n
n
!"!=!=##
$
%
&&
'
(=
!="==
!="==
)) )
)
)
++
+
+
+
+
2
)1,1(
)1(
1)0(
2
111
1
1
1 Euler-Maruyama
Milstein
![Page 28: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/28.jpg)
Basic numerical schemes &convergence
• Schemes based on truncated Ito-Taylorexpansion– Euler-Maruyama– Milstein
![Page 29: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/29.jpg)
SDE schemes – truncated Ito-Taylor expansion
)1,1()1,1()1()1()0()0(0IfIfIfXX tt +++=
Euler-Maruyama
Milstein
Order 0.5, 1 strong, weak convergence resp.
Order 1, 1 strong, weak convergence resp.
![Page 30: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/30.jpg)
Euler-Maruyama
• SDE
• Truncated Ito-Taylor expansion
• Update equation
))()()(()( 11 nntttttWtWXbtXaXX
nnnn
!+"+= ++
{ })1(),0(,,)1()1()0()0(0!" =++= IfIfXX tt
TtdWXbdsXaXX
t
t
ss
t
t
stt!!++= "" 0,)()(
00
0
![Page 31: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/31.jpg)
Euler-Maruyama
• SDE
• Truncated Ito-Taylor expansion
• Update equation
))()()(()( 11 nntttttWtWXbtXaXX
nnnn
!+"+= ++
{ })1(),0(,,)1()1()0()0(0!" =++= IfIfXX tt
TtdWXbdsXaXX
t
t
ss
t
t
stt!!++= "" 0,)()(
00
0
Hierarchical set
![Page 32: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/32.jpg)
Higham’s code – em.m
ntntttWXXXX
nnnn
!+!+=+
µ"1
ttttdWXdtXdX µ! +=
lambda = 2; mu = 1; Xzero = 1; % problem parameters T = 1; N = 2^8; dt = T/N; dW = sqrt(dt)*randn(1,N); % Brownian increments W = cumsum(dW); % discretized Brownian path Xtrue = Xzero*exp((lambda-0.5*mu^2)*([dt:dt:T])+mu*W); R = 4; Dt = R*dt; L = N/R; % L EM steps of size Dt = R*dt Xem = zeros(1,L); % preallocate for efficiency Xtemp = Xzero; for j = 1:L Winc = sum(dW(R*(j-1)+1:R*j)); Xtemp = Xtemp + Dt*lambda*Xtemp + mu*Xtemp*Winc; Xem(j) = Xtemp; end
Approximate
!+1n
n
t
t
sdW
![Page 33: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/33.jpg)
Higham’s code – em.m
ntntttWXXXX
nnnn
!+!+=+
µ"1
ttttdWXdtXdX µ! +=
lambda = 2; mu = 1; Xzero = 1; % problem parameters T = 1; N = 2^8; dt = T/N; dW = sqrt(dt)*randn(1,N); % Brownian increments W = cumsum(dW); % discretized Brownian path Xtrue = Xzero*exp((lambda-0.5*mu^2)*([dt:dt:T])+mu*W); R = 4; Dt = R*dt; L = N/R; % L EM steps of size Dt = R*dt Xem = zeros(1,L); % preallocate for efficiency Xtemp = Xzero; for j = 1:L Winc = sum(dW(R*(j-1)+1:R*j)); Xtemp = Xtemp + Dt*lambda*Xtemp + mu*Xtemp*Winc; Xem(j) = Xtemp; end
Exact solution ))exp(( 2
2
1
0 tttWtXX µµ! +"=
![Page 34: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/34.jpg)
Exact solution• SDE
• Transformation
• Ito’s formula
• Solution
ttttdWXdtXdX µ! +=
XV ln=
( )tt
tt
WtXX
dWdtdV
Xx
VX
x
V
t
V
µµ!
µµ!
+"=
+"=
"=#
#=
#
#=
#
# ""
)(exp
)(
,,0
2
2
1
0
2
2
1
2
2
21
ttttdWXVLdtXVLdV )()( 10
+=
![Page 35: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/35.jpg)
Compare exact with numericalntnttt
WXXXXnnnn
!+!+=+
µ"1
![Page 36: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/36.jpg)
Convergence
![Page 37: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/37.jpg)
Strong convergence of truncatedIto-Taylor expansion
• Pathwise criteria
( ) ],0[,)( TtntCXXEnnn
!"="#$ %% &
( )
tqCe
tCe
TtLTXXEe
strong
t
strong
t
L
strong
t
!+=
!"
=!#=
!
!
!
logloglog
,)(:
$
Error @end point
!"qestimate
Measures rate of decay of “mean of the error” as
![Page 38: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/38.jpg)
Higham’s code – emstrong.m
lambda = 2; mu = 1; Xzero = 1; % problem parameters T = 1; N = 2^9; dt = T/N; % M = 1000; % number of paths sampled Xerr = zeros(M,5); % preallocate array for s = 1:M, % sample over discrete Brownian paths dW = sqrt(dt)*randn(1,N); % Brownian increments W = cumsum(dW); % discrete Brownian path Xtrue = Xzero*exp((lambda-0.5*mu^2)+mu*W(end)); for p = 1:5 R = 2^(p-1); Dt = R*dt; L = N/R; % L Euler steps of size Dt = R*dt Xtemp = Xzero; for j = 1:L Winc = sum(dW(R*(j-1)+1:R*j)); Xtemp = Xtemp + Dt*lambda*Xtemp + mu*Xtemp*Winc; end Xerr(s,p) = abs(Xtemp - Xtrue); % store the error at t = 1 end end
Variablestep size
Approximate
!+1n
n
t
t
sdW
ttttdWXdtXdX µ! +=
![Page 39: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/39.jpg)
Weak convergence of truncatedIto-Taylor expansion
• statistical criteria],0[,)))((())(( TtntCXpEXpE nnn !"="#$ %% &
tqCe
tCe
TtLTXEXEe
weak
t
weak
t
L
weak
t
!+=
!"
=!#=
!
!
!
logloglog
,))(()(:
$
Error @end point
!"qestimate
Measures rate of decay of “error of the means” as
![Page 40: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/40.jpg)
Higham’s code – emweak.m
lambda = 2; mu = 0.1; Xzero = 1; T = 1; % problem parameters M = 50000; % number of paths sampled Xem = zeros(5,1); % preallocate arrays for p = 1:5 % take various Euler timesteps Dt = 2^(p-10); L = T/Dt; % L Euler steps of size Dt Xtemp = Xzero*ones(M,1); for j = 1:L Winc = sqrt(Dt)*randn(M,1); Xtemp = Xtemp + Dt*lambda*Xtemp + mu*Xtemp.*Winc; end Xem(p) = mean(Xtemp); end Xerr = abs(Xem - exp(lambda));
Note: can use two point random variable to generate random numbers for weakconvergence (see Higham p.13)
ttttdWXdtXdX µ! +=
![Page 41: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/41.jpg)
Milstein
( ) ))()()(()(
...))()()(()(
2
12
1
11
ttWtWXbXb
tWtWXbtXaXX
nntxt
nntttt
nn
nnnn
!""
+"+!+=
+#
#
++
{ })1,1(),1(),0(,,)1,1()1,1()1()1()0()0(0!" =+++= IfIfIfXX tt
TtdWXbdsXaXX
t
t
ss
t
t
stt!!++= "" 0,)()(
00
0
• Integral form
• Truncated Ito-Taylor expansion
• Update equation
![Page 42: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/42.jpg)
Milstein
( ) ))()()(()(
...))()()(()(
2
12
1
11
ttWtWXbXb
tWtWXbtXaXX
nntxt
nntttt
nn
nnnn
!""
+"+!+=
+#
#
++
{ })1,1(),1(),0(,,)1,1()1,1()1()1()0()0(0!" =+++= IfIfIfXX tt
TtdWXbdsXaXX
t
t
ss
t
t
stt!!++= "" 0,)()(
00
0
• Integral form
• Truncated Ito-Taylor expansion
• Update equation
double stochastic integral
Hierarchical set
![Page 43: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/43.jpg)
Higham’s code – milstrong.m
tttttdWXdtXKrXdX !+"= )(
r = 2; K = 1; beta = 0.25; Xzero = 0.5; % problem parameters T = 1; N = 2^(11); dt = T/N; % M = 500; % number of paths sampled R = [1; 16; 32; 64; 128]; % Milstein stepsizes are R*dt dW = sqrt(dt)*randn(M,N); % Brownian increments Xmil = zeros(M,5); % preallocate array for p = 1:5 Dt = R(p)*dt; L = N/R(p); % L timesteps of size Dt = R dt Xtemp = Xzero*ones(M,1); for j = 1:L Winc = sum(dW(:,R(p)*(j-1)+1:R(p)*j),2); Xtemp = Xtemp + Dt*r*Xtemp.*(K-Xtemp) + beta*Xtemp.*Winc ... + 0.5*beta^2*Xtemp.*(Winc.^2 - Dt); end Xmil(:,p) = Xtemp; % store Milstein solution at t =1 end
( ){ }nntntntttt
WXWXXKrXXXnnnnnn
!"!+!+!"+=+
22
2
1)(
1##
![Page 44: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/44.jpg)
Linear SDEs
• Moment equations• Parameter estimation• Filtering
![Page 45: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/45.jpg)
Mean, variance & auto-covariance
• Scalar SDE
• Exact solution (using integrating factor)
( )
!
!
""+"=
="
=
t
st
t
st
tt
dWstabXatX
dWasbXXat
dWatbXatdt
d
0
0
0
0
)(exp()exp(
)exp()exp(
)exp()exp(
tttbdWdtaXdX +!=
![Page 46: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/46.jpg)
( )
a
bXE
ata
bmXE
t
tt
2))((
)2exp(12
))((
22
22
=
!!=!
Mean, variance & auto-covariance
• Mean
• Auto-covariance
• Variance
• Stationary variance
ttmXatXE =!= 0)exp()(
( ))2(exp()exp(2
))22(exp()))(((
2
0
2
staasa
b
tdtstabmXmXE
t
ststtt
+!!!=
""!+!=!! #++
![Page 47: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/47.jpg)
Alternatively …
• SDE
• 1st and 2nd moments
• Using result from next slide
( ))2exp(12
2
)exp(
22
0
ata
bPbaP
dt
dP
matmamdt
dm
t
t
!!="+!=
!="!=
tttbdWdtaXdX +!=
![Page 48: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/48.jpg)
… 2nd moment
• Transformation
• Expectation
22 baP
dt
dP
UP
+!=
=
bXdWdtbaXdU
bXULbaXUL
x
Ux
x
U
t
U
UdWLUdtLdU
XxtU
t
t
2)2(
2,2
2,2,0
),(
22
1220
2
2
10
2
++!=
=+!=
="
"=
"
"=
"
"
+=
=
Expectation iszero
Solve usingintegrating
factor
![Page 49: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/49.jpg)
Parameter estimation
• With or without observation noise i.e. nofiltering
• Use transition probability density tocompute likelihood of data points
• Maximize likelihood
![Page 50: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/50.jpg)
Transition probability density
• Density
• Mean
• Variance
!!"
#$$%
& ''=+
'
s
ss
V
mXVtXstXp
2
)(exp)2(),|,(
2
22/1
12 (
( ))2exp(12
)exp(
2
1
asa
bV
Xasm
s
s
!!=
!=
![Page 51: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/51.jpg)
Log-likelihood
)(log)2log())exp((
2
1
)(log)|(log})({log
01
1
1
01
1
2
1
t
N
i
t
t
tt
t
N
i
tt
XpVV
XtaX
XpXXpXp
i
i
ii
ii
+!!"
#
$$%
&+
'(((=
+=
)
)
=
=
(
(
(
(
*
Initialdistribution
Transition probabilitydensity
!=
"=
N
i
tt iiXXpXpXp
1
0 )|()(})({1
![Page 52: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/52.jpg)
Filtering
• Observation noise• 2 level model• Update equations for conditional moments• Kalman gain
![Page 53: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/53.jpg)
Filtering
• Discretized state and observation equations
• Can include inputs (see Ghahramani &Hinton 1996)
),0(~,
),0(~,1
RNvvCxy
QNwwAxx
tttt
tttt
+=
+=+Hidden states
Observed data
ttttwBuAxx ++=+1
p
t
k
t
y
x
!"
!"
![Page 54: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/54.jpg)
Filtering: joint likelihood
!"
#$%
&'''=
!"
#$%
&'''=
''
'
''
''
'
''+
)()(2
1exp)2()|(
)()(2
1exp)2()|(
1
1
1
2/12/
1
1
1
2/12/
1
tt
T
tt
p
tt
tt
T
tt
k
tt
CxyRCxyRxyp
AxxQAxxQxxp
(
(
! != =
+=N
t
N
t
tttt xypxxpxpyxp0 0
10 )|()|()(}){},({
![Page 55: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/55.jpg)
Conditional moments
• Update equations
• where
( )11
11
111
1
1
1
1
1
1
)(
!!
!!
!!!
!
!
!
!
!
!
!=
!+=
+=
+=
=
t
tt
t
t
t
t
t
ttt
t
t
t
t
Tt
t
Tt
tt
Tt
t
t
t
t
t
t
t
CVKVV
CxyKxx
RCCVCVK
QAAVV
Axx
)}{|(),}{|( 11
!!!!yxVarVyxEx tttt ==
![Page 56: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/56.jpg)
Nonlinear SDEs
• Local linearization (Ozaki 1992)– Ito-Taylor expansion– Analytic solution– Ito-integral– Discretized equation
• Uses– Simulation– Parameter estimation– Filtering
![Page 57: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/57.jpg)
Nonlinear SDEs
• Local linearization (Ozaki 1992)– Ito-Taylor expansion– Analytic solution– Ito-integral– Discretized equation
• Uses– Simulation– Parameter estimation– Filtering
![Page 58: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/58.jpg)
Local linearization for deterministicdynamics – basic intuition
))(()1)(exp()()(
))(()1)(exp()()()(
))(()exp()()exp()(
)(
))((
1
1
0
)(
txftJJtxttx
txftJJtxttxdtx
txfJtxJtx
xJx
x
xfJ
txfx
tt
tt
t
tt
t
txx
t
!"+="+
!"=!"+=+
==+
=
#
#=
=
!
!
"
=
$ %%
%%%
&
&&
&&&
&
Value of x @ t+dt asfunction of x @ t
![Page 59: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/59.jpg)
Discretization
• Nonlinear SDE
• Discretized update equation
);,();,(
))(,()(
1hXthXtXX
gdwdttxtftdx
nnnn tntntt !+"+=
+=
+
nnnnttttwBuAxx ++=
+1
Increment term
Noise term
c.f.
![Page 60: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/60.jpg)
Ito-Taylor expansion – f(s,x(s))and x(s)
• wherexxxxt
s
t
s
t
s
t
s
t
gffLfgffffL
udwgduftxsx
udwtxtfLdutxtfLtxtfsxsf
gdwdttxtftdx
=++=
++!
++!
+=
""
""
12
2
10
10
,
)()()(
)())(,())(,())(,())(,(
))(,()(
![Page 61: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/61.jpg)
Re-arrange
( )
( )
( )
( ) xftsfgffsta
ftA
sgdwdsstasXtAsdX
txsxftsfgftxtf
udwgduffdufgftxtfsxsf
xxxt
x
xxxt
s
t
s
t
x
s
t
xxt
!!++=
=
++"
!+!++"
##$
%&&'
(++++" )))
)(),(
)(
)(),()()()(
))()(()())(,(
)())(,())(,(
2
2
1
2
2
1
2
2
1
)(, tXt
Evaluated @
![Page 62: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/62.jpg)
Exact solution
• Linear SDE
• Exact solution
!!"
#$$%
&''+''+
(=+
) )+ +ht
t
ht
t
udWugtutAdutuatutAtX
htAhtX
)()))((exp(),()))((exp()(
))(exp()(
( ) ttt dWtgdttaXtAdX )()()( ++=
![Page 63: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/63.jpg)
Re-write
• Using (see Jimenez 1999)
( )
( ) ( )( )
( ) !=
"#
$%&
'+(
+=)
+)+=+
a
n
n
xxt
tntntt
duuMuaMr
fgfhtArhtAhr
tXtfhtArhtXt
hXthXtXXnnnn
0
2
10
0
)exp(,
2
1),(),(
...))(,(),());(,(
);,();,(1
*
![Page 64: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/64.jpg)
Approximate noise
• Substitute Gaussian noise term
• Substitute into discretized update equation
( )))(2exp(1)(2
),0(~
));(,(
2
htAtA
g
N
htXt
t
t
!="
"
#
$
$$
%$
nnnntttt
XX !+"+=+1
![Page 65: An introduction to using SDEs - UCL Computer Science · An introduction to using SDEs L.M.Harrison. Outline •Ito-Taylor expansion •Basic numerical schemes & convergence •Parameter](https://reader034.vdocument.in/reader034/viewer/2022042321/5f0b7c867e708231d430c200/html5/thumbnails/65.jpg)
Summary
• Ito-Taylor expansion• Basic numerical schemes & convergence• Parameter estimation• Filtering• Local linearization
• Next meeting – Valdes Sosa (1999) paper
If you notice any typos (or mistakes!) please email [email protected]