Learn R Programming

Sim.DiffProc (version 2.8)

bridgesde2d: Simulation of 2-Dim Diffusion Bridge

Description

The (S3) generic function bridgesde2d for simulation of 2-dim diffusion bridge.

Usage

bridgesde2d(N, ...)
## S3 method for class 'default':
bridgesde2d(N = 1000, x0 = c(0, 0), y = c(1, 1), t0 = 0, T = 1, Dt, 
   driftx, diffx, drifty, diffy, 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 'bridgesde2d':
summary(object, \dots)							  
## S3 method for class 'bridgesde2d':
time(x, \dots)
## S3 method for class 'bridgesde2d':
plot(x, \dots)
## S3 method for class 'bridgesde2d':
lines(x, \dots)
## S3 method for class 'bridgesde2d':
points(x, \dots)	
## S3 method for class 'bridgesde2d':
plot2d(x, \dots)
## S3 method for class 'bridgesde2d':
lines2d(x, \dots)
## S3 method for class 'bridgesde2d':
points2d(x, \dots)

Arguments

N
number of simulation steps.
x0
initial value (numeric vector of length 2) of the process $X_t$ and $Y_t$ at time $t_0$.
y
terminal value (numeric vector of length 2) of the process $X_t$ and $Y_t$ at time $T$.
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}$.
driftx, drifty
drift coefficient: an expression of three variables t, x and y for process $X_t$ and $Y_t$.
diffx, diffy
diffusion coefficient: an expression of three variables t, x and y for process $X_t$ and $Y_t$.
alpha, mu
weight of the predictor-corrector scheme; the default alpha = 0.5 and 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 snssde2d.
x, object
an object inheriting from class "bridgesde2d".
...
further arguments for (non-default) methods.

Value

  • bridgesde2d returns an object inheriting from class "bridgesde2d".
  • XYan invisible ts object $(X_{t},Y_{t})$.

newcommand

\CRANpkg

href

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

pkg

#1

Details

The function bridgesde2d 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").

References

Bladt, M. and Sorensen, M. (2007). Simple simulation of diffusion bridges with application to likelihood inference for diffusions. Working Paper, University of Copenhagen. Available at http://www.math.ku.dk/~michael/diffusionbridgepreprint.pdf 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

Run this code
## dX(t) = 4*(-2-X(t)) * dt + Y(t) * dW1(t)          
## dY(t) = 4*(-2-Y(t)) * dt + X(t) * dW2(t)
## x01 = 1 , y01 = 1
## x02 = 1, y02 = 1 
## W1(t) and W2(t) two independent Brownian motion

fx <- expression(4*(-2-x))
gx <- expression(y)
fy <- expression(4*(-2-y))
gy <- expression(x)

res <- bridgesde2d(x0=c(1,1),y=c(1,1),driftx=fx,diffx=gx,drifty=fy,diffy=gy)
res
plot(res)
dev.new()
plot(res,plot.type="single")
dev.new()
plot2d(res,type="n")
points2d(XY,col=rgb(0,100,0,50,maxColorValue=255), pch=16)

Run the code above in your browser using DataLab