Constructs and Analysis of Bridges Stochastic Differential Equations

A.C. Guidoum1 and K. Boukhetala2

2017-11-28

Bridges SDE’s

Consider now a \(d\)-dimensional stochastic process \(X_{t}\) defined on a probability space \((\Omega, \mathfrak{F},\mathbb{P})\). We say that the bridge associated to \(X_{t}\) conditioned to the event \(\{X_{T}= a\}\) is the process: \[ \{\tilde{X}_{t}, t_{0} \leq t \leq T \}=\{X_{t}, t_{0} \leq t \leq T: X_{T}= a \} \] where \(T\) is a deterministic fixed time and \(a \in \mathbb{R}^d\) is fixed too.

The bridgesdekd() functions

The (S3) generic function bridgesdekd() (where k=1,2,3) for simulation of 1,2 and 3-dim bridge stochastic differential equations,Itô or Stratonovich type, with different methods. The main arguments consist:

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 \in [t_{0},T]\) (default: at=(T-t0)/2):

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 \in [t_{0},T]\). the main arguments consist:

The function dsde() (where k=1,2,3) approximate transition density for class bridgesdekd() (where k=1,2,3), the main arguments consist:

The following we explain how to use this functions.

bridgesde1d()

Assume that we want to describe the following bridge sde in Itô form: \[\begin{equation}\label{eq0166} dX_t = \frac{1-X_t}{1-t} dt + X_t dW_{t},\quad X_{t_{0}}=3 \quad\text{and}\quad X_{T}=1 \end{equation}\]

We simulate a flow of \(5000\) trajectories, with integration step size \(\Delta t = 0.001\), and \(x_0 = 3\) at time \(t_0 = 0\), \(y = 1\) at terminal time \(T=1\).

R> f <- expression((1-x)/(1-t))
R> g <- expression(x)
R> mod <- bridgesde1d(drift=f,diffusion=g,x0=3,y=1,M=5000,method="milstein")
R> mod
Itô Bridge Sde 1D:
    | dX(t) = (1 - X(t))/(1 - t) * dt + X(t) * dW(t)
Method:
    | First-order Milstein scheme
Summary:
    | Size of process   | N = 1001.
    | Crossing realized | C = 4867 among 5000.
    | Initial value     | x0 = 3.
    | Ending value      | y = 1.
    | Time of process   | t in [0,1].
    | Discretization    | Dt = 0.001.
R> summary(mod) ## default: summary at time = (T-t0)/2

Monte-Carlo Statistics for X(t) at time t = 0.5
    | Crossing realized 4867 among 5000
                           
Mean                1.97014
Variance            1.61044
Median              1.63296
Mode                1.15145
First quartile      1.11853
Third quartile      2.44144
Minimum             0.34155
Maximum            11.64675
Skewness            2.16882
Kurtosis           10.48070
Coef-variation      0.64413
3th-order moment    4.43243
4th-order moment   27.18200
5th-order moment  173.53092
6th-order moment 1275.95092

