Learn R Programming

LSMonteCarlo (version 1.0)

fastGBM: Generating Geometric Brownian motion

Description

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

Usage

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")

See Also

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

Examples

Run this code
fastGBM(n=10, m=5)
matplot(t(fastGBM(n=100, m=100)), type="l") # matrix transpose by "t()"

Run the code above in your browser using DataLab