# NOT RUN {
# Example 1
## Simulate a geometric Brownian motion (GBM) process:
simulated_spot_prices <- spot_price_simulate(
x_0 = log(20),
parameters = c(mu_rn = (0.05 - (1/2) * 0.2^2), sigma_1 = 0.2),
t = 1,
dt = 1/12,
N_simulations = 1e3)
# Example 2
## Simulate the Short-Term/Long-Term model:
### Step 1 - Obtain contemporary state variable estimates through the Kalman Filter:
SS_2F_filtered <- NFCP_Kalman_filter(parameter_values = SS_oil$two_factor,
parameter_names = names(SS_oil$two_factor),
log_futures = log(SS_oil$stitched_futures),
dt = SS_oil$dt,
futures_TTM = SS_oil$stitched_TTM,
verbose = TRUE)
### Step 2 - Use these state variable estimates to simulate futures spot prices:
simulated_spot_prices <- spot_price_simulate(
x_0 = SS_2F_filtered$x_t,
parameters = SS_oil$two_factor,
t = 1,
dt = 1/12,
N_simulations = 1e3,
antithetic = TRUE,
verbose = TRUE)
# }
Run the code above in your browser using DataLab