# NOT RUN {
# Example 1
###Simulate a Geometric Brownian Motion (GBM) process:
## Starting price of 20, with a growth of 5% p.a. and
## volatility of 20% p.a.
Simulated.Spot.Prices <- Spot.Price.Simulate(
X.0 = log(20),
parameters = c(mu_star = (0.05 - (1/2) * 0.2^2), sigma_1 = 0.2),
t = 1,
dt = 1/12,
n = 1e3)
# Example 2
###Simulate future spot price paths under Risk-Neutrality and under the
###Schwartz - Smith two factor model:
##Step 1 - Run the Kalman Filter for the Two-Factor Oil Model:
Schwartz.Smith.Oil <- NFCP.Kalman.filter(parameter.values = SS.Oil$Two.Factor,
parameters = names(SS.Oil$Two.Factor),
log.futures = log(SS.Oil$Stitched.Futures),
dt = SS.Oil$dt,
TTM = SS.Oil$Stitched.TTM,
verbose = TRUE)
#Step 2 - Simulate spot prices:
##100 antithetic simulations of one year of monthly observations
Simulated.Spot.Prices <- Spot.Price.Simulate(
X.0 = Schwartz.Smith.Oil$X.t,
parameters = SS.Oil$Two.Factor,
t = 1,
dt = 1/12,
n = 1e3,
antithetic = TRUE,
verbose = TRUE)
# }
Run the code above in your browser using DataLab