smoother: Evaluate a smoother with a TSmodel

Description Usage Arguments Details Value References See Also Examples

Description

Evaluate a state space model.

Usage

1
2
3
4
5
6
7
8
    smoother(model, data, compiled=.DSEflags()$COMPILED)
    ## S3 method for class 'nonInnov'
smoother(model, data, compiled=.DSEflags()$COMPILED)
    ## S3 method for class 'TSmodel'
smoother(model, data, compiled=.DSEflags()$COMPILED)
    ## S3 method for class 'TSestModel'
smoother(model, data=TSdata(model),
      compiled=.DSEflags()$COMPILED)

Arguments

model

An object of class ‘TSestModel’ or 'TSmodel' with a model of class ‘nonInnov’ 'SS' 'TSmodel'. If filter informatin is not provided (i.e. in a TSestModel) then smoother runs the Kalman filter (l.SS) first.

data

A TSdata object.

.

compiled

If TRUE the compiled version of the code is used. Otherwise the S version is used.

Details

Calculate fixed interval smoother state values for a model. Smoother first runs the filter and uses the filtered state to calculate a smoothed estimate of the state (sometimes called a two sided filter). The smoother requires an non-innovations form model. The method for a TSmodel gives an error message if the model does not inherit from class nonInnov.

Note: this does not allow the same option as l.SS for calculating over a sub-sample. Smoothing is done over the length of the available filter data (which will be calculated to the length of the data if not supplied). For models with an input, smoothing will only be done over the input data period if that is shorter than the filter data.

See SS for details of the model:

z(t) = Fz(t-1) + Gu(t) + Qe(t) y(t) = Hz(t) + Rw(t)

Value

An object of class TSestModel with an additional element smooth. smooth is a list of state, the smoothed state, and track, the smoothed tracking error. The result will also contain the element filter with state and track (which may or may not have been in the original arguement).

References

Anderson, B. D. O. and Moore, J. B. (1979) Optimal Filtering. Prentice-Hall.

Shumway R. H. and Stoffer D.S. (1982) An Approach to Time Series Smoothing and Forecasting Using the EM Algorithm. J. of Time Series Analysis, 3, 253–264 (note appendix).

Jazwinski, A. H. (1970) Stochastic Processes and Filtering Theory. Academic Press.

See Also

state, l, SS l.SS TSmodel TSestModel.object

Examples

1
2
3
4
5
6
7
8
data("eg1.DSE.data.diff", package="dse")
#smoother requires an non-innovations form model
model <- TSmodel(toSSChol(estVARXls(eg1.DSE.data.diff))) 
smoothed.model <- smoother(model, eg1.DSE.data.diff, compiled=FALSE)
tfplot(state(smoothed.model))
tfplot(state(smoothed.model, filter=TRUE))
#compare
tfplot(state(smoothed.model, smoother=TRUE), state(smoothed.model, filter=TRUE))

dse documentation built on March 26, 2020, 7:12 p.m.