Constructs and Analysis of Bridges Stochastic Differential Equations

A.C. Guidoum1 and K. Boukhetala2

2018-10-17

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 \(1000\) 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=1000,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 = 969 among 1000.
    | 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 969 among 1000
                           
Mean                1.99633
Variance            1.68234
Median              1.63854
Mode                1.20091
First quartile      1.12992
Third quartile      2.47647
Minimum             0.28446
Maximum            11.31831
Skewness            2.16858
Kurtosis           10.50985
Coef-variation      0.64972
3th-order moment    4.73203
4th-order moment   29.74570
5th-order moment  195.18963
6th-order moment 1466.57231

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.9133
R> moment(mod, at = s , center = TRUE , order = 2) ## variance
[1] 1.8066
R> Median(mod, at = s)
[1] 1.574
R> Mode(mod, at = s)
[1] 1.0493
R> quantile(mod , at = s)
      0%      25%      50%      75%     100% 
 0.38514  1.03459  1.57398  2.32453 17.82485 
R> kurtosis(mod , at = s)
[1] 27.906
R> skewness(mod , at = s)
[1] 3.398
R> cv(mod , at = s )
[1] 0.70287
R> min(mod , at = s)
[1] 0.38514
R> max(mod , at = s)
[1] 17.825
R> moment(mod, at = s , center= TRUE , order = 4)
[1] 91.267
R> moment(mod, at = s , center= FALSE , order = 4)
[1] 207.59

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 969 among 1000
                            
Mean                 1.91328
Variance             1.80844
Median               1.57398
Mode                 1.04934
First quartile       1.03459
Third quartile       2.32453
Minimum              0.38514
Maximum             17.82485
Skewness             3.39796
Kurtosis            27.90642
Coef-variation       0.70287
3th-order moment     8.26372
4th-order moment    91.26714
5th-order moment  1212.20003
6th-order moment 17899.61922

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.68801 0.76792 1.77977 0.94930 1.04856 1.65776 3.65794 3.48042
 [9] 1.11518 1.46935
R> summary(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.385   1.035   1.574   1.913   2.325  17.825 

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 (969 obs.); Bandwidth 'bw' = 0.219

       x                f(x)        
 Min.   :-0.2719   Min.   :0.00000  
 1st Qu.: 4.4166   1st Qu.:0.00000  
 Median : 9.1050   Median :0.00150  
 Mean   : 9.1050   Mean   :0.05327  
 3rd Qu.:13.7934   3rd Qu.:0.03041  
 Max.   :18.4819   Max.   :0.50401  
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 \(1000\) 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=1000,type="str",method="rk1")
R> mod2
Stratonovich Bridge Sde 2D:
    | dX(t) = -(1 + Y(t)) * X(t) * dt + 0.2 * (1 - Y(t)) o dW1(t)
    | dY(t) = -(1 + X(t)) * Y(t) * dt + 0.1 * (1 - X(t)) o dW2(t)
Method:
    | Runge-Kutta method with order 1
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.
R> summary(mod2) ## default: summary at time = (T-t0)/2

Monte-Carlo Statistics for (X(t),Y(t)) at time t = 5
    | Crossing realized 1000 among 1000
                        X         Y
Mean              0.00615  -0.00501
Variance          0.02257   0.00489
Median            0.00622  -0.00631
Mode              0.00224  -0.01022
First quartile   -0.09538  -0.05133
Third quartile    0.10514   0.03854
Minimum          -0.44747  -0.24572
Maximum           0.52315   0.26916
Skewness          0.09847   0.10447
Kurtosis          3.20067   3.28901
Coef-variation   24.44751 -13.97160
3th-order moment  0.00033   0.00004
4th-order moment  0.00163   0.00008
5th-order moment  0.00008   0.00000
6th-order moment  0.00020   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.042307 0.010663
R> moment(mod2, at = s , center = TRUE , order = 2) ## variance
[1] 0.0181854 0.0046176
R> Median(mod2, at = s)
[1] 0.043937 0.012868
R> Mode(mod2, at = s)
[1] 0.053067 0.020458
R> quantile(mod2 , at = s)
$x
       0%       25%       50%       75%      100% 
-0.350029 -0.050854  0.043937  0.131716  0.473898 

$y
       0%       25%       50%       75%      100% 
