fastGBM: Generating Geometric Brownian motion

Description Usage Arguments Value Author(s) See Also Examples

View source: R/fastGBM.R

Description

Quick Generating Geometric Brownian motion avoiding unnecessary loops using the cumsum function. Technical function implemented in the pricing functions of the package.

Usage

1
fastGBM(Spot = 1, sigma = 0.2, n = 1000, m = 365, r = 0.06, dr = 0, mT = 1)

Arguments

Spot

Spot price of the underlying asset (e.g. stock).

sigma

Volatility of the underlying asset.

n

Number of paths simulated.

m

Number of time steps in the simulation.

r

Interest rate of the numeraire currency (e.g. EUR).

dr

Dividend rate of the underlying asset.

mT

Maturity time (years).

Value

Table with paths generated (each row is a path, class "matrix")

Author(s)

Mikhail A. Beketov

See Also

Functions: AmerPutLSM, AmerPutLSM_AV, AmerPutLSM_CV, AsianAmerPutLSM, QuantoAmerPutLSM, and QuantoAmerPutLSM_AV.

Examples

1
2
fastGBM(n=10, m=5)
matplot(t(fastGBM(n=100, m=100)), type="l") # matrix transpose by "t()"

Example output

Loading required package: mvtnorm
Loading required package: fBasics
Loading required package: timeDate
Loading required package: timeSeries
           [,1]      [,2]      [,3]      [,4]      [,5]
 [1,] 1.0293330 1.2681723 1.4612960 1.3824041 1.2993430
 [2,] 1.0701101 1.1187611 1.0774588 1.2144478 1.2754968
 [3,] 0.9531196 0.8699422 0.9712432 1.1640761 1.1840269
 [4,] 1.0000492 0.9814904 1.1057886 1.1607309 0.9654719
 [5,] 1.0538666 0.9814689 0.9258868 0.8632822 0.8131753
 [6,] 1.0156393 0.8217586 0.8323415 0.6688556 0.7598782
 [7,] 0.9993939 0.8595950 0.9019661 1.0945507 1.1612638
 [8,] 1.1074479 1.0370886 1.0623639 1.2599998 1.1451754
 [9,] 1.0567969 1.1465284 1.1234061 1.2959196 1.4313935
[10,] 1.0924809 1.0374408 1.0019155 0.8947288 0.9881024

LSMonteCarlo documentation built on May 2, 2019, 8:55 a.m.