smoother {dse1} | R Documentation |
Evaluate a state space model.
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) ## S3 method for class 'TSrestrictedModel': smoother(model, data, compiled=.DSEflags()$COMPILED)
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. |
Calculate fixed interval smoother state values for a model. Smoother first runs the filter and usess the filtered state to calculate a smoothed estimate of the state (sometimes called a two sided filter). The smoother requires an non-innovations for model. The method for a TSmodel simply gives an error message if the model does not inherit class code{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 to the length of input data if that is smaller than the available filter data. See SS for details of the model:
z(t) = Fz(t-1) + Gu(t) + Qe(t) y(t) = Hz(t) + Rw(t)
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).
state
,
l
,
SS
l.SS
TSmodel
TSestModel.object
data("eg1.DSE.data.diff", package="dse1") #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))