-0.223561 -0.034450  0.012868  0.054959  0.227391 
R> kurtosis(mod2 , at = s)
[1] 2.8539 3.2925
R> skewness(mod2 , at = s)
[1]  0.040691 -0.056701
R> cv(mod2 , at = s )
[1] 3.1891 6.3757
R> min(mod2 , at = s)
[1] -0.35003 -0.22356
R> max(mod2 , at = s)
[1] 0.47390 0.22739
R> moment(mod2 , at = s , center= TRUE , order = 4)
[1] 0.000945700 0.000070342
R> moment(mod2 , at = s , center= FALSE , order = 4)
[1] 0.001161118 0.000072746

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 1000 among 1000
                        X        Y
Mean              0.04231  0.01066
Variance          0.01820  0.00462
Median            0.04394  0.01287
Mode              0.05307  0.02046
First quartile   -0.05085 -0.03445
Third quartile    0.13172  0.05496
Minimum          -0.35003 -0.22356
Maximum           0.47390  0.22739
Skewness          0.04069 -0.05670
Kurtosis          2.85390  3.29247
Coef-variation    3.18906  6.37567
3th-order moment  0.00010 -0.00002
4th-order moment  0.00095  0.00007
5th-order moment  0.00002  0.00000
6th-order moment  0.00008  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.019149  0.0453936
2   0.079367  0.0907089
3   0.080259 -0.0062758
4  -0.010031  0.0250397
5  -0.046938  0.0663944
6  -0.099898 -0.0410747
7   0.269731 -0.0367088
8   0.152037  0.0085386
9  -0.090118 -0.0115128
10  0.139334  0.0325991
R> summary(x2)
       x                 y          
 Min.   :-0.3500   Min.   :-0.2236  
 1st Qu.:-0.0508   1st Qu.:-0.0345  
 Median : 0.0439   Median : 0.0129  
 Mean   : 0.0423   Mean   : 0.0107  
 3rd Qu.: 0.1317   3rd Qu.: 0.0550  
 Max.   : 0.4739   Max.   : 0.2274  

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 (1000 obs.);    Bandwidth 'bw' = 0.0305

       x                 f(x)        
 Min.   :-0.44153   Min.   :0.00015  
 1st Qu.:-0.18980   1st Qu.:0.07301  
 Median : 0.06193   Median :0.60842  
 Mean   : 0.06193   Mean   :0.99214  
 3rd Qu.: 0.31367   3rd Qu.:1.79505  
 Max.   : 0.56540   Max.   :3.13731  

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

Data: y (1000 obs.);    Bandwidth 'bw' = 0.01508

       y                  f(y)       
 Min.   :-0.268813   Min.   :0.0003  
 1st Qu.:-0.133449   1st Qu.:0.1294  
 Median : 0.001915   Median :0.8270  
 Mean   : 0.001915   Mean   :1.8451  
 3rd Qu.: 0.137279   3rd Qu.:3.6089  
 Max.   : 0.272643   Max.   :6.1753  
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 1000 obs.);

       x                  y                 f(x,y)       
 Min.   :-0.35003   Min.   :-0.223561   Min.   : 0.0000  
 1st Qu.:-0.14405   1st Qu.:-0.110823   1st Qu.: 0.1623  
 Median : 0.06193   Median : 0.001915   Median : 0.7651  
 Mean   : 0.06193   Mean   : 0.001915   Mean   : 2.6280  
 3rd Qu.: 0.26792   3rd Qu.: 0.114653   3rd Qu.: 3.4127  
 Max.   : 0.47390   Max.   : 0.227391   Max.   :20.2096  
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 \(1000\) 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=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 = 999 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.
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 999 among 1000
                        X       Y        Z
Mean              0.68355 0.50528  0.11996
Variance          0.00959 0.00694  0.01694
Median            0.68231 0.50458  0.12185
Mode              0.67204 0.49738  0.12774
First quartile    0.61941 0.44655  0.03952
Third quartile    0.74895 0.55884  0.20305
Minimum           0.29478 0.26058 -0.39210
Maximum           1.04413 0.73765  0.59136
Skewness         -0.09931 0.00026 -0.19294
Kurtosis          3.56520 2.73325  3.47568
Coef-variation    0.14328 0.16489  1.08502
3th-order moment -0.00009 0.00000 -0.00043
4th-order moment  0.00033 0.00013  0.00100
5th-order moment -0.00001 0.00000 -0.00010
6th-order moment  0.00002 0.00000  0.00011

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.99336  0.11872 -0.51284
R> moment(mod3, at = s , center = TRUE , order = 2) ## variance
[1] 0.0099619 0.0043353 0.0333037
R> Median(mod3, at = s)
[1]  1.99438  0.11787 -0.50811
R> Mode(mod3, at = s)
[1]  2.01312  0.10984 -0.47086
R> quantile(mod3 , at = s)
$x
    0%    25%    50%    75%   100% 
