rsde1d: Approximate transitional densities and random generation for...

View source: R/rsde.R

rsde1dR Documentation

Approximate transitional densities and random generation for 1-D SDE

Description

Transition density and random generation for X(t-s) | X(s)=x0 of the 1-dim SDE.

Usage

rsde1d(object, ...)
dsde1d(object, ...)

## Default S3 method:
rsde1d(object, at, ...)

## Default S3 method:
dsde1d(object, at, ...)
## S3 method for class 'dsde1d'
plot(x,hist=FALSE, ...)

Arguments

object

an object inheriting from class snssde1d and bridgesde1d.

at

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

x

an object inheriting from class dsde1d.

hist

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

...

potentially arguments to be passed to methods, such as density for kernel density.

Details

The function rsde1d returns a M random variable x_{t=at} realize at time t=at defined by :

x_{ t=at } = \{ t \geq 0 ; x = X_{ t=at } \}

fig01

And dsde1d returns a transition density approximation for X(t-s) | X(s)=x0. with t= at is a fixed time between t0 and T.

fig02

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

Value

dsde1d()

gives the transition density estimate of X(t-s) | X(s)=x0.

rsde1d()

generates random of X(t-s) | X(s)=x0.

Author(s)

A.C. Guidoum, K. Boukhetala.

See Also

density Kernel density estimation in "stats" 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.

dcSim Pedersen's simulated transition density in "sde" package.

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

dcBS, dcCIR, dcOU and dsOU in package "sde".

GQD.density Generate the transition density of a scalar generalized quadratic diffusion in "DiffusionRgqd" package.

Examples


## Example 1:  
## dX(t) = (-2*(X(t)<=0)+2*(X(t)>=0)) *dt + 0.5 * dW(t)
set.seed(1234)

f <- expression(-2*(x<=0)+2*(x>=0))
g <- expression(0.5)
res1 <- snssde1d(drift=f,diffusion=g,M=5000)
x <- rsde1d(res1, at = 1)
summary(x)
dens1 <-  dsde1d(res1, at = 1)
dens1
plot(dens1,main="Transition density of X(t=1)|X(s=0)=0") # kernel estimated
plot(dens1,hist=TRUE) # histogramme

## Example 2:
## Transition density of standard Brownian motion W(t) at time = 0.5
set.seed(1234)

f <- expression(0)
g <- expression(1)
res2 <- snssde1d(drift=f,diffusion=g,M=5000)
plot(dsde1d(res2, at = 0.5),dens=function(x) dnorm(x,0,sqrt(0.5)))
plot(dsde1d(res2, at = 0.5),dens=function(x) dnorm(x,0,sqrt(0.5)),hist=TRUE)

## Example 3: Transition density of Brownian motion W(t) in [0,1]

## Not run: 
for (i in seq(res2$t0,res2$T,by=res2$Dt)){
plot(dsde1d(res2, at = i),main=paste0('Transition Density \n t = ',i))
}

## End(Not run)

## Example 4:
## Transition density of bridge Brownian motion W(t) at time = 0.25 and 0.75 
set.seed(1234)
## Not run: 
f <- expression(0)
g <- expression(1)
Bd <- bridgesde1d(drift=f,diffusion=g,M=5000)
Bd
plot(dsde1d(Bd, at = 0.25))         ## Transition Density at time=0.25
plot(dsde1d(Bd, at = 0.75),add=TRUE)## Transition Density at time=0.75

## End(Not run)

Sim.DiffProc documentation built on May 29, 2024, 8:09 a.m.