## S3 method for class 'SS':
l(obj1, obj2, sampleT=NULL, predictT=NULL, error.weights=0,
return.state=FALSE, return.track=FALSE, result=NULL,
compiled=.DSEflags()$COMPILED,
warn=TRUE, return.debug.info=FALSE, ...)
filter$state
containing E[z(t)|y(t-1), u(t)] is returned as part of the
result. This can be a fairly large matrix.filter$track
containing
the expectation of the tracking error given y(t-1) and u(t) is
returned as part of the result. This can be an very large array.TSestModel$estimates
is returned.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.
SS
l
l.ARMA
TSmodel
TSestModel
TSestModel.object
state
smoother
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))
Run the code above in your browser using DataLab