Learn R Programming

Sim.DiffProc (version 2.7)

fptsde2d: First Passage Time in 2-Dim SDE

Description

The (S3) generic function fptsde2d for simulate first-passage-time (f.p.t) in 2-dim stochastic differential equations.

Usage

fptsde2d(N, ...)
## S3 method for class 'default':
fptsde2d(N = 100, M = 10, x0 = 0, y0 = 0, t0 = 0, T = 1, Dt, c = 0.5, 
   driftx, diffx, drifty, diffy, alpha = 0.5, mu = 0.5, type = c("ito", "str"), 
   method = c("euler", "milstein", "predcorr", "smilstein", "taylor", 
   "heun", "rk1", "rk2", "rk3"), ...)		

   
## S3 method for class 'fptsde2d':
summary(object, \dots)	
## S3 method for class 'fptsde2d':
mean(x, \dots)
## S3 method for class 'fptsde2d':
median(x, \dots)
## S3 method for class 'fptsde2d':
quantile(x, \dots)
## S3 method for class 'fptsde2d':
kurtosis(x, \dots)
## S3 method for class 'fptsde2d':
skewness(x, \dots)
## S3 method for class 'fptsde2d':
moment(x, order = 2, \dots)
## S3 method for class 'fptsde2d':
bconfint(x, level=0.95, \dots)

Arguments

N
size of sde.
M
size of fpt.
x0
initial value of the process $X_{t}$ at time t0.
y0
initial value of the process $Y_{t}$ at time t0.
t0
initial time.
T
final time.
Dt
time step of the simulation (discretization). If it is missing a default $\Delta t = \frac{T-t_{0}}{N}$.
c
boundary or barrier (threshold).
driftx
drift coefficient: an expression of three variables t, x and y for process $X_t$.
diffx
diffusion coefficient: an expression of three variables t, x and y for process $X_t$.
drifty
drift coefficient: an expression of three variables t, x and y for process $Y_t$.
diffy
diffusion coefficient: an expression of three variables t, x and y for process $Y_t$.
alpha
weight alpha of the predictor-corrector scheme; the default alpha = 0.5.
mu
weight mu of the predictor-corrector scheme; the default mu = 0.5.
type
sde of the type Ito or Stratonovich.
method
numerical methods of simulation, the default method = "euler"; see snssde2d.
x, object
an object inheriting from class "fptsde2d".
order
order of moment.
level
the confidence level required.
...
further arguments for (non-default) methods.

Value

  • fptsde2d returns an object inheriting from class "fptsde2d".
  • tau_x, tau_ya vector of couple 'fpt' $(\tau_{c}(x),\tau_{c}(y))$.

newcommand

\CRANpkg

href

http://CRAN.R-project.org/package=#1

pkg

#1

Details

The function fptsde2d returns a random variables $\tau_{c}(x)$ and $\tau_{c}(y)$ "first passage time" for $(X(t),Y(t))$, defined by : $$\tau_{c}(x) = { t \geq 0 ; X_{t} \geq c },\quad if \quad (x_{0} < c)$$ $$\tau_{c}(y) = { t \geq 0 ; Y_{t} \geq c },\quad if \quad (y_{0} < c)$$ and $$\tau_{c}(x) = { t \geq 0 ; X_{t} \leq c },\quad if \quad (x_{0} > c)$$ $$\tau_{c}(y) = { t \geq 0 ; Y_{t} \leq c },\quad if \quad (y_{0} > c)$$ with $c$ is a fixed boundary or barrier.

References

Argyrakisa, P. and G.H. Weiss (2006). A first-passage time problem for many random walkers. Physica A. 363, 343--347. Aytug H., G. J. Koehler (2000). New stopping criterion for genetic algorithms. European Journal of Operational Research, 126, 662--674. Boukhetala, K. (1996) Modelling and simulation of a dispersion pollutant with attractive centre. ed by Computational Mechanics Publications, Southampton ,U.K and Computational Mechanics Inc, Boston, USA, 245--252. Boukhetala, K. (1998a). Estimation of the first passage time distribution for a simulated diffusion process. Maghreb Math.Rev, 7(1), 1--25. Boukhetala, K. (1998b). Kernel density of the exit time in a simulated diffusion. les Annales Maghrebines De L ingenieur, 12, 587--589. Ding, M. and G. Rangarajan. (2004). First Passage Time Problem: A Fokker-Planck Approach. New Directions in Statistical Physics. ed by L. T. Wille. Springer. 31--46. Roman, R.P., Serrano, J. J., Torres, F. (2008). First-passage-time location function: Application to determine first-passage-time densities in diffusion processes. Computational Statistics and Data Analysis. 52, 4132--4146. Roman, R.P., Serrano, J. J., Torres, F. (2012). An R package for an efficient approximation of first-passage-time densities for diffusion processes based on the FPTL function. Applied Mathematics and Computation, 218, 8408--8428. Roman, R.P., Serrano, J. J., Torres, F. (2013). fptdApprox: Approximation of first-passage-time densities for diffusion processes. Rpackage version 2.0. Gardiner, C. W. (1997). Handbook of Stochastic Methods. Springer-Verlag, New York.

See Also

fptsde1d for simulation fpt in sde 1-dim. FPTL in package fptdApprox for computes values of the first passage time location.

Examples

Run this code
## Example 1: Ito sde 
## dX(t) = 5*(-1-Y(t))*X(t) * dt + 0.5 * dW1(t)          
## dY(t) = 5*(-1-X(t))*Y(t) * dt + 0.5 * dW2(t)
## x0 = 2, y0 = 2, and barrier c = 0.
## W1(t) and W2(t) two independent Brownian motion

fx <- expression(5*(-1-y)*x)
gx <- expression(0.5)
fy <- expression(5*(-1-x)*y)
gy <- expression(0.5)

res1 <- fptsde2d(driftx=fx,diffx=gx,drifty=fy,diffy=gy,x0=2,y0=2,c=0,M=30,N=1000)
res1
## taux <- res1$tau_x
## tauy <- res1$tau_y
summary(res1)
bconfint(res1,level=0.95)
moment(res1,order=c(2,3,4,5))
X1 <- cbind(res1$tau_x,res1$tau_y)
## library(sm)
## sm.density(X1,display="persp")

## Example 2: Stratonovich sde 
## dX(t) = 5*(-1-Y(t))*X(t) * dt + 0.5 o dW1(t)          
## dY(t) = 5*(-1-X(t))*Y(t) * dt + 0.5 o dW2(t)
## x0 = 2, y0 = 2, and barrier c = 0.
## W1(t) and W2(t) two independent Brownian motion

fx <- expression(5*(-1-y)*x)
gx <- expression(0.5)
fy <- expression(5*(-1-x)*y)
gy <- expression(0.5)

res2 <- fptsde2d(driftx=fx,diffx=gx,drifty=fy,diffy=gy,x0=2,y0=2,c=0,
                 M=30,N=1000,type="str")
res2
summary(res2)
moment(res2,order=c(2,3,4,5))
bconfint(res2,level=0.95)
X2 <- cbind(res2$tau_x,res2$tau_y)
## sm.density(X2,display="persp")

Run the code above in your browser using DataLab