spot_price_simulate {NFCP} | R Documentation |
Simulate spot prices of an N-factor model through Monte Carlo simulation
Description
Simulate risk-neutral price paths of an an N-factor commodity pricing model through Monte Carlo Simulation.
Usage
spot_price_simulate(
x_0,
parameters,
t = 1,
dt = 1,
N_simulations = 2,
antithetic = TRUE,
verbose = FALSE
)
Arguments
x_0 |
|
parameters |
|
t |
|
dt |
|
N_simulations |
|
antithetic |
|
verbose |
|
Details
The spot_price_simulate
function is able to quickly and efficiently simulate a large number of state variables and risk-neutral price paths of a commodity following the N-factor model.
Simulating risk-neutral price paths of a commodity under an N-factor model through Monte Carlo simulations allows for the
valuation of commodity related investments and derivatives, such as American options and real Options through dynamic programming methods.
The spot_price_simulate
function quickly and efficiently simulates an N-factor model over a specified number of years, simulating antithetic price paths as a simple variance reduction technique.
The spot_price_simulate
function uses the mvrnorm
function from the MASS
package to draw from a multivariate normal distribution for the correlated simulation shocks of state variables.
The N-factor model stochastic differential equation is given by:
Brownian Motion processes (ie. factor one when GBM = T
) are simulated using the following solution:
Where \(\Delta t\) is the discrete time step, \(\mu^*\) is the risk-neutral growth rate and \(\sigma_1\) is the instantaneous volatility. \(Z_t\) represents the independent standard normal at time \(t\).
Ornstein-Uhlenbeck Processes are simulated using the following solution:
\[x_{i,t} = x_{i,0}e^{-\kappa_it}-\frac{\lambda_i}{\kappa_i}(1-e^{-\kappa_it})+\int_0^t\sigma_ie^{\kappa_is}dW_s\]Where a numerical solution is obtained by numerically discretising and approximating the integral term using the Euler-Maruyama integration scheme: \[\int_0^t\sigma_ie^{\kappa_is}dW_s = \sum_{j=0}^t \sigma_ie^{\kappa_ij}dW_s\]
Finally, deterministic seasonality is considered within the spot prices of simulated price paths.
Value
spot_price_simulate
returns a list when verbose = T
and a matrix of simulated price paths when verbose = F
. The returned objects in the list are:
State_Variables | A matrix of simulated state variables for each factor is returned when verbose = T . The number of factors returned corresponds to the number of factors in the specified N-factor model. |
Prices | A matrix of simulated price paths. Each column represents one simulated price path and each row represents one simulated observation. |
References
Schwartz, E. S., and J. E. Smith, (2000). Short-Term Variations and Long-Term Dynamics in Commodity Prices. Manage. Sci., 46, 893-911.
Cortazar, G., and L. Naranjo, (2006). An N-factor Gaussian model of oil futures prices. Journal of Futures Markets: Futures, Options, and Other Derivative Products, 26(3), 243-268.
Examples
# 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)