Description Usage Arguments Details Value References See Also Examples

Evaluate a state space TSmodel.

1 2 3 4 5 |

`obj1` |
An 'SS' 'TSmodel' object. |

`obj2` |
A TSdata object. |

`sampleT` |
an integer indicating the last data point to use for one step ahead filter estimation. If NULL all available data is used. |

`predictT` |
an integer indicating how far past the end of the sample predictions should be made. For models with an input, input data must be provided up to predictT. Output data is necessary only to sampleT. If NULL predictT is set to sampleT. |

`error.weights` |
a vector of weights to be applied to the squared prediction errors. |

`return.state` |
if TRUE the element |

`return.track` |
if TRUE the element |

`result` |
if result is not specified an object of class
TSestModel is returned. Otherwise, the specified element
of |

`compiled` |
if TRUE the compiled version of the code is used. Otherwise the S/R version is used. |

`warn` |
if FALSE then certain warning messages are turned off. |

`return.debug.info` |
logical indicating if additional debugging information should be returned. |

`...` |
(further arguments, currently disregarded). |

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.

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

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`

1 2 3 4 5 6 7 | ```
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))
``` |

dse documentation built on Aug. 6, 2017, 3:01 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.