Description Usage Arguments Details Value Author(s) References See Also Examples
The (S3) generic function for simulation of brownian motion, brownian bridge, geometric brownian motion, and arithmetic brownian motion.
1 2 3 4 5 6 7 8 9 10 11 12 13 | BM(N, ...)
BB(N, ...)
GBM(N, ...)
ABM(N, ...)
## Default S3 method:
BM(N =1000,M=1,x0=0,t0=0,T=1,Dt=NULL, ...)
## Default S3 method:
BB(N =1000,M=1,x0=0,y=0,t0=0,T=1,Dt=NULL, ...)
## Default S3 method:
GBM(N =1000,M=1,x0=1,t0=0,T=1,Dt=NULL,theta=1,sigma=1, ...)
## Default S3 method:
ABM(N =1000,M=1,x0=0,t0=0,T=1,Dt=NULL,theta=1,sigma=1, ...)
|
N |
number of simulation steps. |
M |
number of trajectories. |
x0 |
initial value of the process at time \code{t0}. |
y |
terminal value of the process at time \code{T} of the |
t0 |
initial time. |
T |
final time. |
Dt |
time step of the simulation (discretization). If it is |
theta |
the interest rate of the |
sigma |
the volatility of the |
... |
potentially further arguments for (non-default) methods. |
The function BM
returns a trajectory of the standard Brownian motion (Wiener process) in the time interval [t0,T]. Indeed, for W(dt) it holds true that
W(dt) = W(dt) - W(0) -> N(0,dt) -> sqrt(dt) * N(0,1), where N(0,1) is normal distribution
Normal
.
The function BB
returns a trajectory of the Brownian bridge starting at x0 at time t0 and ending
at y at time T; i.e., the diffusion process solution of stochastic differential equation:
dX(t) = ((y-X(t))/(T-t)) dt + dW(t)
The function GBM
returns a trajectory of the geometric Brownian motion starting at x0 at time t0;
i.e., the diffusion process solution of stochastic differential equation:
dX(t) = theta X(t) dt + sigma X(t) dW(t)
The function ABM
returns a trajectory of the arithmetic Brownian motion starting at x0 at time t0;
i.e.,; the diffusion process solution of stochastic differential equation:
dX(t) = theta dt + sigma dW(t)
X |
an visible |
A.C. Guidoum, K. Boukhetala.
Allen, E. (2007). Modeling with Ito stochastic differential equations. Springer-Verlag, New York.
Jedrzejewski, F. (2009). Modeles aleatoires et physique probabiliste. Springer-Verlag, New York.
Henderson, D and Plaschko, P. (2006). Stochastic differential equations in science and engineering. World Scientific.
This functions BM
, BBridge
and GBM
are available in other packages such as "sde".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | op <- par(mfrow = c(2, 2))
## Brownian motion
set.seed(1234)
X <- BM(M = 100)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Brownian bridge
set.seed(1234)
X <- BB(M =100)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Geometric Brownian motion
set.seed(1234)
X <- GBM(M = 100)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
## Arithmetic Brownian motion
set.seed(1234)
X <- ABM(M = 100)
plot(X,plot.type="single")
lines(as.vector(time(X)),rowMeans(X),col="red")
par(op)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.