Learn R Programming

⚠️There's a newer version (1.2.2) of this package.Take me there.

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 put 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

409

Version

1.0.1

License

GPL-3

Maintainer

Thomas Aspinall

Last Published

May 6th, 2021

Functions in NFCP (1.0.1)

Futures.Price.Simulate

Simulate N-Factor Model Futures Prices
NFCP.Domains

N-Factor MLE Search Boundaries
Spot.Price.Forecast

Forecast N-Factor Model Spot Prices
NFCP_domains

N-Factor MLE search boundaries
NFCP_MLE

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

Specify parameters of N-factor model
Stitch.Contracts

Stitch Futures Contracts
SS_oil

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

Filter an N-factor commodity pricing model though the Kalman filter
NFCP.Parameters

Specify parameters of N-factor model
SS.Oil

Crude Oil Term Structure Futures Data (1990 - 1995)
Spot.Price.Simulate

Simulate N-Factor Model Spot Prices
spot_price_simulate

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

N-factor model covariance:
TSfit_volatility

Calculate the volatility term structure of futures returns
TSFit.Volatility

Volatility Term Structure of futures returns
futures_price_forecast

Forecast the futures prices of an N-factor model
spot_price_forecast

Forecast the spot prices of an N-factor model
futures_price_simulate

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

Stitch futures contracts
NFCP.Kalman.filter

N-Factor Commodity Pricing Kalman Filter
A_T

Calculate \(A(T)\)
NFCP.MLE

N-Factor Model Parameter Estimation through the Kalman Filter and Maximum Likelihood Estimation
European_option_value

N-factor model European option pricing
American.Option.Value

N-Factor Model American Put Option Pricing
American_option_value

N-factor model American put option pricing
European.Option.Value

N-Factor Model European Option Pricing
Futures.Price.Forecast

Forecast N-Factor Model Futures Prices