Description Usage Arguments Details Value Author(s) See Also Examples
Function to extract model residuals from
schwartz2f.fit
-objects.
1 2 |
object |
A |
data |
A matrix with futures prices. |
ttm |
A matrix with the corresponding time to maturity (see Details). |
type |
What kind of residuals shall be returned (see Details). |
If type == "filter"
, then the residuals from the measurement
equation are returned. If type == "filter.std"
, standardized
residuals from the measurement equation are returned (note that these
residuals should be standard multivariate normal).
If type == "real"
, the difference between the observed futures
prices and the fitted values (see
fitted
) are returned.
The model and its parameters are described in the Details
section of the schwartz2f
-class
documentation and in the package vignette Technical Document.
A matrix containing the residuals.
Philipp Erb, David Luethi, Juri Hinz
fit.schwartz2f
, schwartz2f.fit
-class,
fitted
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | data(futures)
## Estimate parameters for live.cattle data.
## (little precision required with reltol = 1e-3)
fit.obj <- fit.schwartz2f(futures$live.cattle$price, futures$live.cattle$ttm / 260,
deltat = 1 / 260,
control = list(maxit = 100, reltol = 1e-3))
## Standardized residuals
resid.std <- resid(fit.obj, data = futures$live.cattle$price, ttm =
futures$live.cattle$ttm / 260, type = "filter.std")
acf(resid.std, na.action = na.pass) # ...are not independent
## Real differences
resid.real <- resid(fit.obj, data = futures$live.cattle$price, ttm =
futures$live.cattle$ttm / 260, type = "real")
plot(as.ts(resid.real / futures$live.cattle$price)) # ...are 'relatively' accurate.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.