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 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 Today • Numerical Schemes for ODE • Numerical Evaluation of Stochastic Integrals • Euler Maruyama Method for SDE • Milstein and Higher Order Methods for SDE NUMERICAL METHODS FOR ORDINARY DIFFERENTIAL EQUATIONS Euler’s Scheme • Consider the following IVP • Using a forward difference approximation we get • This is called the Forward Euler Scheme A Simple Example • Consider the IVP • The solution to the IVP is Solving the IVP by Euler’s Method • For the IVP • The Euler Scheme is 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 Discretization Error in Forward Euler • Consider the IVP • Satisfying the conditions • Also consider the Euler Scheme • Then the error satisfies How Error Varies with ∆t • Claim : We saw theoretically Euler’s Method is O(∆t) accurate Error 1 0.718 ½ ¼ 0.468 1/8 0.152 1/16 0.082 0.277 Stability • Consider • The Euler Scheme is • For the solution to die out need • For 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 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 The Weiner Process Weiner Process • Recall a random variable Process if – – For – For is a Weiner the increment the increments are independent Simulating Weiner Processes • Consider the discretization • where and • Also each increment is given by Sample Paths for Weiner Process Numerical Expectation and Variance • Theoretically on the interval [0,t] Stochastic Exponential Growth • The Exponential Growth Model is • Let • Then the solution is • Note that Euler Maruyama Scheme for SDE 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 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)” Euler Maruyama Scheme • Consider an autonomous SDE • A Simple (Euler-Maruyama) discretization is E-M Applied of Exponential Growth • Consider • This has the solution • The Euler Murayama Scheme takes the form E-M Scheme for Exponential Growth 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 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 Stochastic Oscillator • Consider the stochastically forced oscillator • The mean and variance are given by Numerical Scheme • We simulate the oscillator using the following scheme (Higham & Melbo) • Note the semi implicit nature of the method Mean for the Stochastic Oscillator Variance for the Stochastic Oscillator 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 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 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