1.6693 1.9246 1.9944 2.0636 2.3853 

$y
       0%       25%       50%       75%      100% 
-0.096136  0.076739  0.117868  0.165799  0.352688 

$z
      0%      25%      50%      75%     100% 
-1.07575 -0.64087 -0.50811 -0.39409  0.16610 
R> kurtosis(mod3 , at = s)
[1] 3.0995 3.2287 3.1300
R> skewness(mod3 , at = s)
[1]  0.038879 -0.036829 -0.024780
R> cv(mod3 , at = s )
[1]  0.050096  0.554881 -0.356025
R> min(mod3 , at = s)
[1]  1.669258 -0.096136 -1.075755
R> max(mod3 , at = s)
[1] 2.38531 0.35269 0.16610
R> moment(mod3 , at = s , center= TRUE , order = 4)
[1] 0.000308211 0.000060805 0.003478563
R> moment(mod3 , at = s , center= FALSE , order = 4)
[1] 16.02659619  0.00062109  0.12551519

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 999 among 1000
                       X        Y        Z
Mean             1.99336  0.11872 -0.51284
Variance         0.00997  0.00434  0.03334
Median           1.99438  0.11787 -0.50811
Mode             2.01312  0.10984 -0.47086
First quartile   1.92464  0.07674 -0.64087
Third quartile   2.06361  0.16580 -0.39409
Minimum          1.66926 -0.09614 -1.07575
Maximum          2.38531  0.35269  0.16610
Skewness         0.03888 -0.03683 -0.02478
Kurtosis         3.09954  3.22872  3.13000
Coef-variation   0.05010  0.55488 -0.35602
3th-order moment 0.00004 -0.00001 -0.00015
4th-order moment 0.00031  0.00006  0.00348
5th-order moment 0.00001  0.00000  0.00006
6th-order moment 0.00002  0.00000  0.00060

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  1.8393 0.103766 -0.33912
2  1.9585 0.167583 -0.35105
3  2.0859 0.016888 -0.29588
4  2.1415 0.140960 -0.25574
5  1.7273 0.215792 -0.39200
6  2.0653 0.020544 -0.58251
7  2.1246 0.142620 -0.73805
8  1.9357 0.124305 -0.80494
9  1.9637 0.124545 -0.80851
10 1.9665 0.199791 -0.67566
R> summary(x3)
       x              y                 z         
 Min.   :1.67   Min.   :-0.0961   Min.   :-1.076  
 1st Qu.:1.92   1st Qu.: 0.0767   1st Qu.:-0.641  
 Median :1.99   Median : 0.1179   Median :-0.508  
 Mean   :1.99   Mean   : 0.1187   Mean   :-0.513  
 3rd Qu.:2.06   3rd Qu.: 0.1658   3rd Qu.:-0.394  
 Max.   :2.39   Max.   : 0.3527   Max.   : 0.166  

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 (999 obs.); Bandwidth 'bw' = 0.02258

       x               f(x)       
 Min.   :1.6015   Min.   :0.0002  
 1st Qu.:1.8144   1st Qu.:0.0291  
 Median :2.0273   Median :0.3420  
 Mean   :2.0273   Mean   :1.1732  
 3rd Qu.:2.2402   3rd Qu.:2.4774  
 Max.   :2.4531   Max.   :3.7658  

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

Data: y (999 obs.); Bandwidth 'bw' = 0.0149

       y                 f(y)       
 Min.   :-0.14082   Min.   :0.0003  
 1st Qu.:-0.00627   1st Qu.:0.1037  
 Median : 0.12828   Median :0.7921  
 Mean   : 0.12828   Mean   :1.8562  
 3rd Qu.: 0.26283   3rd Qu.:3.5932  
 Max.   : 0.39737   Max.   :6.3759  

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

Data: z (999 obs.); Bandwidth 'bw' = 0.04129

       z                 f(z)        
 Min.   :-1.19961   Min.   :0.00011  
 1st Qu.:-0.82722   1st Qu.:0.02757  
 Median :-0.45483   Median :0.32151  
 Mean   :-0.45483   Mean   :0.67068  
 3rd Qu.:-0.08244   3rd Qu.:1.31164  
 Max.   : 0.28995   Max.   :2.13085  
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. TEX.sde() - Converting Sim.DiffProc Objects to LaTeX.
  6. 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 (2018). Sim.DiffProc: Simulation of Diffusion Processes. R package version 4.2, 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)