simuGBM: Simulation of General/Geometric Brownian Motion

Description Usage Arguments Details Value Author(s) References Examples

View source: R/simuGBM.R

Description

Simulation and plotting of:
1. k-dim (k 1; k 3 for plotting) general Brownian motion (i.e. Brownian motion with drift) or its running maximum process (when k = 1);
2. 1-dim geometric Brownian motion.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
simuGBM(
  x_init = 0.1,
  t_init = 0,
  t_end = 1,
  lag = 0.001,
  dim = 1,
  mu = numeric(dim),
  sigma = replicate(dim, 1),
  run_max = FALSE,
  type = c("General", "Geometric"),
  plot = TRUE,
  seed = 19038,
  ...
)

Arguments

x_init

The k-dim initial value of the process to be generated.
1. k 1 for type = "General";
2. k = 1 for type = "Geometric";
3. k 3 for plot = TRUE.

t_init

The initial time of the process to be generated.

t_end

The end time of the process to be generated.

lag

The consistent time lag of every two contiguous points to be generated.

dim

The dimension of the process to be generated.

mu

See details.

sigma

See details.

run_max

TRUE/FALSE(default). If run_max = TRUE, then the running maximum process will be generated.

type

"General"/"Geometric".

plot

TRUE(default)/FALSE. If plot = FALSE, the fig item will be returned as NULL.

seed

The random seed. The default value is 19038.

...

The parameters passed to plot or scatterplot3d.

Details

General Brownian motion: Ut = x0 + μ·t + σ·Bt;
Running maximum process: Mt = maxt∈T{Bt};
Geometric Brownian motion: Vt = x0·exp{(μ - σ2/2)·t + σ·Bt}.

Value

A list containing:

val

The values of the generated process.

fig

The plot of the generated process (plot = TRUE) or NULL (plot = FALSE).

Author(s)

Dong-Liang Wang

References

Pacati, C. (2010-11). Brownian Motion and Geometric Brownian Motion.
http://www-users.math.umn.edu/~grayx004/pdf/FM5002/BMandGBMdoc.pdf.

Examples

1
2
3
4
res <- simuGBM(x_init = c(1, 0, 1), lag = 1e-4, dim = 3, 
               type = "General", plot = TRUE, seed = 1,
               xlab = bquote(X[1]), ylab = bquote(X[2]), zlab = bquote(X[3]))
print(res$val)

SC19038/SC19038 documentation built on Jan. 3, 2020, 12:10 a.m.