Last data update: 2014.03.03

R: Schwartz two-factor Model: Filter futures data
filter-futuresR Documentation

Schwartz two-factor Model: Filter futures data

Description

Filter a series of futures prices to obtain state variables.

Usage


## S4 method for signature 'ANY,ANY,numeric'
filter.schwartz2f(data, ttm, s0 = 50, delta0 = 0,
                  mu = 0.1, sigmaS = 0.3, kappa = 1, alpha = 0, sigmaE = 0.5,
                  rho = 0.75, r = 0.05, lambda = 0, alphaT = NULL,
                  deltat = 1/260, meas.sd = rep(1e-3, ncol(data)),
                  P0 = 0.5 * diag(c(log(s0), abs(delta0))))

## S4 method for signature 'ANY,ANY,schwartz2f'
filter.schwartz2f(data, ttm, s0,
                  r = 0.05, lambda = 0, alphaT = NULL, deltat = 1/260,
                  meas.sd = rep(1e-3, ncol(data)),
                  P0 = 0.1 * diag(2))

## S4 method for signature 'ANY,ANY,schwartz2f.fit'
filter.schwartz2f(data, ttm, s0)

Arguments

data

A matrix with futures prices.

ttm

A matrix with the corresponding time to maturity (see Details).

s0

Either a numeric representing the initial value of the commodity spot price or an object inheriting from class schwartz2f.

delta0

Initial value of the convenience yield.

mu

enters the drift of the commodity spot price.

sigmaS

Diffusion parameter of the spot price process.

kappa

Speed of mean-reversion of the convenience yield process.

alpha

Mean-level of the convenience yield process.

sigmaE

Diffusion parameter of the convenience yield process.

rho

Correlation coefficient between the Brownian motion driving the spot price and the convenience yield process.

r

Instantaneous risk-free interest rate.

lambda

Market price of convenience yield risk.

alphaT

Mean-level of the convenience yield process with respect to the equivalent martingale measure.

deltat

Time increment.

meas.sd

The standard deviation of the measurement equation (see Details section of fit.schwartz2f).

P0

Variance of the state variables s0 and P0.

Details

The elements of data and ttm have the following interpretation: data[i,j] denotes the futures price whose time to maturity was ttm[i,j] when it was observed. The unit of ttm is defined by deltat.

deltat is the time between observation data[i,j] and data[i + 1,j]. It is assumed to be constant, i.e., that data is a regular time-series.

Value

A list with components:

state A matrix with colnames are “S” and “delta” giving the the expected spot price and the convenience yield.
fkf.obj The filter output from the package fkf. Note that the log of the commodity spot price is filtered.

Author(s)

Philipp Erb, David Luethi, Juri Hinz

References

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

See Also

fit.schwartz2f, pricefutures.

Examples

# data(futures)
# 
# ## Estimate parameters for coffee data (stop after 20 iterations)
# fit.obj <- fit.schwartz2f(futures$coffee$price, futures$coffee$ttm / 260,
#                           deltat = 1 / 260, control = list(maxit = 20))
# 
# ## Filter the futures data to get the spot price and the convenience yield.
# filtered <- filter.schwartz2f(futures$coffee$price, futures$coffee$ttm / 260, fit.obj)
# 
# ## ...and plot it.
# par(mfrow = c(2, 1))
# plot(filtered$state[,1], ylab = "Spot price", type = "l")
# lines(futures$coffee$price[,1], col = "red") # Closest to maturity futures
# plot(filtered$state[,2], ylab = "Convenience yield", type = "l")
# abline(h = 0)

Results