Description Usage Arguments Value Author(s) References Examples
View source: R/GeometricBrownianMotion.R
Simulate one or more paths for an Arithmetic Brownian Motion B(t) or for a Geometric Brownian Motion S(t) for 0 ≤ t ≤ T using grid points (i.e. Euler scheme).
1 2 3 |
S0 |
start value of the Arithmetic/Geometric Brownian Motion, i.e. S(0)=S0 or B(0) = S0 |
mu |
the drift parameter of the Brownian Motion |
sigma |
the annualized volatility of the underlying security, a numeric value; e.g. 0.3 means 30% volatility pa. |
T |
time |
mc.loops |
number of Monte Carlo price paths |
N |
number of grid points in price path |
a vector of length N+1
with simulated asset prices at (i * T/N), i=0,...,N.
Stefan Wilhelm wilhelm@financial.com
Iacus, Stefan M. (2008). Simulation and Inference for Stochastic Differential Equations: With R Examples Springer
1 2 3 4 5 6 7 8 9 10 11 | # Simulate three trajectories of the Geometric Brownian Motion S(t)
T <- 1
mc.steps <- 100
dt <- T/mc.steps
t <- seq(0, T, by=dt)
S_t <- GBM(S0=100, mu=0.05, sigma=0.3, T=T, N=mc.steps)
plot(t, S_t, type="l", main="Sample paths of the Geometric Brownian Motion")
for (i in 1:2) {
S_t <- GBM(S0=100, mu=0.05, sigma=0.3, T=T, N=mc.steps)
lines(t, S_t, type="l")
}
|
Loading required package: mvtnorm
Loading required package: tmvtnorm
Loading required package: Matrix
Loading required package: stats4
Loading required package: gmm
Loading required package: sandwich
Loading required package: fCertificates
Loading required package: fBasics
Loading required package: timeDate
Loading required package: timeSeries
Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Loading required package: fOptions
Rmetrics Package fOptions
Pricing and Evaluating Basic Options
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Loading required package: fExoticOptions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.