Learn R Programming

Sim.DiffProc (version 2.5)

AnaSimFPT: Simulation The First Passage Time FPT For A Simulated Diffusion Process

Description

Simulation M-samples of the first passage time (FPT) by a simulated diffusion process with a fixed the threshold v.

Usage

AnaSimFPT(N, M, t0, Dt, T = 1, X0, v, drift, diff, 
          ELRENA=c("No","Yes","Mean","Median"), 
          Output = FALSE, Methods = c("Euler", "Milstein", 
          "MilsteinS","Ito-Taylor", "Heun", "RK3"), ...)

Arguments

N
size of the diffusion process.
M
size of the FPT.
t0
initial time.
Dt
time step of the simulation (discretization).
T
final time.
X0
initial value of the process at time t0.
v
threshold (Risk).
drift
drift coefficient: an expression of two variables t and x.
diff
diffusion coefficient: an expression of two variables t and x.
ELRENA
if ELRENA = "No" not eliminate NA (Not Available),and if ELRENA="Yes" eliminate NA (Not Available), or replace NA by : mean(FPT) ,median(FPT).
Output
if Output = TRUE write a Output to an Excel (.csv).
Methods
method of simulation ,see details snssde.
...

Value

  • Random variable tau "FPT".

Details

The stochastic differential equation of is : $$dX(t) = a(t,X(t)) *dt + b(t,X(t)) *dW(t)$$ with a(t,X(t)) :drift coefficient and b(t,X(t)) :diffusion coefficient, W(t) is Wiener process. We take interest in the random variable tau "first passage time", is defined by : $$tau = inf(t>=0 \ X(t) <= v="" |="" x(t)="">= v)$$ with v is the threshold. For more detail consulted References.

References

  1. K.Boukhetala, Estimation of the first passage time distribution for a simulated diffusion process, Maghreb Math.Rev, Vol.7, No 1, Jun 1998, pp. 1-25.
  2. K.Boukhetala, Simulation study of a dispersion about an attractive centre. In proceedings of 11th Symposium Computational Statistics, edited by R.Dutter and W.Grossman, Wien , Austria, 1994, pp. 128-130.
  3. K.Boukhetala,Modelling and simulation of a dispersion pollutant with attractive centre, Edited by Computational Mechanics Publications, Southampton ,U.K and Computational Mechanics Inc, Boston, USA, pp. 245-252.
  4. K.Boukhetala, Kernel density of the exit time in a simulated diffusion, les Annales Maghrebines De L ingenieur, Vol , 12, N Hors Serie. Novembre 1998, Tome II, pp 587-589.

See Also

AnaSimX Simulation M-Samples of Random Variable X(v[t]) For A Simulated Diffusion Process, tho_M1 Simulation The FPT For Attractive Model(S = 1,Sigma), tho_M1 Simulation The FPT For Attractive Model(S >= 2,Sigma), tho_02diff Simulation FPT For Attractive Model for 2-Diffusion Processes.

Examples

Run this code
## Example 1
## tau = inf(t>=0 \ X(t) <= v 
## Ornstein-Uhlenbeck Process  or Gaussian Diffusion Models
 v = 0.05 
 drift <- expression(5*(-2-x))
 diff <- expression(1)
 AnaSimFPT(N=1000, M=30, t0=0, Dt=0.001, T = 1, X0=10, v=0.05, drift, 
           diff,ELRENA ="No", Output = FALSE)
 summary(tau)
 hist(tau)
 plot(density(tau,kernel ="gaussian"),col="red")
 v = -0.05
 AnaSimFPT(N=1000, M=30, t0=0, Dt=0.001, T = 1, X0=10, v=-0.05, drift, 
           diff,ELRENA ="No", Output = FALSE)
 summary(tau)
 hist(tau)
 plot(density(tau,kernel ="gaussian"),col="red")
## Attention
 v = -3
 AnaSimFPT(N=1000, M=30, t0=0, Dt=0.001, T = 1, X0=10, v=-3, drift,
           diff,ELRENA ="No", Output = FALSE)

## Example 2
## tau = inf(t>=0 \ X(t) >= v )
 v = 1
 drift <- expression(2*(3-x))
 diff <- expression(0.1)
 AnaSimFPT(N=1000, M=30, t0=0, Dt=0.001, T = 1, X0=-5, v=1, drift, 
           diff,ELRENA ="No", Output = FALSE)
 summary(tau)
 hist(tau)
 plot(density(tau,kernel ="gaussian"),col="red")
 v = 3 
 AnaSimFPT(N=1000, M=30, t0=0, Dt=0.01, T = 1, X0=-5, v=3, drift, 
           diff,ELRENA ="No", Output = FALSE)
 summary(tau)
 hist(tau)
 plot(density(tau,kernel ="gaussian"),col="red")
 v = 3.1
AnaSimFPT(N=1000, M=30, t0=0, Dt=0.01, T = 1, X0=-5, v=3.1, drift, 
          diff,ELRENA ="No", Output = FALSE)
## Remplaced NA by mean(tau) or median(tau)
AnaSimFPT(N=1000, M=30, t0=0, Dt=0.01, T = 1, X0=-5, v=3.1, drift, 
          diff,ELRENA ="Yes", Output = FALSE)
AnaSimFPT(N=1000, M=30, t0=0, Dt=0.01, T = 1, X0=-5, v=3.1, drift, 
          diff,ELRENA ="Mean", Output = FALSE)
AnaSimFPT(N=1000, M=30, t0=0, Dt=0.01, T = 1, X0=-5, v=3.1, drift, 
          diff,ELRENA ="Median", Output = FALSE)

Run the code above in your browser using DataLab