schwartz97resid: Extract Model Residuals

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Function to extract model residuals from schwartz2f.fit-objects.

Usage

1
2
## S4 method for signature 'schwartz2f.fit'
resid(object, data, ttm, type = c("filter", "filter.std", "real"))

Arguments

object

A schwartz2f.fit-object returned from schwartz2f.fit.

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).

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.

Value

A matrix containing the residuals.

Author(s)

Philipp Erb, David Luethi, Juri Hinz

See Also

fit.schwartz2f, schwartz2f.fit-class, fitted.

Examples

 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.

schwartz97 documentation built on May 2, 2019, 5:48 p.m.