Constructs and Analysis of Bridges Stochastic Differential Equations

A.C. Guidoum1 and K. Boukhetala2

2018-09-10

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 = 4887 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 4887 among 5000
                            
Mean                 1.99047
Variance             1.68836
Median               1.66638
Mode                 1.20559
First quartile       1.14759
Third quartile       2.43640
Minimum              0.26261
Maximum             21.95516
Skewness             2.89675
Kurtosis            23.22497
Coef-variation       0.65279
3th-order moment     6.35488
4th-order moment    66.20395
5th-order moment   927.76759
6th-order moment 15762.45036

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.8889
R> moment(mod, at = s , center = TRUE , order = 2) ## variance
[1] 1.6047
R> Median(mod, at = s)
[1] 1.5553
R> Mode(mod, at = s)
[1] 1.1819
R> quantile(mod , at = s)
      0%      25%      50%      75%     100% 
 0.24517  1.08343  1.55526  2.28799 19.51415 
R> kurtosis(mod , at = s)
[1] 22.48
R> skewness(mod , at = s)
[1] 3.0465
R> cv(mod , at = s )
[1] 0.6707
R> min(mod , at = s)
[1] 0.24517
R> max(mod , at = s)
[1] 19.514
R> moment(mod, at = s , center= TRUE , order = 4)
[1] 57.911
R> moment(mod, at = s , center= FALSE , order = 4)
[1] 151.8

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 4887 among 5000
                           
Mean                1.88892
Variance            1.60504
Median              1.55526
Mode                1.18187
First quartile      1.08343
Third quartile      2.28799
Minimum             0.24517
Maximum            19.51415
Skewness            3.04647
Kurtosis           22.47991
Coef-variation      0.67070
3th-order moment    6.19477
4th-order moment   57.91149
5th-order moment  681.47492
6th-order moment 9565.26028

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.21014 3.09950 2.17252 1.03385 2.81539 0.69328 0.97909 2.76190
 [9] 1.09426 1.34471
