Top Banner
Lecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University, Finland Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 1 / 30
25

Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Jun 23, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Lecture 1: Pragmatic Introduction to StochasticDifferential Equations

Simo Särkkä

Aalto University, Finland

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 1 / 30

Page 2: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Contents

1 Stochastic differential equations

2 Stochastic processes in physics and engineering

3 Heuristic solutions of linear SDEs

4 Heuristic solutions of non-linear SDEs

5 Summary

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 2 / 30

Page 3: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

What is a stochastic differential equation (SDE)?

At first, we have an ordinary differential equation (ODE):

dxdt

= f(x, t).

Then we add white noise to the right hand side:

dxdt

= f(x, t) + w(t).

Generalize a bit by adding a multiplier matrix on the right:

dxdt

= f(x, t) + L(x, t) w(t).

Now we have a stochastic differential equation (SDE).f(x, t) is the drift function and L(x, t) is the dispersion matrix.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 4 / 30

Page 4: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

White noise

White noise

1 w(t1) and w(t2) are independent ift1 6= t2.

2 t 7→ w(t) is a Gaussian process withthe mean and covariance:

E[w(t)] = 0

E[w(t) wT(s)] = δ(t − s) Q. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−3

−2

−1

0

1

2

3

Q is the spectral density of the process.The sample path t 7→ w(t) is discontinuous almost everywhere.White noise is unbounded and it takes arbitrarily large positive andnegative values at any finite interval.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 5 / 30

Page 5: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

What does a solution of SDE look like?

0 2 4 6 8 10−8

−6

−4

−2

0

2

4

6

8

Time t

β(t

)

Path of β(t)

Upper 95% QuantileLower 95% QuantileMean

02

46

810 −10

−5

0

5

10

0

0.2

0.4

0.6

0.8

1

β(t)

Time t

p(β

,t)

Left: Path of a Brownian motion which is solution to stochasticdifferential equation

dxdt

= w(t)

Right: Evolution of probability density of Brownian motion.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 6 / 30

Page 6: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

What does a solution of SDE look like? (cont.)

0 1 2 3 4 5 6 7 8 9 10−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Mean solution

95% quantiles

Realizations of SDE

Paths of stochastic spring model

d2x(t)dt2 + γ

dx(t)dt

+ ν2 x(t) = w(t).

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 7 / 30

Page 7: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Einstein’s construction of Brownian motion

︸︷︷︸

φ(∆)

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 9 / 30

Page 8: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Langevin’s construction of Brownian motion

Random forcefrom collisions Movement is slowed

down by friction

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 10 / 30

Page 9: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Noisy RC-circuit

w(t)R

C v(t)

A

B

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 11 / 30

Page 10: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Noisy Phase Locked Loop (PLL)

A sin( )

w(t)

K Loop filter

∫ t0

θ1(t) φ(t)

−θ2(t)

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 12 / 30

Page 11: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Car model for navigation

w1(t)

w2(t)

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 13 / 30

Page 12: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Noisy pendulum model

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 14 / 30

Page 13: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Smartphone orientation tracking

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 15 / 30

Page 14: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Solutions of LTI SDEs

Linear time-invariant stochastic differential equation (LTI SDE):

dx(t)dt

= F x(t) + L w(t), x(t0) ∼ N(m0,P0).

We can now take a “leap of faith” and solve this as if it was adeterministic ODE:

1 Move F x(t) to left and multiply by integrating factor exp(−F t):

exp(−F t)dx(t)

dt− exp(−F t) F x(t) = exp(−F t) L w(t).

2 Rewrite this asddt

[exp(−F t) x(t)] = exp(−F t) L w(t).

3 Integrate from t0 to t :

exp(−F t) x(t)− exp(−F t0) x(t0) =

∫ t

t0exp(−F τ) L w(τ) dτ.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 17 / 30

Page 15: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Solutions of LTI SDEs (cont.)

Rearranging then gives the solution:

x(t) = exp(F (t − t0)) x(t0) +

∫ t

t0exp(F (t − τ)) L w(τ) dτ.

We have assumed that w(t) is an ordinary function, which it is not.Here we are lucky, because for linear SDEs we get the rightsolution, but generally not.The source of the problem is the integral of a non-integrablefunction on the right hand side.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 18 / 30

Page 16: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Mean and covariance of LTI SDEs

The mean can be computed by taking expectations:

E [x(t)] = E [exp(F (t − t0)) x(t0)] + E[∫ t

t0exp(F (t − τ)) L w(τ) dτ

]

Recalling that E[x(t0)] = m0 and E[w(t)] = 0 then gives the mean

m(t) = exp(F (t − t0)) m0.

We also get the following covariance (see the exercises. . . ):

P(t) = E[(x(t)−m(t)) (x(t)−m)T

]= exp (F t) P0 exp (F t)T

+

∫ t

0exp (F (t − τ)) L Q LT exp (F (t − τ))T dτ.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 19 / 30

Page 17: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Mean and covariance of LTI SDEs (cont.)

By differentiating the mean and covariance expression we canderive the following differential equations for the mean andcovariance:

