Learn R Programming

schwartz97 (version 0.0.6)

schwartz97-package:

Two-factor Commodity Model

Description

This package contains an implementation of the Schwartz two-factor commodity model, that is, the joint dynamics of the spot price and the spot convenience yield according to Schwartz (1997). The parameter estimation function constitutes the core of this package. Once the parameters are estimated, futures and European call and put options can be priced, term structures can be calculated and the usual distribution operations d/p/q/r can be carried out on the state variables as well as on futures prices. The package is accompanied by a variety of utility functions, futures data of ten commodities, and two vignettes describing technical details and usage of the package.

Arguments

Details

Package:
schwartz97
Type:
Package
Version:
0.0.4
Date:
2011-12-18
License:
GPL (GNU Public License), Version 2 or later

Initialization:

schwartz2f
Initialize a Schwartz two-factor object.
Density, distribution function, quantile function, random number generation, and trajectories of the state variables:
dstate
Density of the spot and the convenience yield.
pstate
Distribution of the spot and the convenience yield.
qstate
Quantile of the spot and the convenience yield.
rstate
Random number generation of the spot and the convenience yield.
simstate
Trajectory of the spot and the convenience yield.
Density, distribution function, quantile function, and random number generation of the futures price:
dfutures
Density of the futures price.
pfutures
Distribution of the futures price.
qfutures
Quantile of the futures price.
rfutures
Random number generation of the futures price.
Parameter estimation:
fit.schwartz2f
Estimate parameters of the two-factor model.
fitted
Extract the model's fitted values.
resid
Extract model residuals.
Pricing:
pricefutures
Compute arbitrage-free futures prices.
priceoption
Compute arbitrage-free European option prices.
Utilities:
coef
Extract model coefficients of schwartz2f-objects.
mean
Extract the mean of schwartz2f-objects.
vcov
Extract the covariance matrix of schwartz2f-objects.
filter.schwartz2f
Filter futures prices to get the spot price and convenience yield.
plot
Plot schwartz2f.fit-objects.
plot
Plot trajectories of schwartz2f-objects.
futures
Use data(futures) to get data of 10 commodities.

Package vignette:

The R package schwartz97 contains two vignettes:

The vignette Technical Document gives the necessary relations and tools to fully understand the internals of the package.

The vignette User Guide discusses implementation details and gives numerous examples and intuitive explanations.

References

Stochastic Convenience Yield and the Pricing of Oil Contingent Claims by Rajna Gibson and Eduardo S. Schwartz The Journal of Finance 45, 1990, 959-976

The Stochastic Behavior of Commodity Prices: Implications for Valuation and Hedging by Eduardo S. Schwartz Journal of Finance 52, 1997, 923-973

Pricing of Options on Commodity Futures with Stochastic Term Structures of Convenience Yields and Interest Rates by Kristian R. Miltersen and Eduardo S. Schwartz Journal of Financial and Quantitative Analysis 33, 1998, 33-59

Valuation of Commodity Futures and Options under Stochastic Convenience Yields, Interest Rates, and Jump Diffusions in the Spot by Jimmy E. Hilliard and Jorge Reis Journal of Financial and Quantitative Analysis 33, 1998, 61-86