Learn R Programming

amsSim (version 0.1.0)

simulate_AMS: simulate_AMS Monte Carlo simulation of price paths under: 1 = Black–Scholes (exact solution) 2 = Heston (Euler discretisation) 3 = Heston (Milstein discretisation) 4 = Heston (Quadratic–Exponential scheme, Andersen 2008)

Description

simulate_AMS Monte Carlo simulation of price paths under: 1 = Black–Scholes (exact solution) 2 = Heston (Euler discretisation) 3 = Heston (Milstein discretisation) 4 = Heston (Quadratic–Exponential scheme, Andersen 2008)

Usage

simulate_AMS(model, n, t, p, r, sigma, S0, rho = NULL, rim = 0L, v0 = 0.04)

Value

List: for model 1 returns S (\(n \times (p-rim+1)\)); for Heston models returns S and V.

Arguments

model

Integer in \(\{1,2,3,4\}\) selecting the model.

n

Number of simulated paths (>0).

t

Maturity in years (>0).

p

Total time steps (>0).

r

Risk–free rate.

sigma

Black–Scholes volatility (>=0, used only when model == 1).

S0

Initial spot price (>0).

rho

Correlation between asset and variance Brownian motions (required for Heston models, finite in \([-1,1]\)).

rim

Left–trim: discard the first rim time steps (0 <= rim < p). Returned matrices keep p - rim + 1 columns including the initial time.

v0

Initial variance for Heston models (>=0).

Examples

Run this code
# \donttest{
  b <- simulate_AMS(1, n = 50, t = 1, p = 10, r = 0.01, sigma = 0.2, S0 = 100, rho = NULL)
  str(b)
# }

Run the code above in your browser using DataLab