R> summary(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.245   1.083   1.555   1.889   2.288  19.514 

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

       x                f(x)        
 Min.   :-0.1987   Min.   :0.00000  
 1st Qu.: 4.8405   1st Qu.:0.00001  
 Median : 9.8797   Median :0.00084  
 Mean   : 9.8797   Mean   :0.04956  
 3rd Qu.:14.9188   3rd Qu.:0.01847  
 Max.   :19.9580   Max.   :0.53919  
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) = -(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 = 4996 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 4996 among 5000
                        X         Y
Mean              0.00652   0.00048
Variance          0.02041   0.00519
Median            0.00655   0.00111
Mode              0.01153   0.00584
First quartile   -0.08829  -0.04528
Third quartile    0.10336   0.04699
Minimum          -0.54448  -0.41082
Maximum           0.55540   0.31805
Skewness         -0.00272  -0.06595
Kurtosis          3.00850   3.57324
Coef-variation   21.92481 149.37067
3th-order moment -0.00001  -0.00002
4th-order moment  0.00125   0.00010
5th-order moment  0.00000   0.00000
6th-order moment  0.00013   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.0276908 0.0084453
R> moment(mod2, at = s , center = TRUE , order = 2) ## variance
[1] 0.0195837 0.0045949
R> Median(mod2, at = s)
[1] 0.0274272 0.0080058
R> Mode(mod2, at = s)
[1] 0.0058589 0.0043362
R> quantile(mod2 , at = s)
$x
       0%       25%       50%       75%      100% 
-0.569030 -0.067677  0.027427  0.122797  0.529930 

$y
        0%        25%        50%        75%       100% 
-0.2279534 -0.0370276  0.0080058  0.0524257  0.3335869 
R> kurtosis(mod2 , at = s)
[1] 2.9910 3.3644
R> skewness(mod2 , at = s)
[1] 0.016196 0.083420
R> cv(mod2 , at = s )
[1] 5.0542 8.0273
R> min(mod2 , at = s)
[1] -0.56903 -0.22795
R> max(mod2 , at = s)
[1] 0.52993 0.33359
R> moment(mod2 , at = s , center= TRUE , order = 4)
[1] 0.001147577 0.000071063
R> moment(mod2 , at = s , center= FALSE , order = 4)
[1] 0.001243181 0.000073912

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 4996 among 5000
                        X        Y
Mean              0.02769  0.00845
Variance          0.01959  0.00460
Median            0.02743  0.00801
Mode              0.00586  0.00434
First quartile   -0.06768 -0.03703
Third quartile    0.12280  0.05243
Minimum          -0.56903 -0.22795
Maximum           0.52993  0.33359
Skewness          0.01620  0.08342
Kurtosis          2.99101  3.36443
Coef-variation    5.05423  8.02727
3th-order moment  0.00004  0.00003
4th-order moment  0.00115  0.00007
5th-order moment  0.00000  0.00000
6th-order moment  0.00011  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.052737 -0.051129
2  -0.059465  0.027146
3  -0.032389  0.099025
4   0.154529 -0.139782
5   0.174460  0.055512
6   0.126719 -0.074817
7   0.175904 -0.020664
8  -0.069990 -0.034521
9  -0.197377 -0.084844
10 -0.087435  0.076491
R> summary(x2)
       x                 y           
 Min.   :-0.5690   Min.   :-0.22795  
 1st Qu.:-0.0677   1st Qu.:-0.03703  
 Median : 0.0274   Median : 0.00801  
 Mean   : 0.0277   Mean   : 0.00845  
 3rd Qu.: 0.1228   3rd Qu.: 0.05243  
 Max.   : 0.5299   Max.   : 0.33359  

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

       x                 f(x)        
 Min.   :-0.63784   Min.   :0.00004  
 1st Qu.:-0.32869   1st Qu.:0.01019  
 Median :-0.01955   Median :0.25508  
 Mean   :-0.01955   Mean   :0.80790  
 3rd Qu.: 0.28959   3rd Qu.:1.56059  
 Max.   : 0.59874   Max.   :2.75304  

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

Data: y (4996 obs.);    Bandwidth 'bw' = 0.01094

       y                 f(y)       
 Min.   :-0.26077   Min.   :0.0001  
 1st Qu.:-0.10398   1st Qu.:0.0396  
 Median : 0.05282   Median :0.4317  
 Mean   : 0.05282   Mean   :1.5929  
 3rd Qu.: 0.20961   3rd Qu.:2.9777  
 Max.   : 0.36641   Max.   :5.8921  
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 4996 obs.);

       x                  y                f(x,y)       
 Min.   :-0.56903   Min.   :-0.22795   Min.   : 0.0000  
 1st Qu.:-0.29429   1st Qu.:-0.08757   1st Qu.: 0.0006  
 Median :-0.01955   Median : 0.05282   Median : 0.1155  
 Mean   :-0.01955   Mean   : 0.05282   Mean   : 1.5873  
 3rd Qu.: 0.25519   3rd Qu.: 0.19320   3rd Qu.: 1.2435  
 Max.   : 0.52993   Max.   : 0.33359   Max.   :17.5880  
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 = 4997 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 4997 among 5000
                        X        Y        Z
Mean              0.68476  0.50814  0.13153
Variance          0.01096  0.00699  0.01858
Median            0.68537  0.51003  0.13334
Mode              0.68359  0.51193  0.15272
First quartile    0.61898  0.45329  0.04146
Third quartile    0.75491  0.56244  0.21918
Minimum           0.20120  0.19913 -0.38649
Maximum           1.07982  0.87981  0.62700
Skewness         -0.22328 -0.04394  0.03937
Kurtosis          3.52565  3.22149  3.17931
Coef-variation    0.15288  0.16455  1.03628
3th-order moment -0.00026 -0.00003  0.00010
4th-order moment  0.00042  0.00016  0.00110
5th-order moment -0.00004  0.00000  0.00002
6th-order moment  0.00003  0.00001  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.99606  0.12313 -0.49911
R> moment(mod3, at = s , center = TRUE , order = 2) ## variance
[1] 0.0114860 0.0046408 0.0313156
R> Median(mod3, at = s)
[1]  1.99583  0.12392 -0.49743
R> Mode(mod3, at = s)
[1]  2.01020  0.13022 -0.50230
R> quantile(mod3 , at = s)
$x
    0%    25%    50%    75%   100% 