dm(t)dt

= F m(t)

dP(t)dt

= F P(t) + P(t) FT + L Q LT.

For example, let’s consider the spring model:(dx1(t)

dtdx2(t)

dt

)︸ ︷︷ ︸

dx(t)/dt

=

(0 1−ν2 −γ

)︸ ︷︷ ︸

F

(x1(t)x2(t)

)︸ ︷︷ ︸

x

+

(01

)︸︷︷︸

L

w(t).

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 20 / 30

Page 18: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Mean and covariance of LTI SDEs (cont.)

The mean and covariance equations:( dm1dt

dm2dt

)=

(0 1−ν2 −γ

)(m1m2

)( dP11

dtdP12

dtdP21

dtdP22

dt

)=

(0 1−ν2 −γ

)(P11 P12P21 P22

)+

(P11 P12P21 P22

)(0 1−ν2 −γ

)T

+

(0 00 q

)0 1 2 3 4 5 6 7 8 9 10

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Mean solution

95% quantiles

Realizations of SDE

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 21 / 30

Page 19: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Alternative derivation of mean and covariance

We can also attempt to derive mean and covariance equationsdirectly from

dx(t)dt

= F x(t) + L w(t), x(t0) ∼ N(m0,P0).

By taking expectations from both sides gives

E[

dx(t)dt

]=

d E[x(t)]

dt= E [F x(t) + L w(t)] = F E[x(t)].

This thus gives the correct mean differential equation

dm(t)dt

= F m(t)

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 22 / 30

Page 20: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Alternative derivation of mean and covariance (cont.)

For the covariance we useddt

[(x−m) (x−m)T

]=

(dxdt− dm

dt

)(x−m)T

+ (x−m)

(dxdt− dm

dt

)T

Substitute dx(t)/dt = F x(t) + L w(t) and take expectation:ddt

E[(x−m) (x−m)T

]= F E

[(x(t)−m(t)) (x(t)−m(t))T

]+ E

[(x(t)−m(t)) (x(t)−m(t))T

]FT

This implies the covariance differential equationdP(t)

dt= F P(t) + P(t) FT.

But this equation is wrong!!!Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 23 / 30

Page 21: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Alternative derivation of mean and covariance (cont.)

Our mistake was to assume

ddt

[(x−m) (x−m)T

]=

(dxdt− dm

dt

)(x−m)T

+ (x−m)

(dxdt− dm

dt

)T

However, this result from basic calculus is not valid when x(t) isstochastic.The mean equation was ok, because its derivation did not involvethe usage of chain rule (or product rule) above.But which results are right and which wrong?We need to develop a whole new calculus to deal with this. . .

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 24 / 30

Page 22: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Problem with general solutions

We could now attempt to analyze non-linear SDEs of the form

dxdt

= f(x, t) + L(x, t) w(t)

We cannot solve the deterministic case—no possibility for a “leapof faith”.We don’t know how to derive the mean and covariance equations.What we can do is to simulate by using Euler–Maruyama:

x̂(tk+1) = x̂(tk ) + f(x̂(tk ), tk ) ∆t + L(x̂(tk ), tk ) ∆βk ,

where ∆βk is a Gaussian random variable with distributionN(0,Q ∆t).Note that the variance is proportional to ∆t , not the standarddeviation.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 26 / 30

Page 23: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Problem with general solutions (cont.)

Picard–Lindelöf theorem can be useful for analyzing existenceand uniqueness of ODE solutions. Let’s try that for

dxdt

= f(x, t) + L(x, t) w(t)

The basic assumption in the theorem for the right hand side of thedifferential equation were:

Continuity in both arguments.Lipschitz continuity in the first argument.

But white noise is discontinuous everywhere!We need a new existence theory for SDE solutions as well. . .

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 27 / 30

Page 24: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Simulation of SDE in Matlab

Example (Simulation of SDE solution)

dx(t)dt

= −λ x(t) + w(t)

Matlab code snippet

dt = 0.01;lambda = 0.05;q = 1;x = 1;t = 0;for k=1:steps

fx = -lambda * x;db = sqrt(q*dt) * randn;x = x + fx * dt + db;t = t + dt;

end

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 28 / 30

Page 25: Lecture 1: Pragmatic Introduction to Stochastic …ssarkka/sde_course_2016/handout1.pdfLecture 1: Pragmatic Introduction to Stochastic Differential Equations Simo Särkkä Aalto University,

Summary

Stochastic differential equation (SDE) is an ordinary differentialequation (ODE) with a stochastic driving force.SDEs arise in various physics and engineering problems.Solutions for linear SDEs can be (heuristically) derived in thesimilar way as for deterministic ODEs.We can also compute the mean and covariance of the solutions ofa linear SDE.The heuristic treatment only works for some analysis of linearSDEs, and for e.g. non-linear equations we need a new theory.One way to approximate solution of SDE is to simulate trajectoriesfrom it using the Euler–Maruyama method.

Simo Särkkä (Aalto) Lecture 1: Pragmatic Introduction to SDEs 30 / 30