KFS(model, filtering, smoothing, simplify = TRUE, transform = c("ldl", "augment"), nsim = 0, theta, maxiter = 50, convtol = 1e-08)
SSModel
."state"
,
"signal"
, "mean"
, and "none"
. Default is
"state"
for Gaussian and "none"
for non-Gaussian models.
Multiple values are allowed. For Gaussian models, the signal is the mean.
Note that filtering for non-Gaussian models with importance sampling can be
very slow with large models."state"
,
"signal"
, "mean"
, "disturbance"
, and "none"
. Default is "state"
and "mean"
. For
non-Gaussian models, option "disturbance"
is not supported, and for
Gaussian models option "mean"
is identical to "signal"
. Multiple values are
allowed.FALSE
and the model is completely Gaussian, KFS
returns some
generally not so interesting variables from filtering and smoothing. Default
is TRUE
.H
. Defaults to "ldl"
. See function
transformSSM
for details.approxSSM
and performs the
usual Gaussian filtering/smoothing so that the smoothed state estimates
equals to the conditional mode of $p(\alpha[t]|y)$.
In case of nsim = 0
, the mean estimates and their variances are computed using
the Delta method (ignoring the covariance terms).KFS
returns depends on the arguments filtering
,
smoothing
and simplify
, and whether the model is Gaussian or
not:In addition, if argument simplify = FALSE
, list contains following
components:v
, F
,
Finf
, K
and Kinf
are usually not the same as those
calculated in usual multivariate Kalman filter. As filtering is done one
observation element at the time, the elements of the prediction error
$v[t]$ are uncorrelated, and F
, Finf
, K
and
Kinf
contain only the diagonal elemens of the corresponding covariance
matrices. The usual multivariate versions of F
and v
can be
obtained from the output of KFS
using the function
mvInnovations
.In rare cases of a diffuse initialization phase with highly correlated
states, cumulative rounding errors in computing Finf
and Pinf
can sometimes cause the diffuse phase end too early,
or the backward smoothing gives negative variances. Changing the tolerance
parameter tol
of the model (see SSModel
) to smaller (or
larger) can sometimes help. Another option is to redefine the prior state
variances more informative.
Fon non-Gaussian models the components corresponding to diffuse filtering
(Finf
, Pinf
, d
, Kinf
) are not returned even
when filtering
is used. Results based on approximating Gaussian model
can be obtained by running KFS
using the output of approxSSM
.
In case of non-Gaussian models with nsim = 0
, the smoothed estimates
relate to the conditional mode of $p(\alpha|y)$. When using importance
sampling (nsim>0
), results correspond to the conditional mean of
$p(\alpha|y)$.
Koopman, S.J. and Durbin J. (2001). Time Series Analysis by State Space Methods. Oxford: Oxford University Press.
Koopman, S.J. and Durbin J. (2003). Filtering and smoothing of state vector for diffuse state space models, Journal of Time Series Analysis, Vol. 24, No. 1.