day 1: january 19 th , day 2: january 28 th day 3: february 9 th

38
Workshop on Stochastic Differential Equations and Statistical Inference for Markov Processes Day 3: Numerical Methods for Stochastic Differential Equations Day 1: January 19 th , Day 2: January 28 th Day 3: February 9 th Lahore University of Management Sciences

Upload: freya

Post on 24-Feb-2016

35 views

Category:

Documents


0 download

DESCRIPTION

Workshop on Stochastic Differential Equations and Statistical Inference for Markov Processes Day 3: Numerical Methods for Stochastic Differential Equations. Day 1: January 19 th , Day 2: January 28 th Day 3: February 9 th Lahore University of Management Sciences. Schedule. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Workshop on Stochastic Differential Equations and Statistical Inference for Markov Processes

Day 3: Numerical Methods for Stochastic Differential Equations

Day 1: January 19th , Day 2: January 28th

Day 3: February 9th Lahore University of Management Sciences

Page 2: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Schedule

• Day 1 (Saturday 21st Jan): Review of Probability and Markov Chains

• Day 2 (Saturday 28th Jan): Theory of Stochastic Differential Equations

• Day 3 (Saturday 4th Feb): Numerical Methods for Stochastic Differential Equations

• Day 4 (Saturday 11th Feb): Statistical Inference for Markovian Processes

Page 3: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Today

• Numerical Schemes for ODE

• Numerical Evaluation of Stochastic Integrals

• Euler Maruyama Method for SDE

• Milstein and Higher Order Methods for SDE

Page 4: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS

Page 5: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Euler’s Scheme• Consider the following IVP

• Using a forward difference approximation we get

• This is called the Forward Euler Scheme

Page 6: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

A Simple Example

• Consider the IVP

• The solution to the IVP is

Page 7: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Solving the IVP by Euler’s Method• For the IVP

• The Euler Scheme is

Page 8: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th
Page 9: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Error• How to characterize the error ?

• Factors which introduce an error– Discretization– Round off

• Maximum of error over the interval

• How does the error depend on

Page 10: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Discretization Error in Forward Euler• Consider the IVP• Satisfying the conditions

• Also consider the Euler Scheme

• Then the error satisfies

Page 11: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

How Error Varies with ∆t

• Claim : We saw theoretically Euler’s Method is O(∆t) accurate

Error

1 0.718

½ 0.468

¼ 0.277

1/8 0.152

1/16 0.082

Page 12: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Stability• Consider

• The Euler Scheme is

• For the solution to die out need

• For

Page 13: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Stability of Euler Scheme• For• Discretize using Euler’s Scheme• At some stage of the solution assume a small

error is introduced• The error evolves according to

• Thus need for stability

Page 14: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Challenge

• Write a code to verify the order of accuracy of the Euler Scheme

• Experiment with different values of to explore the stability of the Euler Scheme

• Note: You may use the IVP discussed here

Page 15: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

The Weiner Process

Page 16: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Weiner Process• Recall a random variable is a Weiner Process if – – For the increment

– For the increments are independent

Page 17: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Simulating Weiner Processes

• Consider the discretization

• where and

• Also each increment is given by

Page 18: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Sample Paths for Weiner Process

Page 19: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Numerical Expectation and Variance

• Theoretically on the interval [0,t]

Page 20: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Stochastic Exponential Growth

• The Exponential Growth Model is

• Let

• Then the solution is

• Note that

Page 21: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th
Page 22: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Euler Maruyama Scheme for SDE

Page 23: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Sources of Error in Numerical Schemes

• Errors in Numerical Schemes for SDE– Discretization– Monte Carlo– Round off

• Discretization determines the order of the scheme as in the ODE case

• Also want a handle on the Monte Carlo errors

Page 24: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Some Numerical Schemes for SDE

• Euler Maruyama– Half order accurate

• Milstein – Order one accurate

• Reference: “Numerical Solution of Stochastic Differential Equations by Kloeden and Platen (Springer)”

Page 25: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Euler Maruyama Scheme• Consider an autonomous SDE

• A Simple (Euler-Maruyama) discretization is

Page 26: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

E-M Applied of Exponential Growth

• Consider

• This has the solution

• The Euler Murayama Scheme takes the form

Page 27: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

E-M Scheme for Exponential Growth

Page 28: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Strong Accuracy of E-M

• A method converges with strong order if there exists C such that

• For the Euler Maruyama Scheme the following holds

• i.e. E-M is order accurate

Page 29: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th
Page 30: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Weak Accuracy of E-M

• A method converges with weak order if there exits C such that

• For the Euler Maruyama Scheme the following holds true

Page 31: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th
Page 32: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Stochastic Oscillator

• Consider the stochastically forced oscillator

• The mean and variance are given by

Page 33: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Numerical Scheme

• We simulate the oscillator using the following scheme (Higham & Melbo)

• Note the semi implicit nature of the method

Page 34: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Mean for the Stochastic Oscillator

Page 35: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Variance for the Stochastic Oscillator

Page 36: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Challenge I

• Derive the exact mean and variance for the stochastic oscillator

• Use Euler Maruyama to simulate trajectories and calculate the mean and variance

• Show numerically that the variance blow up with decreasing for the E-M method

Page 37: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

Challenge II

• Exploring the Stochastic SIR Model

• Use the references provided on the webpage to simulate sample paths for the infected class for different parameters

• Calculate the numeric mean and variance

Page 38: Day 1: January 19 th  , Day 2: January 28 th Day 3: February 9 th

References and Credits• Kloeden. P.E & Platen.E, Numerical Solution of Stochastic

Differential Equations, Springer (1992)

• Desmond J. Higham. An Algorithmic Introduction to Numerical Simulation of Stochastic Differential Equations , SIAM Rev. 43, pp. 525-546

• Atkinson. K, Han W. & Stewart D.E, Numerical Solution of Ordinary Differential Equations, Wiley

• Many of the codes are available at Desmond Higham's webpage www.mathstat.strath.ac.uk/d.j.higham