Learn R Programming

Sim.DiffProc (version 2.8)

fptsde1d: First Passage Time in 1-Dim SDE

Description

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

Usage

fptsde1d(N, ...)
## S3 method for class 'default':
fptsde1d(N = 1000, M = 100, x0 = 0, t0 = 0, T = 1, Dt, 
   boundary, drift, diffusion, 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 'fptsde1d':
summary(object, \dots)
## S3 method for class 'fptsde1d':
mean(x, \dots)
## S3 method for class 'fptsde1d':
median(x, \dots)
## S3 method for class 'fptsde1d':
quantile(x, \dots)
## S3 method for class 'fptsde1d':
kurtosis(x, \dots)
## S3 method for class 'fptsde1d':
skewness(x, \dots)
## S3 method for class 'fptsde1d':
moment(x, order = 2, \dots)
## S3 method for class 'fptsde1d':
bconfint(x, level=0.95, \dots)
## S3 method for class 'fptsde1d':
plot(x, \dots)

Arguments

N
size of sde.
M
size of fpt.
x0
initial value of the process 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}$.
boundary
an expression of a constant or time-dependent boundary.
drift
drift coefficient: an expression of two variables t and x.
diffusion
diffusion coefficient: an expression of two variables t and x.
alpha, mu
weight of the predictor-corrector scheme; the default alpha = 0.5 and mu = 0.5.
type
sde of the type Ito or Stratonovich.
method
numerical methods of simulation, the default method = "euler"; see snssde1d.
x, object
an object inheriting from class "fptsde1d".
order
order of moment.
level
the confidence level required.
...
further arguments for (non-default) methods.

Value

  • fptsde1d returns an object inheriting from class "fptsde1d".
  • fptnumeric vector of fpt (first passage time).

newcommand

\CRANpkg

href

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

pkg

#1

Details

The function fptsde1d returns a random variable $\tau_{(X(t),S(t))}$ "first passage time", is defined as : $$\tau_{(X(t),S(t))} = { t \geq 0 ; X_{t} \geq S(t) },\quad if \quad X(t_{0}) < S(t_{0})$$ $$\tau_{(X(t),S(t))} = { t \geq 0 ; X_{t} \leq S(t) },\quad if \quad X(t_{0}) > S(t_{0})$$ with $S(t)$ is through a continuous boundary (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. Gardiner, C. W. (1997). Handbook of Stochastic Methods. Springer-Verlag, New York.

See Also

fptsde2d and fptsde3d simulation fpt for 2 and 3-dim SDE. FPTL for computes values of the first passage time location (FPTL) function, and Approx.fpt.density for approximate first-passage-time (f.p.t.) density in package fptdApprox.

Examples

Run this code
## Example 1: Ito SDE
## dX(t) = -4*X(t) *dt + 0.5*dW(t)
## S(t) = 0 (constant boundary)

f <- expression( -4*x )
g <- expression( 0.5 )
St <- expression(0) 
res1 <- fptsde1d(drift=f,diffusion=g,boundary=St,x0=2)
res1
plot(res1)
summary(res1)
plot(density(res1$fpt[!is.na(res1$fpt)]),main="Kernel Density of a First-Passage-Time")

## Example 2: Ito SDE
## X(t) Brownian motion
## S(t) = 0.3+0.2*t (time-dependent boundary)

f <- expression( 0 )
g <- expression( 1 )
St <- expression(0.5-0.5*t) 
res2 <- fptsde1d(drift=f,diffusion=g,boundary=St,M=50)
res2
summary(res2)
plot(res2,pos=3)
dev.new()
plot(density(res2$fpt[!is.na(res2$fpt)]),main="Kernel Density of a First-Passage-Time")

## Example 3: Stratonovich SDE
## dX(t) = 0.5*X(t)*t *dt + sqrt(1+X(t)^2) o dW(t)
## S(t) = -0.5*sqrt(t) + exp(t^2) (time-dependent boundary)

f <- expression( 0.5*x*t )
g <- expression( sqrt(1+x^2) )
St <- expression(-0.5*sqrt(t)+exp(t^2))
res3 <- fptsde1d(drift=f,diffusion=g,boundary=St,x0=2,M=50,type="srt")
res3
summary(res3)
plot(res3,legend=FALSE)
dev.new()
plot(density(res3$fpt[!is.na(res3$fpt)]),main="Kernel Density of a First-Passage-Time")

Run the code above in your browser using DataLab