Learn R Programming

Sim.DiffProc (version 2.5)

AnaSimX: Simulation M-Samples of Random Variable X(v[t]) For A Simulated Diffusion Process

Description

Simulation M-samples of the random variable X(v(t)) by a simulated diffusion process with a fixed the time v , v = k * Dt with k integer, 1 <= k="" <="N.

Usage

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

Arguments

N
size of the diffusion process.
M
size of the random variable.
t0
initial time.
Dt
time step of the simulation (discretization).
T
final time.
X0
initial value of the process at time t0.
v
moment (time) between t0 and T ,v = k * Dt with k integer, 1 <= k="" <="N.
drift
drift coefficient: an expression of two variables t and x.
diff
diffusion coefficient: an expression of two variables t and x.
Output
if Output = TRUE write a Output to an Excel (.csv).
Methods
method of simulation ,see details snssde.
...

Value

  • Random variable "X(v(t))".

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 X(v), is defined by : $$X =(t>=0 \ X = X(v))$$ with v is the time between t0 and T ,v = k * Dt with k integer, 1 <= k="" <="N.

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

AnaSimFPT Simulation The First Passage Time FPT 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:  BM
## v = k * Dt with k integer , 1 <= k <= N .
## k = 500 nombre for discretization
## Dt = 0.001 ===> v = 500 * 0.001 = 0.5

 drift <- expression(0)
 diff <- expression(1)
 AnaSimX(N=1000,M=30,t0=0,Dt=0.001,T=1,X0=0,v=0.5,drift,diff,Output=FALSE,Methods="Euler")
 summary(X)
 hist(X)
 v=0.5
 plot(density(X,kernel ="gaussian"),col="red")
 x <- seq(min(X),max(X),length=1000)
 curve(dnorm(x,0,v), col = 3, lwd = 2, add = TRUE,
      panel.first=grid(col="gray"))


## Example 2: BMG or BS
## v = k * Dt with k integer , 1 <= k <= N .
## k = 800 nombre for discretization
## Dt = 0.001 ===> v = 800 * 0.001 = 0.8

 drift <- expression(2*x)
 diff <- expression(x)
 AnaSimX(N=1000,M=30,t0=0,Dt=0.001,T=1,X0=1,v=0.8,drift,diff,Output=FALSE,Methods="Euler")
 summary(X)
 hist(X)
 plot(density(X,kernel ="gaussian"),col="red")

Run the code above in your browser using DataLab