In Figure 1, we present the flow of trajectories, the mean path (red lines) of solution of \(X_{t}|X_{0}=3,X_{T}=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")
Bridge sde 1D

Bridge sde 1D

Figure 2, show approximation results for \(m(t)=\text{E}(X_{t}|X_{0}=3,X_{T}=1)\) and \(S(t)=\text{V}(X_{t}|X_{0}=3,X_{T}=1)\):

R> m  <- apply(mod$X,1,mean) 
R> S  <- apply(mod$X,1,var)
R> out <- data.frame(m,S)
R> matplot(time(mod), out, type = "l", xlab = "time", ylab = "", col=2:3,lwd=2,lty=2:3,las=1)
R> legend("topright",c(expression(m(t),S(t))),col=2:3,lty=2:3,lwd=2,bty="n")

The following statistical measures (S3 method) for class bridgesde1d() can be approximated for the \(X_{t}|X_{0}=3,X_{T}=1\) process at any time \(t\), for example at=0.55:

R> s = 0.55
R> mean(mod, at = s)
[1] 1.8764
R> moment(mod, at = s , center = TRUE , order = 2) ## variance
[1] 1.5393
R> Median(mod, at = s)
[1] 1.5457
R> Mode(mod, at = s)
[1] 1.1186
R> quantile(mod , at = s)
      0%      25%      50%      75%     100% 
 0.27414  1.06314  1.54569  2.29849 15.97073 
R> kurtosis(mod , at = s)
[1] 15.785
R> skewness(mod , at = s)
[1] 2.5237
R> cv(mod , at = s )
[1] 0.66126
R> min(mod , at = s)
[1] 0.27414
R> max(mod , at = s)
[1] 15.971
R> moment(mod, at = s , center= TRUE , order = 4)
[1] 37.417
R> moment(mod, at = s , center= FALSE , order = 4)
[1] 118.52

The result summaries of the \(X_{t}|X_{0}=3,X_{T}=1\) process at time \(t=0.55\):

R> summary(mod, at = 0.55)

Monte-Carlo Statistics for X(t) at time t = 0.55
    | Crossing realized 4867 among 5000
                           
Mean                1.87642
Variance            1.53960
Median              1.54569
Mode                1.11855
First quartile      1.06314
Third quartile      2.29849
Minimum             0.27414
Maximum            15.97073
Skewness            2.52369
Kurtosis           15.78513
Coef-variation      0.66126
3th-order moment    4.82113
4th-order moment   37.41664
5th-order moment  361.05430
6th-order moment 4202.05090

Hence we can just make use of the rsde1d() function to build our random number generator for \(X_{t}|X_{0}=3,X_{T}=1\) at time \(t=0.55\):

R> x <- rsde1d(object = mod, at = s) 
R> head(x, n = 10)
 [1] 1.15738 2.75616 1.00823 1.37275 0.61755 1.93219 2.42634 0.46522
 [9] 0.92225 1.99562
R> summary(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.274   1.063   1.546   1.876   2.299  15.971 

Display the random number generator for \(X_{t}|X_{0}=3,X_{T}=1\), see Figure 3:

R> plot(time(mod),mod$X[,1],type="l",ylab="X(t)",xlab="time",axes=F,lty=3)
R> points(s,x[1],pch=19,col=2,cex=0.5)
R> lines(c(s,s),c(0,x[1]),lty=2,col=2)
R> lines(c(0,s),c(x[1],x[1]),lty=2,col=2)
R> axis(1, s, bquote(at==.(s)),col=2,col.ticks=2)
R> axis(2, x[1], bquote(X[t==.(s)]),col=2,col.ticks=2)
R> legend('topright',col=2,pch=19,legend=bquote(X[t==.(s)]==.(x[1])),bty = 'n')
R> box()

The function dsde1d() can be used to show the kernel density estimation for \(X_{t}|X_{0}=3,X_{T}=1\) at time \(t=0.55\) (hist=TRUE based on truehist() function in MASS package):

R> dens <- dsde1d(mod, at = s)
R> dens

 Density of X(t-t0)|X(t0) = 3, X(T) = 1 at time t = 0.55

Data: x (4867 obs.);    Bandwidth 'bw' = 0.1519

       x                f(x)        
 Min.   :-0.1815   Min.   :0.00000  
 1st Qu.: 3.9705   1st Qu.:0.00006  
 Median : 8.1224   Median :0.00101  
 Mean   : 8.1224   Mean   :0.06015  
 3rd Qu.:12.2744   3rd Qu.:0.03244  
 Max.   :16.4263   Max.   :0.55231  
R> plot(dens,hist=TRUE) ## histgramme
R> plot(dens,add=TRUE)  ## kernel density

Approximate the transitional densitie of \(X_{t}|X_{0}=3,X_{T}=1\) at \(t-s = \{0.25,0.75\}\):

R> plot(dsde1d(mod,at=0.75))
R> plot(dsde1d(mod,at=0.25),add=TRUE)
R> legend('topright',col=c('#0000FF4B','#FF00004B'),pch=15,legend=c("t-s=0.25","t-s=0.75"),bty = 'n')
 Transitional densitie at time $t-s = 0.25,0.75$

Transitional densitie at time \(t-s = 0.25,0.75\)

Return to bridgesde1d()

bridgesde2d()

Assume that we want to describe the following \(2\)-dimensional bridge SDE’s in Stratonovich form:

\[\begin{equation}\label{eq:09} \begin{cases} dX_t = -(1+Y_{t}) X_{t} dt + 0.2 (1-Y_{t})\circ dW_{1,t},\quad X_{t_{0}}=1 \quad\text{and}\quad X_{T}=1\\ dY_t = -(1+X_{t}) Y_{t} dt + 0.1 (1-X_{t}) \circ dW_{2,t},\quad Y_{t_{0}}=-0.5 \quad\text{and}\quad Y_{T}=0.5 \end{cases} \end{equation}\]

We simulate a flow of \(5000\) trajectories, with integration step size \(\Delta t = 0.01\), and using Runge-Kutta method order 1:

R> fx <- expression(-(1+y)*x , -(1+x)*y)
R> gx <- expression(0.2*(1-y),0.1*(1-x))
R> mod2 <- bridgesde2d(drift=fx,diffusion=gx,x0=c(1,-0.5),y=c(1,0.5),Dt=0.01,M=5000,type="str",method="rk1")
R> mod2
Stratonovich Bridge Sde 2D:
    | dX(t) = expression(-(1 + y) * x) * dt + expression(0.2 * (1 - y)) o dW1(t)
    | dY(t) = expression(-(1 + x) * y) * dt + expression(0.1 * (1 - x)) o dW2(t)
Method:
    | Runge-Kutta method with order 1
Summary:
    | Size of process   | N = 1001.
    | Crossing realized | C = 4995 among 5000.
    | Initial values    | x0 = (1,-0.5).
    | Ending values     | y = (1,0.5).
    | Time of process   | t in [0,10].
    | Discretization    | Dt = 0.01.
R> summary(mod2) ## default: summary at time = (T-t0)/2

Monte-Carlo Statistics for (X(t),Y(t)) at time t = 5
    | Crossing realized 4995 among 5000
                        X        Y
Mean              0.00579  0.00270
Variance          0.02082  0.00542
Median            0.00517  0.00282
Mode              0.00236  0.00115
First quartile   -0.09071 -0.04443
Third quartile    0.10146  0.05064
Minimum          -0.54025 -0.31584
Maximum           0.50999  0.32230
Skewness          0.00242 -0.03023
Kurtosis          3.11940  3.41785
Coef-variation   24.90935 27.31101
3th-order moment  0.00001 -0.00001
4th-order moment  0.00135  0.00010
5th-order moment -0.00001  0.00000
6th-order moment  0.00015  0.00000

In Figure 6, we present the flow of trajectories of \(X_{t}|X_{0}=1,X_{T}=1\) and \(Y_{t}|Y_{0}=-0.5,Y_{T}=0.5\):

R> plot(mod2,col=c('#FF00004B','#0000FF82'))
Bridge sde 2D

Bridge sde 2D

Figure 7, show approximation results for \(m_{1}(t)=\text{E}(X_{t}|X_{0}=1,X_{T}=1)\), \(m_{2}(t)=\text{E}(Y_{t}|Y_{0}=-0.5,Y_{T}=0.5)\),and \(S_{1}(t)=\text{V}(X_{t}|X_{0}=1,X_{T}=1)\), \(S_{2}(t)=\text{V}(Y_{t}|Y_{0}=-0.5,Y_{T}=0.5)\), and \(C_{12}(t)=\text{COV}(X_{t},Y_{t}|X_{0}=1,Y_{0}=-0.5,X_{T}=1,Y_{T}=0.5)\):

R> m1  <- apply(mod2$X,1,mean) 
R> m2  <- apply(mod2$Y,1,mean) 
R> S1  <- apply(mod2$X,1,var)
R> S2  <- apply(mod2$Y,1,var)
R> C12 <- sapply(1:dim(mod2$X)[1],function(i) cov(mod2$X[i,],mod2$Y[i,]))
R> out2 <- data.frame(m1,m2,S1,S2,C12)
R> matplot(time(mod2), out2, type = "l", xlab = "time", ylab = "", col=2:6,lwd=2,lty=2:6,las=1)
R> legend("top",c(expression(m[1](t),m[2](t),S[1](t),S[2](t),C[12](t))),col=2:6,lty=2:6,lwd=2,bty="n")

The following statistical measures (S3 method) for class bridgesde2d() can be approximated for the \(X_{t}|X_{0}=1,X_{T}=1\) and \(Y_{t}|Y_{0}=-0.5,Y_{T}=0.5\) process at any time \(t\), for example at=6.75:

R> s = 6.75
R> mean(mod2, at = s)
[1] 0.0268110 0.0081968
R> moment(mod2, at = s , center = TRUE , order = 2) ## variance
[1] 0.0196747 0.0046577
R> Median(mod2, at = s)
[1] 0.0267218 0.0074823
R> Mode(mod2, at = s)
[1] 0.0288800 0.0062648
R> quantile(mod2 , at = s)
$x
       0%       25%       50%       75%      100% 
-0.600498 -0.066184  0.026722  0.119623  0.578464 

$y
        0%        25%        50%        75%       100% 
-0.2641281 -0.0358245  0.0074823  0.0515105  0.3077726 
R> kurtosis(mod2 , at = s)
[1] 3.1131 3.3341
R> skewness(mod2 , at = s)
[1] -0.010913  0.025349
R> cv(mod2 , at = s )
[1] 5.2322 8.3269
R> min(mod2 , at = s)
[1] -0.60050 -0.26413
R> max(mod2 , at = s)
[1] 0.57846 0.30777
R> moment(mod2 , at = s , center= TRUE , order = 4)
[1] 0.00120555 0.00007236
R> moment(mod2 , at = s , center= FALSE , order = 4)
[1] 0.001287690 0.000074507

The result summaries of the \(X_{t}|X_{0}=1,X_{T}=1\) and \(Y_{t}|Y_{0}=-0.5,Y_{T}=0.5\) process at time \(t=6.75\):

R> summary(mod2, at = 6.75)

Monte-Carlo Statistics for (X(t),Y(t)) at time t = 6.75
    | Crossing realized 4995 among 5000
                        X        Y
Mean              0.02681  0.00820
Variance          0.01968  0.00466
Median            0.02672  0.00748
Mode              0.02888  0.00626
First quartile   -0.06618 -0.03582
Third quartile    0.11962  0.05151
Minimum          -0.60050 -0.26413
Maximum           0.57846  0.30777
Skewness         -0.01091  0.02535
Kurtosis          3.11311  3.33413
Coef-variation    5.23219  8.32694
3th-order moment -0.00003  0.00001
4th-order moment  0.00121  0.00007
5th-order moment -0.00002  0.00000
6th-order moment  0.00013  0.00000

Hence we can just make use of the rsde2d() function to build our random number generator for the couple \(X_{t},Y_{t}|X_{0}=1,Y_{0}=-0.5,X_{T}=1,Y_{T}=0.5\) at time \(t=6.75\):

R> x2 <- rsde2d(object = mod2, at = s) 
R> head(x2, n = 10)
           x          y
1   0.164817 -0.0125831
2  -0.045129  0.1117686
3   0.162660 -0.0555036
4  -0.138086  0.1422665
5   0.067019  0.0499271
6  -0.059958  0.0471664
7   0.074365  0.0739886
8   0.045395  0.0499711
9  -0.147753  0.0311994
10 -0.121055  0.0040338
R> summary(x2)
       x                 y           
 Min.   :-0.6005   Min.   :-0.26413  
 1st Qu.:-0.0662   1st Qu.:-0.03583  
 Median : 0.0267   Median : 0.00748  
 Mean   : 0.0268   Mean   : 0.00820  
 3rd Qu.: 0.1196   3rd Qu.: 0.05151  
 Max.   : 0.5785   Max.   : 0.30777  

Display the random number generator for the couple \(X_{t},Y_{t}|X_{0}=1,Y_{0}=-0.5,X_{T}=1,Y_{T}=0.5\), see Figure 8:

R> plot(ts.union(mod2$X[,1],mod2$Y[,1]),col=1:2,lty=3,plot.type="single",type="l",ylab= "",xlab="time",axes=F)
R> points(s,x2$x[1],pch=19,col=3,cex=0.8)
R> points(s,x2$y[1],pch=19,col=4,cex=0.8)
R> lines(c(s,s),c(-10,x2$x[1]),lty=2,col=6)
R> lines(c(0,s),c(x2$x[1],x2$x[1]),lty=2,col=3)
R> lines(c(0,s),c(x2$y[1],x2$y[1]),lty=2,col=4)
R> axis(1, s, bquote(at==.(s)),col=6,col.ticks=6)
R> axis(2, x2$x[1], bquote(X[t==.(s)]),col=3,col.ticks=3)
R> axis(2, x2$y[1], bquote(Y[t==.(s)]),col=4,col.ticks=4)
R> legend('topright',legend=bquote(c(X[t==.(s)]==.(x2$x[1]),Y[t==.(s)]==.(x2$y[1]))),bty = 'n')
R> box()

For each SDE type and for each numerical scheme, the density of \(X_{t}|X_{0}=1,X_{T}=1\) and \(Y_{t}|Y_{0}=-0.5,Y_{T}=0.5\) at time \(t=6.75\) are reported using dsde2d() function, see e.g. Figure 9:

R> denM <- dsde2d(mod2,pdf="M",at =s)
R> denM

 Marginal density of X(t-t0)|X(t0) = 1, X(T) = 1 at time t = 6.75

Data: x (4995 obs.);    Bandwidth 'bw' = 0.02272

       x                 f(x)        
 Min.   :-0.66867   Min.   :0.00004  
 1st Qu.:-0.33984   1st Qu.:0.00440  
 Median :-0.01102   Median :0.19373  
 Mean   :-0.01102   Mean   :0.75954  
 3rd Qu.: 0.31781   3rd Qu.:1.38081  
 Max.   : 0.64664   Max.   :2.94235  

 Marginal density of Y(t-t0)|Y(t0) = -0.5, Y(T) = 0.5 at time t = 6.75

Data: y (4995 obs.);    Bandwidth 'bw' = 0.01068

       y                 f(y)       
 Min.   :-0.29617   Min.   :0.0001  
 1st Qu.:-0.13717   1st Qu.:0.0329  
 Median : 0.02182   Median :0.3736  
 Mean   : 0.02182   Mean   :1.5708  
 3rd Qu.: 0.18082   3rd Qu.:2.7173  
 Max.   : 0.33982   Max.   :6.1614  
R> plot(denM, main="Marginal Density")

Created using dsde2d() plotted in (x, y)-space with dim = 2. A contour and image plot of density obtained from a realization of the couple \(X_{t},Y_{t}|X_{0}=1,Y_{0}=-0.5,X_{T}=1,Y_{T}=0.5\) at time t=6.75.

R> denJ <- dsde2d(mod2, pdf="J", n=100,at =s)
R> denJ

 Joint density of (X(t-t0),Y(t-t0)|X(t0)=1,Y(t0)=-0.5,X(T)=1,Y(T)=0.5) at time t = 6.75

Data: (x,y) (2 x 4995 obs.);

       x                  y                 f(x,y)       
 Min.   :-0.60050   Min.   :-0.264128   Min.   : 0.0000  
 1st Qu.:-0.30576   1st Qu.:-0.121153   1st Qu.: 0.0003  
 Median :-0.01102   Median : 0.021822   Median : 0.0787  
 Mean   :-0.01102   Mean   : 0.021822   Mean   : 1.4531  
 3rd Qu.: 0.28372   3rd Qu.: 0.164797   3rd Qu.: 0.9620  
 Max.   : 0.57846   Max.   : 0.307773   Max.   :19.3926  
R> plot(denJ,display="contour",main="Bivariate Transition Density at time t=6.755")
R> plot(denJ,display="image",main="Bivariate Transition Density at time t=6.755")

A \(3\)D plot of the transition density at \(t=6.75\) obtained with:

R> plot(denJ,main="Bivariate Transition Density at time t=6.75")

We approximate the bivariate transition density over the set transition horizons \(t\in [1,9]\) with \(\Delta t = 0.005\) using the code:

R> for (i in seq(1,9,by=0.005)){ 
+ plot(dsde2d(mod2, at = i,n=100),display="contour",main=paste0('Transition Density \n t = ',i))
+ }

Return to bridgesde2d()

bridgesde3d()

Assume that we want to describe the following bridges SDE’s (3D) in Itô form:

\[\begin{equation} \begin{cases} dX_t = -4 (1+X_{t}) Y_{t} dt + 0.2 dW_{1,t},\quad X_{t_{0}}=0 \quad\text{and}\quad X_{T}=0\\ dY_t = 4 (1-Y_{t}) X_{t} dt + 0.2 dW_{2,t},\quad Y_{t_{0}}=-1 \quad\text{and}\quad Y_{T}=-2\\ dZ_t = 4 (1-Z_{t}) Y_{t} dt + 0.2 dW_{3,t},\quad Z_{t_{0}}=0.5 \quad\text{and}\quad Z_{T}=0.5 \end{cases} \end{equation}\]

We simulate a flow of \(5000\) trajectories, with integration step size \(\Delta t = 0.001\).

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=5000)
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 = 4995 among 5000.
    | 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.
R> summary(mod3) ## default: summary at time = (T-t0)/2

Monte-Carlo Statistics for (X(t),Y(t),Z(t)) at time t = 0.5
    | Crossing realized 4995 among 5000
                        X       Y        Z
Mean              0.65797 0.51141  0.17736
Variance          0.01386 0.00720  0.02134
Median            0.66262 0.51190  0.17922
Mode              0.65703 0.51280  0.17437
First quartile    0.58249 0.45456  0.08095
Third quartile    0.73840 0.56694  0.27446
Minimum           0.19084 0.21476 -0.38052
Maximum           1.04900 0.90282  0.66644
Skewness         -0.25687 0.10812 -0.05765
Kurtosis          3.18596 3.52316  3.09026
Coef-variation    0.17892 0.16596  0.82358
3th-order moment -0.00042 0.00007 -0.00018
4th-order moment  0.00061 0.00018  0.00141
5th-order moment -0.00005 0.00001 -0.00004
6th-order moment  0.00005 0.00001  0.00015

For plotting (back in time) using the command plot, and plot3D in space the results of the simulation are shown in Figure 12:

R> plot(mod3) ## in time
R> plot3D(mod3,display = "persp",main="3D Bridge SDE's") ## in space 
Bridge sde 3D

Bridge sde 3D

Figure 13, show approximation results for \(m_{1}(t)=\text{E}(X_{t}|X_{0}=0,X_{T}=0)\), \(m_{2}(t)=\text{E}(Y_{t}|Y_{0}=-1,Y_{T}=-2)\), \(m_{3}(t)=\text{E}(Z_{t}|Z_{0}=0.5,Z_{T}=0.5)\) and \(S_{1}(t)=\text{V}(X_{t}|X_{0}=0,X_{T}=0)\), \(S_{2}(t)=\text{V}(Y_{t}|Y_{0}=-1,Y_{T}=-2)\), \(S_{3}(t)=\text{V}(Z_{t}|Z_{0}=0.5,Z_{T}=0.5)\),

R> m1  <- apply(mod3$X,1,mean) 
R> m2  <- apply(mod3$Y,1,mean) 
R> m3  <- apply(mod3$Z,1,mean) 
R> S1  <- apply(mod3$X,1,var)
R> S2  <- apply(mod3$Y,1,var)
R> S3  <- apply(mod3$Z,1,var)
R> out3 <- data.frame(m1,m2,m3,S1,S2,S3)
R> matplot(time(mod3), out3, type = "l", xlab = "time", ylab = "", col=2:7,lwd=2,lty=2:7,las=1)
R> legend("bottom",c(expression(m[1](t),m[2](t),m[3](t),S[1](t),S[2](t),S[3](t))),col=2:7,lty=2:7,lwd=2,bty="n")

The following statistical measures (S3 method) for class bridgesde3d() can be approximated for the \(X_{t}|X_{0}=0,X_{T}=0\), \(Y_{t}|Y_{0}=-1,Y_{T}=-2\) and \(Z_{t}|Z_{0}=0.5,Z_{T}=0.5\) process at any time \(t\), for example at=0.75:

R> s = 0.75
R> mean(mod3, at = s)
[1]  1.99713  0.12318 -0.50129
R> moment(mod3, at = s , center = TRUE , order = 2) ## variance
[1] 0.0117604 0.0045534 0.0312532
R> Median(mod3, at = s)
[1]  1.99853  0.12572 -0.49745
R> Mode(mod3, at = s)
[1]  1.99628  0.13785 -0.48107
R> quantile(mod3 , at = s)
$x
    0%    25%    50%    75%   100% 
1.5818 1.9255 1.9985 2.0699 2.4237 

$y
       0%       25%       50%       75%      100% 
-0.120062  0.077326  0.125715  0.169267  0.358439 

$z
      0%      25%      50%      75%     100% 
-1.11784 -0.61594 -0.49745 -0.37755  0.13066 
R> kurtosis(mod3 , at = s)
[1] 3.0572 2.9313 3.0166
R> skewness(mod3 , at = s)
[1] -0.011997 -0.122685 -0.100543
R> cv(mod3 , at = s )
[1]  0.054306  0.547853 -0.352697
R> min(mod3 , at = s)
[1]  1.58185 -0.12006 -1.11784
R> max(mod3 , at = s)
[1] 2.42369 0.35844 0.13066
R> moment(mod3 , at = s , center= TRUE , order = 4)
[1] 0.000422998 0.000060802 0.002947666
R> moment(mod3 , at = s , center= FALSE , order = 4)
[1] 16.19006059  0.00068703  0.11433115

The result summaries of the \(X_{t}|X_{0}=0,X_{T}=0\), \(Y_{t}|Y_{0}=-1,Y_{T}=-2\) and \(Z_{t}|Z_{0}=0.5,Z_{T}=0.5\) process at time \(t=0.75\):

R> summary(mod3, at = 0.75)

Monte-Carlo Statistics for (X(t),Y(t),Z(t)) at time t = 0.75
    | Crossing realized 4995 among 5000
                        X        Y        Z
Mean              1.99713  0.12318 -0.50129
Variance          0.01176  0.00455  0.03126
Median            1.99853  0.12572 -0.49745
Mode              1.99628  0.13785 -0.48107
First quartile    1.92546  0.07733 -0.61594
Third quartile    2.06991  0.16927 -0.37755
Minimum           1.58185 -0.12006 -1.11784
Maximum           2.42369  0.35844  0.13066
Skewness         -0.01200 -0.12268 -0.10054
Kurtosis          3.05718  2.93132  3.01659
Coef-variation    0.05431  0.54785 -0.35270
3th-order moment -0.00002 -0.00004 -0.00056
4th-order moment  0.00042  0.00006  0.00295
5th-order moment  0.00000  0.00000 -0.00013
6th-order moment  0.00003  0.00000  0.00046

Hence we can just make use of the rsde3d() function to build our random number generator for the triplet \(X_{t},Y_{t},Z_{t}|X_{0}=0,Y_{0}=-1,Z_{0}=0.5,X_{T}=0,Y_{T}=-2,Z_{T}=0.5\) at time \(t=0.75\):

R> x3 <- rsde3d(object = mod3, at = s) 
R> head(x3, n = 10)
        x         y        z
1  2.0150 0.1565508 -0.20627
2  2.0734 0.1482807 -0.29021
3  1.9524 0.2395013 -0.33978
4  2.0970 0.2143750 -0.54232
5  1.8791 0.1599987 -0.44235
6  1.8492 0.0424117 -0.77723
7  2.0421 0.0974784 -0.44946
8  2.1031 0.2475757 -0.44326
9  2.1317 0.0099146 -0.46271
10 2.0854 0.1285737 -0.60272
R> summary(x3)
       x              y                 z         
 Min.   :1.58   Min.   :-0.1201   Min.   :-1.118  
 1st Qu.:1.93   1st Qu.: 0.0773   1st Qu.:-0.616  
 Median :2.00   Median : 0.1257   Median :-0.497  
 Mean   :2.00   Mean   : 0.1232   Mean   :-0.501  
 3rd Qu.:2.07   3rd Qu.: 0.1693   3rd Qu.:-0.378  
 Max.   :2.42   Max.   : 0.3584   Max.   : 0.131  

Display the random number generator for triplet \(X_{t},Y_{t},Z_{t}|X_{0}=0,Y_{0}=-1,Z_{0}=0.5,X_{T}=0,Y_{T}=-2,Z_{T}=0.5\) at time \(t=0.75\): , see Figure 14:

R> plot(ts.union(mod3$X[,1],mod3$Y[,1],mod3$Z[,1]),col=1:3,lty=3,plot.type="single",type="l",ylab= "",xlab="time",axes=F)
R> points(s,x3$x[1],pch=19,col=4,cex=0.8)
R> points(s,x3$y[1],pch=19,col=5,cex=0.8)
R> points(s,x3$z[1],pch=19,col=6,cex=0.8)
R> lines(c(s,s),c(-10,x3$x[1]),lty=2,col=7)
R> lines(c(0,s),c(x3$x[1],x3$x[1]),lty=2,col=4)
R> lines(c(0,s),c(x3$y[1],x3$y[1]),lty=2,col=5)
R> lines(c(0,s),c(x3$z[1],x3$z[1]),lty=2,col=6)
R> axis(1, s, bquote(at==.(s)),col=7,col.ticks=7)
R> axis(2, x3$x[1], bquote(X[t==.(s)]),col=4,col.ticks=4)
R> axis(2, x3$y[1], bquote(Y[t==.(s)]),col=5,col.ticks=5)
R> axis(2, x3$z[1], bquote(Z[t==.(s)]),col=6,col.ticks=6)
R> legend("bottomleft",legend=bquote(c(X[t==.(s)]==.(x3$x[1]),Y[t==.(s)]==.(x3$y[1]),Z[t==.(s)]==.(x3$z[1]))),bty = 'n',cex=0.75)
R> box()

For each SDE type and for each numerical scheme, the density of \(X_{t}|X_{0}=0,X_{T}=0\), \(Y_{t}|Y_{0}=-1,Y_{T}=-2\) and \(Z_{t}|Z_{0}=0.5,Z_{T}=0.5\) process at time \(t=0.75\) are reported using dsde3d() function, see e.g. Figure 15:

R> denM <- dsde3d(mod3,pdf="M",at =s)
R> denM

 Marginal density of X(t-t0)|X(t0) = 0, X(T) = 0 at time t = 0.75

Data: x (4995 obs.);    Bandwidth 'bw' = 0.01767

       x               f(x)       
 Min.   :1.5289   Min.   :0.0001  
 1st Qu.:1.7658   1st Qu.:0.0225  
 Median :2.0028   Median :0.3520  
 Mean   :2.0028   Mean   :1.0540  
 3rd Qu.:2.2397   3rd Qu.:2.0086  
 Max.   :2.4767   Max.   :3.7813  

 Marginal density of Y(t-t0)|Y(t0) = -1, Y(T) = -2 at time t = 0.75

Data: y (4995 obs.);    Bandwidth 'bw' = 0.01106

       y                 f(y)       
 Min.   :-0.15324   Min.   :0.0001  
 1st Qu.:-0.01703   1st Qu.:0.0611  
 Median : 0.11919   Median :0.8573  
 Mean   : 0.11919   Mean   :1.8335  
 3rd Qu.: 0.25540   3rd Qu.:3.6108  
 Max.   : 0.39162   Max.   :5.8408  

 Marginal density of Z(t-t0)|Z(t0) = 0.5, Z(T) = 0.5 at time t = 0.75

Data: z (4995 obs.);    Bandwidth 'bw' = 0.02898

       z                 f(z)        
 Min.   :-1.20477   Min.   :0.00003  
 1st Qu.:-0.84918   1st Qu.:0.02555  
 Median :-0.49359   Median :0.31560  
 Mean   :-0.49359   Mean   :0.70237  
 3rd Qu.:-0.13800   3rd Qu.:1.35972  
 Max.   : 0.21759   Max.   :2.24703  
R> plot(denM, main="Marginal Density")

For an approximate joint density for triplet \(X_{t},Y_{t},Z_{t}|X_{0}=0,Y_{0}=-1,Z_{0}=0.5,X_{T}=0,Y_{T}=-2,Z_{T}=0.5\) at time \(t=0.75\) (for more details, see package sm or ks.)

R> denJ <- dsde3d(mod3,pdf="J",at=0.75)
R> plot(denJ,display="rgl")

Return to bridgesde3d()

Further reading

  1. snssdekd() & dsdekd() & rsdekd()- Monte-Carlo Simulation and Analysis of Stochastic Differential Equations.
  2. bridgesdekd() & dsdekd() & rsdekd() - Constructs and Analysis of Bridges Stochastic Differential Equations.
  3. fptsdekd() & dfptsdekd() - Monte-Carlo Simulation and Kernel Density Estimation of First passage time.
  4. MCM.sde() & MEM.sde() - Parallel Monte-Carlo and Moment Equations for SDEs.
  5. fitsde() - Parametric Estimation of 1-D Stochastic Differential Equation.

References

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

  2. Guidoum AC, Boukhetala K (2017). Sim.DiffProc: Simulation of Diffusion Processes. R package version 4.0, URL https://cran.r-project.org/package=Sim.DiffProc.


  1. Department of Probabilities & Statistics, Faculty of Mathematics, University of Science and Technology Houari Boumediene, BP 32 El-Alia, U.S.T.H.B, Algeria, E-mail (acguidoum@usthb.dz)

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