Learn R Programming

Sim.DiffProc (version 4.9)

rsde3d: Approximate transitional densities and random generation for 3-D SDE's

Description

Transition density and random generation for the joint and marginal of (X(t-s),Y(t-s),Z(t-s) | X(s)=x0,Y(s)=y0,Z(s)=z0) of the SDE's 3-d.

Usage

rsde3d(object, ...)
dsde3d(object, ...)

# S3 method for default rsde3d(object, at, ...)

# S3 method for default dsde3d(object, pdf=c("Joint","Marginal"), at, ...) # S3 method for dsde3d plot(x,display="rgl",hist=FALSE,...)

Value

dsde3d()

gives the trivariate density approximation (X(t-s),Y(t-s),Z(t-s) | X(s)=x0,Y(s)=y0,Z(s)=z0).

rsde3d()

generates random of the (X(t-s),Y(t-s),Z(t-s) | X(s)=x0,Y(s)=y0,Z(s)=z0).

Arguments

object

an object inheriting from class snssde3d and bridgesde3d.

at

time between s=t0 and t=T. The default at = T.

pdf

probability density function Joint or Marginal.

x

an object inheriting from class dsde3d.

display

display plots.

hist

if hist=TRUE plot histogram. Based on truehist function.

...

potentially arguments to be passed to methods, such as density for marginal density and sm.density for joint density.

Author

A.C. Guidoum, K. Boukhetala.

Details

The function rsde3d returns a M random variable \(x_{t=at},y_{t=at},z_{t=at}\) realize at time \(t=at\).

fig05

And dsde3d returns a trivariate kernel density approximation for (X(t-s),Y(t-s),Z(t-s) | X(s)=x0,Y(s)=y0,Z(s)=z0). with \(t= at \) is a fixed time between t0 and T.

fig06

An overview of this package, see browseVignettes('Sim.DiffProc') for more informations.

See Also

kde Kernel density estimate for 1- to 6-dimensional data in "ks" package.

sm.density Nonparametric density estimation in one, two or three dimensions in "sm" package.

kde3d Compute a three dimension kernel density estimate in "misc3d" package.

rng random number generators in "yuima" package.

rcBS, rcCIR, rcOU and rsOU in package "sde".

Examples

Run this code

## Example 1: Ito sde
## dX(t) = (2*(Y(t)>0)-2*(Z(t)<=0)) dt + 0.2 * dW1(t) 
## dY(t) = -2*Y(t) dt + 0.2 * dW2(t) 
## dZ(t) = -2*Z(t) dt + 0.2 * dW3(t)        
## W1(t), W2(t) and W3(t) three independent Brownian motion
set.seed(1234)
fx <- expression(2*(y>0)-2*(z<=0) , -2*y, -2*z)
gx <- rep(expression(0.2),3)
mod3d1 <- snssde3d(x0=c(0,2,-2),drift=fx,diffusion=gx,M=1000,Dt=0.003)

# random at t= 0.75
r3d1 <- rsde3d(mod3d1,at=0.75)
summary(r3d1)

# Marginal transition density at t=0.75, t0=0

denM <- dsde3d(mod3d1,pdf="M",at=0.75)
denM
plot(denM)

# for Joint transition density at t=0.75;t0=0 
# Multiple isosurfaces
if (FALSE) {
denJ <- dsde3d(mod3d1,pdf="J", at= 0.75)
denJ
plot(denJ,display="rgl")
}

## Example 2: Stratonovich sde
## dX(t) = Y(t)* dt + X(t) o dW1(t)          
## dY(t) = (4*( 1-X(t)^2 )* Y(t) - X(t))* dt + 0.2 o dW2(t)
## dZ(t) = (4*( 1-X(t)^2 )* Z(t) - X(t))* dt + 0.2 o dW3(t)
set.seed(1234)

fx <- expression( y , (4*( 1-x^2 )* y - x), (4*( 1-x^2 )* z - x))
gx <- expression( x , 0.2, 0.2)
mod3d2 <- snssde3d(drift=fx,diffusion=gx,M=1000,type="str")

# random 
r3d2 <- rsde3d(mod3d2)
summary(r3d2)

# Marginal transition density at t=1, t0=0

denM <- dsde3d(mod3d2,pdf="M")
denM
plot(denM)

# for Joint transition density at t=1;t0=0
# Multiple isosurfaces
if (FALSE) {
denJ <- dsde3d(mod3d2,pdf="J")
denJ
plot(denJ,display="rgl")
}

## Example 3: Tivariate Transition Density of 3 Brownian motion (W1(t),W2(t),W3(t)) in [0,1]

if (FALSE) {
B3d <- snssde3d(drift=rep(expression(0),3),diffusion=rep(expression(1),3),M=500)
for (i in seq(B3d$Dt,B3d$T,by=B3d$Dt)){
plot(dsde3d(B3d, at = i,pdf="J"),box=F,main=paste0('Transition Density t = ',i))
}
}

Run the code above in your browser using DataLab