1.6492 1.9231 1.9958 2.0686 2.3415 

$y
       0%       25%       50%       75%      100% 
-0.146289  0.078409  0.123924  0.168586  0.369169 

$z
      0%      25%      50%      75%     100% 
-1.16145 -0.61586 -0.49743 -0.37919  0.14239 
R> kurtosis(mod3 , at = s)
[1] 2.8462 3.1230 2.9764
R> skewness(mod3 , at = s)
[1] -0.00007621 -0.08858797 -0.05841234
R> cv(mod3 , at = s )
[1]  0.053698  0.553330 -0.354594
R> min(mod3 , at = s)
[1]  1.64921 -0.14629 -1.16145
R> max(mod3 , at = s)
[1] 2.34153 0.36917 0.14239
R> moment(mod3 , at = s , center= TRUE , order = 4)
[1] 0.000375651 0.000067288 0.002920024
R> moment(mod3 , at = s , center= FALSE , order = 4)
[1] 16.14921098  0.00070548  0.11242655

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 4997 among 5000
                        X        Y        Z
Mean              1.99606  0.12313 -0.49911
Variance          0.01149  0.00464  0.03132
Median            1.99583  0.12392 -0.49743
Mode              2.01020  0.13022 -0.50230
First quartile    1.92314  0.07841 -0.61586
Third quartile    2.06861  0.16859 -0.37919
Minimum           1.64921 -0.14629 -1.16145
Maximum           2.34153  0.36917  0.14239
Skewness         -0.00008 -0.08859 -0.05841
Kurtosis          2.84623  3.12302  2.97639
Coef-variation    0.05370  0.55333 -0.35459
3th-order moment  0.00000 -0.00003 -0.00032
4th-order moment  0.00038  0.00007  0.00292
5th-order moment  0.00000  0.00000 -0.00009
6th-order moment  0.00002  0.00000  0.00043

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.9177  0.077976 -0.17318
2  2.0182 -0.012863 -0.55599
3  2.1491  0.134472 -0.30349
4  2.1932  0.031635 -0.36818
5  2.0641  0.259634 -0.42586
6  2.1191  0.181361 -0.67260
7  2.0746  0.083116 -0.68507
8  2.0577  0.167392 -0.51550
9  2.0138  0.081222 -0.67765
10 1.9741  0.128047 -0.57706
R> summary(x3)
       x              y                 z         
 Min.   :1.65   Min.   :-0.1463   Min.   :-1.161  
 1st Qu.:1.92   1st Qu.: 0.0784   1st Qu.:-0.616  
 Median :2.00   Median : 0.1239   Median :-0.497  
 Mean   :2.00   Mean   : 0.1231   Mean   :-0.499  
 3rd Qu.:2.07   3rd Qu.: 0.1686   3rd Qu.:-0.379  
 Max.   :2.34   Max.   : 0.3692   Max.   : 0.142  

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

       x               f(x)       
 Min.   :1.5965   Min.   :0.0001  
 1st Qu.:1.7959   1st Qu.:0.0622  
 Median :1.9954   Median :0.7275  
 Mean   :1.9954   Mean   :1.2524  
 3rd Qu.:2.1948   3rd Qu.:2.3771  
 Max.   :2.3942   Max.   :3.6315  

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

Data: y (4997 obs.);    Bandwidth 'bw' = 0.01103

       y                 f(y)       
 Min.   :-0.17937   Min.   :0.0001  
 1st Qu.:-0.03397   1st Qu.:0.0382  
 Median : 0.11144   Median :0.6067  
 Mean   : 0.11144   Mean   :1.7176  
 3rd Qu.: 0.25685   3rd Qu.:3.2878  
 Max.   : 0.40225   Max.   :5.9221  

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

Data: z (4997 obs.);    Bandwidth 'bw' = 0.02894

       z                 f(z)        
 Min.   :-1.24828   Min.   :0.00003  
 1st Qu.:-0.87890   1st Qu.:0.01448  
 Median :-0.50953   Median :0.28973  
 Mean   :-0.50953   Mean   :0.67616  
 3rd Qu.:-0.14016   3rd Qu.:1.26493  
 Max.   : 0.22922   Max.   :2.26311  
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.1, 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)