This function plots the parameter evolution during the fit, the
filtered state variables (i.e. the spot price and the convenience
yield), forward curves, or trajectories of the state variables.
Usage
## S4 method for signature 'schwartz2f.fit,missing'
plot(x, type = c("trace.pars", "state", "forward.curve", "sim"),
data, ttm, ...)
Arguments
x
A schwartz2f.fit object.
type
What shall be plotted (see Details).
data
A matrix containing futures prices to which parameters were fitted.
ttm
A matrix with the corresponding time to maturity (see Details).
...
Arguments passed to plot.
Details
If type == "trace.pars", the parameter evolution of the
estimation is plotted. The horizontal lines denote the final value.
If type == "state", the filtered state variables are plotted
and overlaid with the futures prices.
If type == "forward.curve", fitted forward curves are plotted.
If type == "sim", a bunch of simulated trajectories of the
state variables are plotted.
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 time unit
was defined by the argument deltat of the function
fit.schwartz2f (stored in x@deltat).
Author(s)
David Luethi
See Also
fit.schwartz2f for parameter estimation,
plot-method for
schwartz2f-objects.
Examples
# data(futures)
#
# ## Estimate parameters for lumber data (stop after 100 iterations)
# fit.obj <- fit.schwartz2f(futures$lumber$price, futures$lumber$ttm / 260,
# deltat = 1 / 260,
# control = list(maxit = 100))
#
# ## Plot parameter evolution
# plot(fit.obj, type = "trace.pars")
#
# ## Plot the state variables
# plot(fit.obj, type = "state", data = futures$lumber$price,
# ttm = futures$lumber$ttm / 260)
#
# ## Plot fitted and real forward curves of wheat data since Jan 2010.
# lumber.1995 <- lapply(futures$lumber, function(x)x[as.Date(rownames(x)) < "2000-01-01",])
# par(mfrow = c(1, 2))
# plot(fit.obj, type = "forward.curve", data = lumber.1995$price,
# ttm = lumber.1995$ttm / 260)
# futuresplot(lumber.1995)
#
# ## Plot trajectories from the state variables
# plot(fit.obj, type = "sim")