snssde3d: Simulation of 3-D Stochastic Differential Equation

View source: R/snssde.R

snssde3dR Documentation

Simulation of 3-D Stochastic Differential Equation

Description

The (S3) generic function snssde3d of simulation of solutions to 3-dim stochastic differential equations of Itô or Stratonovich type, with different methods.

Usage

snssde3d(N, ...)
## Default S3 method:
snssde3d(N = 1000, M =1, x0=c(0,0,0), t0 = 0, T = 1, Dt, 
   drift, diffusion, corr = NULL, 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 'snssde3d'
summary(object, at, digits=NULL,...)
## S3 method for class 'snssde3d'
time(x, ...)
## S3 method for class 'snssde3d'
mean(x, at, ...)
## S3 method for class 'snssde3d'
Median(x, at, ...)
## S3 method for class 'snssde3d'
Mode(x, at, ...)
## S3 method for class 'snssde3d'
quantile(x, at, ...)
## S3 method for class 'snssde3d'
kurtosis(x, at, ...)
## S3 method for class 'snssde3d'
skewness(x, at, ...)
## S3 method for class 'snssde3d'
min(x, at, ...)
## S3 method for class 'snssde3d'
max(x, at, ...)
## S3 method for class 'snssde3d'
moment(x, at, ...)
## S3 method for class 'snssde3d'
cv(x, at, ...)
## S3 method for class 'snssde3d'
bconfint(x, at, ...)

## S3 method for class 'snssde3d'
plot(x, ...)
## S3 method for class 'snssde3d'
lines(x, ...)
## S3 method for class 'snssde3d'
points(x, ...)
## S3 method for class 'snssde3d'
plot3D(x, display = c("persp","rgl"), ...)

Arguments

N

number of simulation steps.

M

number of trajectories.

x0

initial value of the process X_{t}, Y_{t} and Z_{t} at time t0.

t0

initial time.

T

ending 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 four variables t, x, y and z for process X_t, Y_t and Z_t.

diffusion

diffusion coefficient: an expression of four variables t, x, y and z for process X_t, Y_t and Z_t.

corr

the correlation structure of three Brownian motions W1(t), W2(t) and W3(t); must be a real symmetric positive-definite square matrix of dimension 3.

alpha, mu

weight of the predictor-corrector scheme; the default alpha = 0.5 and mu = 0.5.

type

if type="ito" simulation sde of Itô 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 "snssde3d".

at

time between t0 and T. Monte-Carlo statistics of the solutions (X_{t},Y_{t},Z_{t}) at time at. The default at = T.

digits

integer, used for number formatting.

display

"persp" perspective or "rgl" plots.

...

potentially further arguments for (non-default) methods.

Details

The function snssde3d returns a mts x of length N+1; i.e. solution of the 3-dim sde (X_{t},Y_{t},Z_{t}) of Ito or Stratonovich types; If Dt is not specified, then the best discretization \Delta t = \frac{T-t_{0}}{N}.

The 3-dim Ito stochastic differential equation is:

dX(t) = a(t,X(t),Y(t),Z(t)) dt + b(t,X(t),Y(t),Z(t)) dW_{1}(t)

dY(t) = a(t,X(t),Y(t),Z(t)) dt + b(t,X(t),Y(t),Z(t)) dW_{2}(t)

dZ(t) = a(t,X(t),Y(t),Z(t)) dt + b(t,X(t),Y(t),Z(t)) dW_{3}(t)

3-dim Stratonovich sde :

dX(t) = a(t,X(t),Y(t),Z(t)) dt + b(t,X(t),Y(t),Z(t)) \circ dW_{1}(t)

dY(t) = a(t,X(t),Y(t),Z(t)) dt + b(t,X(t),Y(t),Z(t)) \circ dW_{2}(t)

dZ(t) = a(t,X(t),Y(t),Z(t)) dt + b(t,X(t),Y(t),Z(t)) \circ dW_{3}(t)

W_{1}(t), W_{2}(t), W_{3}(t) three standard Brownian motion independent if corr=NULL.

In the correlation case, currently we can use only the Euler-Maruyama and Milstein scheme.

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, Itô-Taylor Order 1.5, Heun Order 2 and Runge-Kutta Order 1, 2 and 3.

An overview of this package, see browseVignettes('Sim.DiffProc') for more informations.

Value

snssde3d returns an object inheriting from class "snssde3d".

X, Y, Z

an invisible mts (3-dim) object (X(t),Y(t),Z(t)).

driftx, drifty, driftz

drift coefficient of X(t), Y(t) and Z(t).

diffx, diffy, diffz

diffusion coefficient of X(t), Y(t) and Z(t).

type

type of sde.

method

the numerical method used.

Author(s)

A.C. Guidoum, K. Boukhetala.

References

Guidoum AC, Boukhetala K (2020). "Performing Parallel Monte Carlo and Moment Equations Methods for Itô and Stratonovich Stochastic Differential Systems: R Package Sim.DiffProc". Journal of Statistical Software, 96(2), 1–82. doi:10.18637/jss.v096.i02

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

snssde1d and snssde2d for 1- and 2-dim sde.

sde.sim in package "sde". simulate in package "yuima".

Examples


## Example 1: Ito sde
## dX(t) = (2*(Y(t)>0)-2*(Z(t)<=0)) dt + 0.2 * dW1(t) 
## dY(t) = -2*Y(t) dt + 0.2 * dW2(t) 
## dZ(t) = -2*Z(t) dt + 0.2 * dW3(t)        
## W1(t), W2(t) and W3(t) three independent Brownian motion
set.seed(1234)

fx <- expression(2*(y>0)-2*(z<=0) , -2*y, -2*z)
gx <- rep(expression(0.2),3)

mod3d1 <- snssde3d(x0=c(0,2,-2),drift=fx,diffusion=gx,M=500,Dt=0.003)
mod3d1
summary(mod3d1)
##
dev.new()
plot(mod3d1,type="n")
mx <- apply(mod3d1$X,1,mean)
my <- apply(mod3d1$Y,1,mean)
mz <- apply(mod3d1$Z,1,mean)
lines(time(mod3d1),mx,col=1)
lines(time(mod3d1),my,col=2)
lines(time(mod3d1),mz,col=3)
legend("topright",c(expression(E(X[t])),expression(E(Y[t])),
 expression(E(Z[t]))),lty=1,inset = .01,col=c(1,2,3),cex=0.95)
##
dev.new()
plot3D(mod3d1,display="persp") ## in space (O,X,Y,Z)

## Example 2: Stratonovich sde 
## dX(t) = Y(t)* dt  + 0.2 o dW3(t)         
## dY(t) = (4*( 1-X(t)^2 )* Y(t) - X(t))* dt + 0.2 o dW2(t)
## dZ(t) = (4*( 1-X(t)^2 )* Z(t) - X(t))* dt + 0.2 o dW3(t)
## W1(t), W2(t) and W3(t) are three correlated Brownian motions with Sigma

fx <- expression( y , (4*( 1-x^2 )* y - x), (4*( 1-x^2 )* z - x))
gx <- expression( 0.2 , 0.2, 0.2)
# correlation matrix
Sigma <-matrix(c(1,0.3,0.5,0.3,1,0.2,0.5,0.2,1),nrow=3,ncol=3) 

mod3d2 <- snssde3d(drift=fx,diffusion=gx,N=10000,T=100,type="str",corr=Sigma)
mod3d2
##
dev.new()
plot(mod3d2,pos=2)
##
dev.new()
plot(mod3d2,union = FALSE)
##
dev.new()
plot3D(mod3d2,display="persp") ## in space (O,X,Y,Z)

Sim.DiffProc documentation built on May 29, 2024, 8:09 a.m.