# NOT RUN {
# Example 1 - Simulate Crude Oil with constant time-to-maturity:
simulated_futures <- futures_price_simulate(x_0 = c(log(SS_oil$spot[1,1]), 0),
parameters = SS_oil$two_factor,
dt = SS_oil$dt,
N_obs = nrow(SS_oil$stitched_futures),
futures_TTM = SS_oil$stitched_TTM)
##Simulate Crude Oil Contracts with a rolling-window of measurement error:
simulated_futures_prices <- futures_price_simulate(x_0 = c(log(SS_oil$spot[1,1]), 0),
parameters = SS_oil$two_factor,
dt = SS_oil$dt,
N_obs = nrow(SS_oil$contracts),
futures_TTM = SS_oil$contract_maturities,
ME_TTM = c(1/4, 1/2, 1, 2, 5))
# }
Run the code above in your browser using DataLab