Learn R Programming

NFCP

N-Factor Commodity Pricing Through Term Structure Estimation

Commodity pricing models are (systems of) stochastic differential equations that are utilized for the valuation and hedging of commodity contingent claims (i.e. derivative products on the commodity) and other commodity related investments. Parameters of commodity pricing models are estimated through maximum likelihood estimation, using available term structure futures data of a commodity. 'NFCP' (n-factor commodity pricing) provides a framework for the modeling, parameter estimation, probabilistic forecasting, option valuation and simulation of commodity prices through state space and Monte Carlo methods, risk-neutral valuation and Kalman filtering. 'NFCP' allows the commodity pricing model to consist of n correlated factors, with both random walk and mean-reverting elements. Commodity pricing models that capture market dynamics are of great importance to commodity market participants in order to exercise sound investment and risk-management strategies. The n-factor commodity pricing model framework was first presented in the work of Cortazar and Naranjo (2006). Examples presented in 'NFCP' replicate the two-factor crude oil commodity pricing model presented in the prolific work of Schwartz and Smith (2000) with the approximate term structure futures data applied within this study provided in the 'NFCP' package. Kalman filtering in 'NFCP' is performed using sequential processing through the 'FKF.SP' package to optimise computational efficiency. Parameter estimation of n-factor models is performed using genetic algorithms through the 'rGenoud' package to maximise the likelihood that a global maximum is reached during maximum likelihood estimation.

Primary features of 'NFCP' include:

  • Parameter estimation of n-factor commodity pricing models through state space methods, Kalman filtering and maximum likelihood estimation.

  • Analytic pricing of European call and put options under estimated n-factor commodity pricing models

  • Numeric pricing of American options under estimated n-factor commodity pricing models

  • Probabilistic forecasting and Monte Carlo simulation of future commodity price paths.

Installation

You can install the released version of NFCP from CRAN with:

install.packages("NFCP")

And the development version from GitHub with:

devtools::install_github("TomAspinall/NFCP")

which contains source code for the package starting with version 0.1.0.

Copy Link

Version

Install

install.packages('NFCP')

Monthly Downloads

293

Version

1.2.1

License

GPL-3

Maintainer

Thomas Aspinall

Last Published

February 17th, 2022

Functions in NFCP (1.2.1)

American_option_value

N-factor model American options on futures contracts valuation
SS_oil

Crude oil term structure futures data (1990 - 1995)
NFCP_parameters

Specify the constant parameters of an N-factor model
stitch_contracts

Stitch futures contracts
spot_price_forecast

Forecast spot prices of an N-factor model
spot_price_simulate

Simulate spot prices of an N-factor model through Monte Carlo simulation
European_option_value

N-factor model European options on futures contracts valuation
NFCP_Kalman_filter

Filter an N-factor commodity pricing model though the Kalman filter
futures_price_forecast

Forecast the futures prices of an N-factor model
futures_price_simulate

Simulate futures prices of an N-factor model through Monte Carlo simulation
NFCP_MLE

N-factor model parameter estimation through the Kalman filter and maximum likelihood estimation
NFCP_domains

N-Factor MLE search boundaries
cov_func

N-factor model covariance:
TSfit_volatility

Calculate the volatility term structure of futures returns
A_T

Calculate \(A(T)\)