Consider now a d-dimensional stochastic process Xt defined on a probability space (Ω,F,P). We say that the bridge associated to Xt conditioned to the event {XT=a} is the process: {˜Xt,t0≤t≤T}={Xt,t0≤t≤T:XT=a} where T is a deterministic fixed time and a∈Rd is fixed too.
bridgesdekd()
functionsThe (S3) generic function bridgesdekd()
(where
k=1,2,3
) for simulation of 1,2 and 3-dim bridge stochastic
differential equations,Ito or Stratonovich type, with different methods.
The main arguments consist:
drift
and diffusion
coefficients as R
expressions that depend on the state variable x
(y
and z
) and time variable
t
.corr
the correlation structure of standard Wiener
process ; must be a real symmetric positive-definite square matrix (2D
and 3D, default: corr=NULL
).N
.M
(default: M=1
).x0
at initial time t0
.y
final time T
Dt
(default:
Dt=(T-t0)/N
).type="ito"
for Ito or type="str"
for Stratonovich (by default
type="ito"
).method
(default
method="euler"
).By Monte-Carlo simulations, the following statistical measures
(S3 method
) for class bridgesdekd()
(where
k=1,2,3
) can be approximated for the process at any time
t∈[t0,T] (default:
at=(T-t0)/2
):
mean
.moment
with order=2
and
center=TRUE
.Median
.Mode
.quantile
.min
and
max
.skewness
and kurtosis
.cv
.moment
.summary
.We can just make use of the rsdekd()
function (where
k=1,2,3
) to build our random number for class
bridgesdekd()
(where k=1,2,3
) at any time
t∈[t0,T]. the main arguments
consist:
object
an object inheriting from class
bridgesdekd()
(where k=1,2,3
).at
time between s=t0 and t=T.The function dsde()
(where k=1,2,3
)
approximate transition density for class bridgesdekd()
(where k=1,2,3
), the main arguments consist:
object
an object inheriting from class
bridgesdekd()
(where k=1,2,3
).at
time between s=t0 and t=T.pdf
probability density function Joint
or
Marginal
.The following we explain how to use this functions.
bridgesde1d()
Assume that we want to describe the following bridge sde in Ito form: dXt=1−Xt1−tdt+XtdWt,Xt0=3andXT=1 We simulate a flow of 1000 trajectories, with integration step size Δt=0.001, and x0=3 at time t0=0, y=1 at terminal time T=1.
R> set.seed(1234, kind = "L'Ecuyer-CMRG")
R> f <- expression((1-x)/(1-t))
R> g <- expression(x)
R> mod <- bridgesde1d(drift=f,diffusion=g,x0=3,y=1,M=1000)
R> mod
Itô Bridge Sde 1D:
| dX(t) = (1 - X(t))/(1 - t) * dt + X(t) * dW(t)
Method:
| Euler scheme with order 0.5
Summary:
| Size of process | N = 1001.
| Crossing realized | C = 978 among 1000.
| Initial value | x0 = 3.
| Ending value | y = 1.
| Time of process | t in [0,1].
| Discretization | Dt = 0.001.
In Figure 1, we present the flow of trajectories, the mean path (red lines) of solution of Xt|X0=3,XT=1:
R> plot(mod,ylab=expression(X[t]))
R> lines(time(mod),apply(mod$X,1,mean),col=2,lwd=2)
R> legend("topleft","mean path",inset = .01,col=2,lwd=2,cex=0.8,bty="n")
Hence we can just make use of the rsde1d()
function to
build our random number generator for Xt|X0=3,XT=1 at time t=0.55:
[1] 0.72282 0.96118 0.94990
The function dsde1d()
can be used to show the kernel
density estimation for Xt|X0=3,XT=1 at time t=0.55 (hist=TRUE
based on
truehist()
function in MASS package):
R> dens <- dsde1d(mod, at = 0.55)
R> plot(dens,hist=TRUE) ## histgramme
R> plot(dens,add=TRUE) ## kernel density
Figure 1: Bridge sde 1D. Histgramme and kernel density estimation for Xt|X0=3,XT=1
bridgesde2d()
Assume that we want to describe the following 2-dimensional bridge SDE’s in Stratonovich form:
{dXt=−(1+Yt)Xtdt+0.2(1−Yt)∘dB1,t,Xt0=1andXT=1dYt=−(1+Xt)Ytdt+0.1(1−Xt)∘dB2,t,Yt0=−0.5andYT=0.5 with (B1,t,B2,t) are two correlated standard Wiener process: Σ=(10.30.31)
We simulate a flow of 1000 trajectories, with integration step size Δt=0.01:
R> set.seed(1234, kind = "L'Ecuyer-CMRG")
R> fx <- expression(-(1+y)*x , -(1+x)*y)
R> gx <- expression(0.2*(1-y),0.1*(1-x))
R> Sigma <-matrix(c(1,0.3,0.3,1),nrow=2,ncol=2)
R> mod2 <- bridgesde2d(drift=fx,diffusion=gx,x0=c(1,-0.5),y=c(1,0.5),Dt=0.01,M=1000,type="str",corr=Sigma)
R> mod2
Stratonovich Bridge Sde 2D:
| dX(t) = -(1 + Y(t)) * X(t) * dt + 0.2 * (1 - Y(t)) o dB1(t)
| dY(t) = -(1 + X(t)) * Y(t) * dt + 0.1 * (1 - X(t)) o dB2(t)
| Correlation structure:
1.0 0.3
0.3 1.0
Method:
| Euler scheme with order 0.5
Summary:
| Size of process | N = 1001.
| Crossing realized | C = 1000 among 1000.
| Initial values | x0 = (1,-0.5).
| Ending values | y = (1,0.5).
| Time of process | t in [0,10].
| Discretization | Dt = 0.01.
In Figure 2, we present the flow of trajectories of Xt|X0=1,XT=1 and Yt|Y0=−0.5,YT=0.5:
Figure 2: Bridge sde 2D
Hence we can just make use of the rsde2d()
function to
build our random number generator for the couple Xt,Yt|X0=1,Y0=−0.5,XT=1,YT=0.5
at time t=5:
x y
1 0.051742 0.0095811
2 0.135792 0.0436799
3 0.021494 -0.0348084
The marginal density of Xt|X0=1,XT=1 and Yt|Y0=−0.5,YT=0.5 at time t=5 are reported using
dsde2d()
function. A contour
plot of joint
density obtained from a realization of the couple Xt,Yt|X0=1,Y0=−0.5,XT=1,YT=0.5
at time t=5, see e.g. Figure 3:
R> ## Marginal
R> denM <- dsde2d(mod2,pdf="M",at = 5)
R> plot(denM, main="Marginal Density")
R> ## Joint
R> denJ <- dsde2d(mod2, pdf="J", n=100,at = 5)
R> plot(denJ,display="contour",main="Bivariate Transition Density at time t=5")
Figure 3: The marginal and joint density of Xt|X0=1,XT=1 and Yt|Y0=−0.5,YT=0.5 at time t=5
A 3D plot of the transition density at t=5 obtained with:
Figure 4: 3D plot of the transition density of Xt|X0=1,XT=1 and Yt|Y0=−0.5,YT=0.5 at time t=5
We approximate the bivariate transition density over the set transition horizons t∈[1,9] with Δt=0.005 using the code:
bridgesde3d()
Assume that we want to describe the following bridges SDE’s (3D) in Ito form:
{dXt=−4(1+Xt)Ytdt+0.2dW1,t,Xt0=0andXT=0dYt=4(1−Yt)Xtdt+0.2dW2,t,Yt0=−1andYT=−2dZt=4(1−Zt)Ytdt+0.2dW3,t,Zt0=0.5andZT=0.5
We simulate a flow of 1000 trajectories, with integration step size Δt=0.001.
R> set.seed(1234, kind = "L'Ecuyer-CMRG")
R> fx <- expression(-4*(1+x)*y, 4*(1-y)*x, 4*(1-z)*y)
R> gx <- rep(expression(0.2),3)
R> mod3 <- bridgesde3d(x0=c(0,-1,0.5),y=c(0,-2,0.5),drift=fx,diffusion=gx,M=1000)
R> mod3
Itô Bridge 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 with order 0.5
Summary:
| Size of process | N = 1001.
| Crossing realized | C = 998 among 1000.
| Initial values | x0 = (0,-1,0.5).
| Ending values | y = (0,-2,0.5).
| Time of process | t in [0,1].
| Discretization | Dt = 0.001.
For plotting (back in time) using the command plot
, and
plot3D
in space the results of the simulation are shown in
Figure 5:
Figure 5: Bridge sde 3D
Hence we can just make use of the rsde3d()
function to
build our random number generator for the triplet Xt,Yt,Zt|X0=0,Y0=−1,Z0=0.5,XT=0,YT=−2,ZT=0.5
at time t=0.75:
x y z
1 2.0636 0.074044 -0.30984
2 1.9445 0.111705 -0.26487
3 1.9288 0.054322 -0.50509
the density of Xt|X0=0,XT=0, Yt|Y0=−1,YT=−2 and Zt|Z0=0.5,ZT=0.5 process at time
t=0.75 are reported using
dsde3d()
function. For an approximate joint density for
triplet Xt,Yt,Zt|X0=0,Y0=−1,Z0=0.5,XT=0,YT=−2,ZT=0.5
at time t=0.75 (for more details,
see package sm or ks.)
snssdekd()
&
dsdekd()
& rsdekd()
- Monte-Carlo
Simulation and Analysis of Stochastic Differential Equations.bridgesdekd()
&
dsdekd()
& rsdekd()
- Constructs and
Analysis of Bridges Stochastic Differential Equations.fptsdekd()
&
dfptsdekd()
- Monte-Carlo Simulation and Kernel Density
Estimation of First passage time.MCM.sde()
&
MEM.sde()
- Parallel Monte-Carlo and Moment Equations for
SDEs.TEX.sde()
- Converting
Sim.DiffProc Objects to LaTeX.fitsde()
- Parametric Estimation
of 1-D Stochastic Differential Equation.Bladt, M. and Sorensen, M. (2007). Simple simulation of diffusion bridges with application to likelihood inference for diffusions. Working Paper, University of Copenhagen.
Guidoum AC, Boukhetala K (2024). Sim.DiffProc: Simulation of Diffusion Processes. R package version 4.9, URL https://cran.r-project.org/package=Sim.DiffProc.
Department of Mathematics and Computer Science, Faculty of Sciences and Technology, University of Tamanghasset, Algeria, E-mail (acguidoum@univ-tam.dz)↩︎
Faculty of Mathematics, University of Science and Technology Houari Boumediene, BP 32 El-Alia, U.S.T.H.B, Algeria, E-mail (kboukhetala@usthb.dz)↩︎