Last data update: 2014.03.03

R: Simulation of 3-Dim Diffusion Bridge
bridgesde3dR Documentation

Simulation of 3-Dim Diffusion Bridge

Description

The (S3) generic function bridgesde3d for simulation of 3-dim diffusion bridge.

Usage

bridgesde3d(N, ...)
## Default S3 method:
bridgesde3d(N=1000,M=1, x0=c(0,0, 0), y=c(1,-1, 2), 
   t0 = 0, T = 1, Dt, driftx, diffx, drifty, diffy, driftz, diffz, 
   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 'bridgesde3d'
time(x, ...)
## S3 method for class 'bridgesde3d'
mean(x, ...)
## S3 method for class 'bridgesde3d'
median(x, ...)
## S3 method for class 'bridgesde3d'
quantile(x, ...)
## S3 method for class 'bridgesde3d'
kurtosis(x, ...)
## S3 method for class 'bridgesde3d'
skewness(x, ...)
## S3 method for class 'bridgesde3d'
moment(x, order = 2, ...)
## S3 method for class 'bridgesde3d'
bconfint(x, level=0.95, ...)
## S3 method for class 'bridgesde3d'
plot(x, ...)
## S3 method for class 'bridgesde3d'
lines(x, ...)
## S3 method for class 'bridgesde3d'
points(x, ...)	
## S3 method for class 'bridgesde3d'
plot3D(x, display = c("persp","rgl"), ...)						  

Arguments

N

number of simulation steps.

M

number of trajectories.

x0

initial value (numeric vector of length 3) of the process X(t), Y(t) and Z(t) at time t0.

y

terminal value (numeric vector of length 3) of the process X(t), Y(t) and Z(t) at time T.

t0

initial time.

T

final time.

Dt

time step of the simulation (discretization). If it is missing a default Dt = (T-t0)/N.

driftx

drift coefficient: an expression of four variables t, x, y and z for process X(t).

diffx

diffusion coefficient: an expression of four variables t, x, y and z for process X(t).

drifty

drift coefficient: an expression of four variables t, x, y and z for process Y(t).

diffy

diffusion coefficient: an expression of four variables t, x, y and z for process Y(t).

driftz

drift coefficient: an expression of four variables t, x, y and z for process Z(t).

diffz

diffusion coefficient: an expression of four variables t, x, y and z for process Z(t).

alpha

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

mu

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

type

if type="ito" simulation diffusion bridge of Ito type, else type="str" simulation diffusion bridge of Stratonovich type; the default type="ito".

method

numerical methods of simulation, the default method = "euler"; see snssde3d.

x

an object inheriting from class "bridgesde3d".

order

order of moment.

level

the confidence level required.

display

"persp" perspective or "rgl" plots.

...

further arguments for (non-default) methods.

Details

The function bridgesde3d returns a mts of the diffusion bridge starting at x at time t0 and ending at y at time 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").

Value

bridgesde3d returns an object inheriting from class "bridgesde3d".

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).

Cx, Cy, Cz

numbre of crossing realized of X(t) (Y(t))(Z(t)).

type

type of sde.

method

the numerical method used.

Author(s)

A.C. Guidoum, K. Boukhetala.

References

Bladt, M. and Sorensen, M. (2007). Simple simulation of diffusion bridges with application to likelihood inference for diffusions. Working Paper, University of Copenhagen.

Iacus, S.M. (2008). Simulation and inference for stochastic differential equations: with R examples. Springer-Verlag, New York

See Also

bridgesde1d for simulation of 1-dim diffusion bridge. DBridge in package sde.

Examples

## dX(t) = 4*(-1-X(t))*Y(t) dt + 0.2 * dW1(t) ; x01 = 0 and y01 = 0
## dY(t) = 4*(1-Y(t)) *X(t) dt + 0.2 * dW2(t) ; x02 = -1 and y02 = -2
## dZ(t) = 4*(1-Z(t)) *Y(t) dt + 0.2 * dW3(t) ; x03 = 0.5 and y03 = 0.5       
## W1(t), W2(t) and W3(t) three independent Brownian motion
set.seed(1234)

fx <- expression(4*(-1-x)*y)
gx <- expression(0.2)
fy <- expression(4*(1-y)*x)
gy <- expression(0.2)
fz <- expression(4*(1-z)*y)
gz <- expression(0.2)

res <- bridgesde3d(x0=c(0,-1,0.5),y=c(0,-2,0.5),driftx=fx,diffx=gx,
                drifty=fy,diffy=gy,driftz=fz,diffz=gz,M=20)
res
plot(res,union=TRUE)
dev.new()
plot3D(res,display = "persp",main="3-dim bridge sde")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Sim.DiffProc)
Package 'Sim.DiffProc' version 3.2 loaded.
help(Sim.DiffProc) for summary information.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Sim.DiffProc/bridgesde3d.Rd_%03d_medium.png", width=480, height=480)
> ### Name: bridgesde3d
> ### Title: Simulation of 3-Dim Diffusion Bridge
> ### Aliases: bridgesde3d bridgesde3d.default print.bridgesde3d
> ###   time.bridgesde3d mean.bridgesde3d median.bridgesde3d
> ###   quantile.bridgesde3d kurtosis.bridgesde3d skewness.bridgesde3d
> ###   moment.bridgesde3d bconfint.bridgesde3d plot.bridgesde3d
> ###   points.bridgesde3d lines.bridgesde3d plot3D.bridgesde3d
> ### Keywords: sde ts mts
> 
> ### ** Examples
> 
> ## dX(t) = 4*(-1-X(t))*Y(t) dt + 0.2 * dW1(t) ; x01 = 0 and y01 = 0
> ## dY(t) = 4*(1-Y(t)) *X(t) dt + 0.2 * dW2(t) ; x02 = -1 and y02 = -2
> ## dZ(t) = 4*(1-Z(t)) *Y(t) dt + 0.2 * dW3(t) ; x03 = 0.5 and y03 = 0.5       
> ## W1(t), W2(t) and W3(t) three independent Brownian motion
> set.seed(1234)
> 
> fx <- expression(4*(-1-x)*y)
> gx <- expression(0.2)
> fy <- expression(4*(1-y)*x)
> gy <- expression(0.2)
> fz <- expression(4*(1-z)*y)
> gz <- expression(0.2)
> 
> res <- bridgesde3d(x0=c(0,-1,0.5),y=c(0,-2,0.5),driftx=fx,diffx=gx,
+                 drifty=fy,diffy=gy,driftz=fz,diffz=gz,M=20)
> res
Ito Bridges Sde 3D:
	| dX(t) = 4 * (-1 - X(t)) * Y(t) * dt + 0.2 * dW1(t)
	| dY(t) = 4 * (1 - Y(t)) * X(t) * dt + 0.2 * dW2(t)
	| dZ(t) = 4 * (1 - Z(t)) * Y(t) * dt + 0.2 * dW3(t)
Method:
	| Euler scheme of order 0.5
Summary:
	| Size of process	| N  = 1000.
	| Crossing realized	| (Cx,Cy,Cz) = c(20,20,20).
	| Initial values	| x0 = c(0,-1,0.5).
	| Final values		| y  = c(0,-2,0.5).
	| Time of process	| t in [0,1].
	| Discretization	| Dt = 0.001.
> plot(res,union=TRUE)
> dev.new()
Error in dev.new() : no suitable unused file name for pdf()
Execution halted