Consider the autonomousItō stochastic differential equation:
with initial condition, where denotes the Wiener process, and suppose that we wish to solve this SDE on some interval of time . Then the Milstein approximation to the true solution is the Markov chain defined as follows:
Partition the interval into equal subintervals of width :
Note that when (i.e. the diffusion term does not depend on ) this method is equivalent to the Euler–Maruyama method.
The Milstein scheme has both weak and strong order of convergence which is superior to the Euler–Maruyama method, which in turn has the same weak order of convergence but inferior strong order of convergence .[3]
Intuitive derivation
For this derivation, we will only look at geometric Brownian motion (GBM), the stochastic differential equation of which is given by:
with real constants and . Using Itō's lemma we get:
Thus, the solution to the GBM SDE is:
where
The numerical solution is presented in the graphic for three different trajectories.[4]
Computer implementation
The following Python code implements the Milstein method and uses it to solve the SDE describing geometric Brownian motion defined by
# -*- coding: utf-8 -*-# Milstein Methodimportnumpyasnpimportmatplotlib.pyplotaspltclassModel:"""Stochastic model constants."""mu=3sigma=1defdW(dt):"""Random sample normal distribution."""returnnp.random.normal(loc=0.0,scale=np.sqrt(dt))defrun_simulation():""" Return the result of one full simulation."""# One second and thousand grid pointsT_INIT=0T_END=1N=1000# Compute 1000 grid pointsDT=float(T_END-T_INIT)/NTS=np.arange(T_INIT,T_END+DT,DT)Y_INIT=1# Vectors to fillys=np.zeros(N+1)ys[0]=Y_INITforiinrange(1,TS.size):t=(i-1)*DTy=ys[i-1]dw=dW(DT)# Sum up terms as in the Milstein methodys[i]=y+ \
Model.mu*y*DT+ \
Model.sigma*y*dw+ \
(Model.sigma**2/2)*y*(dw**2-DT)returnTS,ysdefplot_simulations(num_sims:int):"""Plot several simulations in one image."""for_inrange(num_sims):plt.plot(*run_simulation())plt.xlabel("time (s)")plt.ylabel("y")plt.grid()plt.show()if__name__=="__main__":NUM_SIMS=2plot_simulations(NUM_SIMS)
^Mil’shtein, G. N. (1975). "Approximate Integration of Stochastic Differential Equations". Theory of Probability & Its Applications. 19 (3): 557–000. doi:10.1137/1119062.
^V. Mackevičius, Introduction to Stochastic Analysis, Wiley 2011
^Umberto Picchini, SDE Toolbox: simulation and estimation of stochastic differential equations with Matlab. http://sdetoolbox.sourceforge.net/
Further reading
Kloeden, P.E., & Platen, E. (1999). Numerical Solution of Stochastic Differential Equations. Springer, Berlin. ISBN3-540-54062-8.{{cite book}}: CS1 maint: multiple names: authors list (link)