Learn R Programming

Sim.DiffProc (version 2.8)

snssde1d: Simulation of 1-Dim Stochastic Differential Equation

Description

The (S3) generic function snssde1d of simulation of solutions to 1-dim stochastic differential equations of Ito or Stratonovich type, with different methods.

Usage

snssde1d(N, ...)
## S3 method for class 'default':
snssde1d(N = 1000, M = 1, x0 = 0, t0 = 0, T = 1, Dt, 
   drift, diffusion, alpha = 0.5, mu = 0.5, type = c("ito", "str"), 
   method = c("euler", "milstein", "predcorr", "smilstein", "taylor", 
   "heun", "rk1", "rk2", "rk3"), ...)
						   
						   
## S3 method for class 'snssde1d':
summary(object, \dots)
## S3 method for class 'snssde1d':
time(x, \dots)
## S3 method for class 'snssde1d':
mean(x, \dots)
## S3 method for class 'snssde1d':
median(x, \dots)
## S3 method for class 'snssde1d':
quantile(x, \dots)
## S3 method for class 'snssde1d':
kurtosis(x, \dots)
## S3 method for class 'snssde1d':
skewness(x, \dots)
## S3 method for class 'snssde1d':
moment(x, order = 2, \dots)
## S3 method for class 'snssde1d':
bconfint(x, level=0.95, \dots)
## S3 method for class 'snssde1d':
plot(x, \dots)
## S3 method for class 'snssde1d':
lines(x, \dots)
## S3 method for class 'snssde1d':
points(x, \dots)

Arguments

N
number of simulation steps.
M
number of trajectories.
x0
initial value of the process at time t0.
t0
initial time.
T
final time.
Dt
time step of the simulation (discretization). If it is missing a default $\Delta t = \frac{T-t_{0}}{N}$.
drift
drift coefficient: an expression of two variables t and x.
diffusion
diffusion coefficient: an expression of two variables t and x.
alpha, mu
weight of the predictor-corrector scheme; the default alpha = 0.5 and mu = 0.5.
type
if type="ito" simulation sde of Ito type, else type="str" simulation sde of Stratonovich type; the default type="ito".
method
numerical methods of simulation, the default method = "euler".
x, object
an object inheriting from class "snssde1d".
order
order of moment.
level
the confidence level required.
...
further arguments for (non-default) methods.

Value

  • snssde1d returns an object inheriting from class "snssde1d".
  • Xan invisible ts object.
  • driftdrift coefficient.
  • diffusiondiffusion coefficient.
  • typetype of sde.
  • methodthe numerical method used.

newcommand

\CRANpkg

href

http://CRAN.R-project.org/package=#1

pkg

#1

Details

The function snssde1d returns a ts x of length N+1; i.e. solution of the sde of Ito or Stratonovich types; If Dt is not specified, then the best discretization $\Delta t = \frac{T-t_{0}}{N}$. The Ito stochastic differential equation is: $$dX(t) = a(t,X(t)) dt + b(t,X(t)) dW(t)$$ Stratonovich sde : $$dX(t) = a(t,X(t)) dt + b(t,X(t)) \circ dW(t)$$ The methods of approximation are classified according to their different properties. Mainly two criteria of optimality are used in the literature: the strong and the weak (orders of) convergence. The method of simulation can be one among: Euler-Maruyama Order 0.5, Milstein Order 1, Milstein Second-Order, Predictor-Corrector method, Ito-Taylor Order 1.5, Heun Order 2 and Runge-Kutta Order 1, 2 and 3. For more details see vignette("SDEs").

References

Friedman, A. (1975). Stochastic differential equations and applications. Volume 1, ACADEMIC PRESS. Henderson, D. and Plaschko,P. (2006). Stochastic differential equations in science and engineering. World Scientific. Allen, E. (2007). Modeling with Ito stochastic differential equations. Springer-Verlag. Jedrzejewski, F. (2009). Modeles aleatoires et physique probabiliste. Springer-Verlag. Iacus, S.M. (2008). Simulation and inference for stochastic differential equations: with R examples. Springer-Verlag, New York. Kloeden, P.E, and Platen, E. (1989). A survey of numerical methods for stochastic differential equations. Stochastic Hydrology and Hydraulics, 3, 155--178. Kloeden, P.E, and Platen, E. (1991a). Relations between multiple ito and stratonovich integrals. Stochastic Analysis and Applications, 9(3), 311--321. Kloeden, P.E, and Platen, E. (1991b). Stratonovich and ito stochastic taylor expansions. Mathematische Nachrichten, 151, 33--50. Kloeden, P.E, and Platen, E. (1995). Numerical Solution of Stochastic Differential Equations. Springer-Verlag, New York. Oksendal, B. (2000). Stochastic Differential Equations: An Introduction with Applications. 5th edn. Springer-Verlag, Berlin. Platen, E. (1980). Weak convergence of approximations of ito integral equations. Z Angew Math Mech. 60, 609--614. Platen, E. and Bruti-Liberati, N. (2010). Numerical Solution of Stochastic Differential Equations with Jumps in Finance. Springer-Verlag, New York Saito, Y, and Mitsui, T. (1993). Simulation of Stochastic Differential Equations. The Annals of the Institute of Statistical Mathematics, 3, 419--432.

See Also

snssde2d and snssde3d for 2 and 3-dim sde. sde.sim in package sde. simulate in package yuima.

Examples

Run this code
## Example 1: Ito sde
## dX(t) = 2*(3-X(t)) dt + 2*X(t) dW(t)

f <- expression(2*(3-x) )
g <- expression(2*x)
res <- snssde1d(drift=f,diffusion=g,M=50,x0=1,N=1000)
res
## Sim <- res$X
summary(res)
plot(res,plot.type="single")
lines(time(res),mean(res),col=2,lwd=2)
lines(time(res),bconfint(res,level=0.95)[,1],col=4,lwd=2)
lines(time(res),bconfint(res,level=0.95)[,2],col=4,lwd=2)
legend("topleft",c("mean path",paste("bound of", 95,"percent confidence")),
       inset = .01,col=c(2,4),lwd=2,cex=0.8)

## Example 2: Stratonovich sde
## dX(t) = ((2-X(t))/(2-t)) dt + X(t) o dW(t)

f <- expression((2-x)/(2-t))
g <- expression(x)
res1 <- snssde1d(type="str",drift=f,diffusion=g,M=50,x0=1,N=1000,
                 method="milstein")
res1
summary(res1)
plot(res1,plot.type="single")
lines(time(res1),mean(res1),col=2,lwd=2)
lines(time(res1),bconfint(res1,level=0.95)[,1],col=4,lwd=2)
lines(time(res1),bconfint(res1,level=0.95)[,2],col=4,lwd=2)
legend("topleft",c("mean path",paste("bound of", 95,"percent confidence")),
       inset = .01,col=c(2,4),lwd=2,cex=0.8)

Run the code above in your browser using DataLab