l.SS {dse} R Documentation

## Evaluate a state space TSmodel

### Description

Evaluate a state space TSmodel.

### Usage

    ## S3 method for class 'SS'
l(obj1, obj2, sampleT=NULL, predictT=NULL, error.weights=0,
return.state=FALSE, return.track=FALSE, result=NULL,

### Details

This function is called by the function l() when the argument to l is a state space model. Using l() is usually preferable to calling l.SS directly. l.SS calls a compiled program unless compiled=FALSE. The compiled version is much faster than the S version.

Output data must be at least as long as sampleT. If sampleT is not supplied it is taken to be Tobs(data).

Input data must be at least as long as predictT. predictT must be at least as large as sampleT. If predictT is not supplied it is taken to be sampleT.

If error.weights is greater than zero then weighted prediction errors are calculated up to the horizon indicated by the length of error.weights. The weights are applied to the squared error at each period ahead.

sampleT is the length of data which should be used for calculating one step ahead predictions. y must be at least as long as sampleT. If predictT is large than sampleT then the model is simulated to predictT. y is used if it is long enough. u must be at least as long as predictT. The default result=0 returns a list of all the results. Otherwise only the indicated list element is return (eg. result=1 return the likelihood and result=3 returns the one step ahead predictions.

If z0 is supplied in the model object it is used as the estimate of the state at time 0. If not supplied it is set to zero.

If rootP0 is supplied in the model object then t(rootP0) %*% rootP0 is used as P0. If P0 is supplied or calculated from rootP0 in the model object, it is used as the initial tracking error P(t=1|t=0). If not supplied it is set to the identity matrix.

Additional objects in the result are Om is the estimated output cov matrix. pred is the time series of the one-step ahead predictions, E[y(t)|y(t-1),u(t)]. The series of prediction error is given by y - pred If error.weights is greater than zero then weighted prediction errors are calculated up to the horizon indicated by the length of error.weights. The weights are applied to the squared error at each period ahead. trackError is the time series of P, the one step ahead estimate of the state tracking error matrix at each period, Cov(z(t)-E[z(t)|t-1]) The tracking error can only be calculated if Q and R are provided (i.e. non innovations form models). Using the Kalman Innov K directly these are not necessary for the likelihood calculation, but the tracking error cannot be calculated.

### Value

Usually an object of class TSestModel (see TSestModel), but see result above.

### References

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

SS l l.ARMA TSmodel TSestModel TSestModel.object state smoother

### Examples

data("eg1.DSE.data.diff", package="dse")
model <- toSS(TSmodel(estVARXls(eg1.DSE.data.diff)))
lmodel <- l(model,eg1.DSE.data.diff)
summary(lmodel)
tfplot(lmodel)
lmodel <- l(model,eg1.DSE.data.diff, return.state=TRUE)
tfplot(state(lmodel, filter=TRUE))


[Package dse version 2020.2-1 Index]