rsde2d {Sim.DiffProc} | R Documentation |
Approximate transitional densities and random generation for 2-D SDE's
Description
Transition density and random generation for the joint and marginal of (X(t-s),Y(t-s) | X(s)=x0,Y(s)=y0)
of the SDE's 2-d.
Usage
rsde2d(object, ...)
dsde2d(object, ...)
## Default S3 method:
rsde2d(object, at, ...)
## Default S3 method:
dsde2d(object, pdf=c("Joint","Marginal"), at, ...)
## S3 method for class 'dsde2d'
plot(x,display=c("persp","rgl","image","contour"),hist=FALSE,...)
Arguments
object |
an object inheriting from class |
at |
time between |
pdf |
probability density function |
x |
an object inheriting from class |
display |
display plots. |
hist |
if |
... |
potentially potentially arguments to be passed to methods, such as |
Details
The function rsde2d
returns a M
random variable realize at time
.
And dsde2d
returns a bivariate density approximation for (X(t-s),Y(t-s) | X(s)=x0,Y(s)=y0)
. with is a fixed time between
t0
and T
.
An overview of this package, see browseVignettes('Sim.DiffProc')
for more informations.
Value
dsde2d() |
gives the bivariate density approximation for |
rsde2d() |
generates random of the couple |
Author(s)
A.C. Guidoum, K. Boukhetala.
See Also
kde2d
Two-dimensional kernel density estimation in "MASS" package.
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.
rng
random number generators in "yuima" package.
BiGQD.density
Generate the transition density of a bivariate generalized quadratic diffusion model (2D GQD) in "DiffusionRgqd" package.
Examples
## Example:1
set.seed(1234)
# SDE's 2d
fx <- expression(3*(2-y),2*x)
gx <- expression(1,y)
mod2d <- snssde2d(drift=fx,diffusion=gx,x0=c(1,2),M=1000)
# random
r2d <- rsde2d(mod2d,at=0.5)
summary(r2d)
# Marginal density
denM <- dsde2d(mod2d,pdf="M", at=0.5)
denM
plot(denM)
# Joint density
denJ <- dsde2d(mod2d,pdf="J",n=200, at= 0.5,lims=c(-3,4,0,6))
denJ
plot(denJ)
plot(denJ,display="contour")
## Example 2: Bivariate Transition Density of 2 Brownian motion (W1(t),W2(t)) in [0,1]
## Not run:
B2d <- snssde2d(drift=rep(expression(0),2),diffusion=rep(expression(1),2),
M=10000)
for (i in seq(B2d$Dt,B2d$T,by=B2d$Dt)){
plot(dsde2d(B2d, at = i,lims=c(-3,3,-3,3),n=100),
display="contour",main=paste0('Transition Density \n t = ',i))
}
## End(Not run)
## Example 3:
## Not run:
fx <- expression(4*(-1-x)*y , 4*(1-y)*x )
gx <- expression(0.25*y,0.2*x)
mod2d1 <- snssde2d(drift=fx,diffusion=gx,x0=c(x0=1,y0=-1),
M=5000,type="str")
# Marginal transition density
for (i in seq(mod2d1$Dt,mod2d1$T,by=mod2d1$Dt)){
plot(dsde2d(mod2d1,pdf="M", at = i),main=
paste0('Marginal Transition Density \n t = ',i))
}
# Bivariate transition density
for (i in seq(mod2d1$Dt,mod2d1$T,by=mod2d1$Dt)){
plot(dsde2d(mod2d1, at = i,lims=c(-1,2,-1,1),n=100),
display="contour",main=paste0('Transition Density \n t = ',i))
}
## End(Not run)
## Example 4: Bivariate Transition Density of 2 bridge Brownian motion (W1(t),W2(t)) in [0,1]
## Not run:
B2d <- bridgesde2d(drift=rep(expression(0),2),
diffusion=rep(expression(1),2),M=5000)
for (i in seq(0.01,0.99,by=B2d$Dt)){
plot(dsde2d(B2d, at = i,lims=c(-3,3,-3,3),
n=100),display="contour",main=
paste0('Transition Density \n t = ',i))
}
## End(Not run)
## Example 5: Bivariate Transition Density of bridge
## Ornstein-Uhlenbeck process and its integral in [0,5]
## dX(t) = 4*(-1-X(t)) dt + 0.2 dW1(t)
## dY(t) = X(t) dt + 0 dW2(t)
## x01 = 0 , y01 = 0
## x02 = 0, y02 = 0
## Not run:
fx <- expression(4*(-1-x) , x)
gx <- expression(0.2 , 0)
OUI <- bridgesde2d(drift=fx,diffusion=gx,Dt=0.005,M=1000)
for (i in seq(0.01,4.99,by=OUI$Dt)){
plot(dsde2d(OUI, at = i,lims=c(-1.2,0.2,-2.5,0.2),n=100),
display="contour",main=paste0('Transition Density \n t = ',i))
}
## End(Not run)