FIS function

(Fast) Fixed-Interval Smoother (Kalman Smoother)

(Fast) Fixed-Interval Smoother (Kalman Smoother)

FIS(A, F, F_pred, P, P_pred, F_0 = NULL, P_0 = NULL)

Arguments

  • A: transition matrix (rpxrprp x rp).
  • F: state estimates (TxrpT x rp).
  • F_pred: state predicted estimates (TxrpT x rp).
  • P: variance estimates (rpxrpxTrp x rp x T).
  • P_pred: predicted variance estimates (rpxrpxTrp x rp x T).
  • F_0: initial state vector (rpx1rp x 1) or empty (NULL).
  • P_0: initial state covariance (rpxrprp x rp) or empty (NULL).

Returns

Smoothed state and covariance estimates, including initial (t = 0) values. - F_smooth: TxrpT x rp smoothed state vectors, equal to the filtered state in period TT.

  • P_smooth: rpxrpxTrp x rp x T smoothed state covariance, equal to the filtered covariance in period TT.

  • F_smooth_0: 1xrp1 x rp initial smoothed state vectors, based on F_0.

  • P_smooth_0: rpxrprp x rp initial smoothed state covariance, based on P_0.

Details

The Kalman Smoother is given by:

Jt=PtA+inv(Pt+1pred)J(t)=P(t)Ainv(Ppred(t+1)) \textbf{J}_t = \textbf{P}_t \textbf{A} + inv(\textbf{P}^{pred}_{t+1})J(t) = P(t) A inv(P_pred(t+1)) Ftsmooth=Ft+Jt(Ft+1smoothFt+1pred)Fsmooth(t)=F(t)+J(t)(Fsmooth(t+1)Fpred(t+1)) \textbf{F}^{smooth}_t = \textbf{F}_t + \textbf{J}_t (\textbf{F}^{smooth}_{t+1} - \textbf{F}^{pred}_{t+1})F_smooth(t) = F(t) + J(t) (F_smooth(t+1) - F_pred(t+1)) Ptsmooth=Pt+Jt(Pt+1smoothPt+1pred)JtPsmooth(t)=P(t)+J(t)(Psmooth(t+1)Ppred(t+1))J(t) \textbf{P}^{smooth}_t = \textbf{P}_t + \textbf{J}_t (\textbf{P}^{smooth}_{t+1} - \textbf{P}^{pred}_{t+1}) \textbf{J}_t'P_smooth(t) = P(t) + J(t) (P_smooth(t+1) - P_pred(t+1)) J(t)'

The initial smoothed values for period t = T are set equal to the filtered values. If F_0 and P_0 are supplied, the smoothed initial conditions (t = 0 values) are also calculated and returned. For further details see any textbook on time series such as Shumway & Stoffer (2017), which provide an analogous R implementation in astsa::Ksmooth0.

Examples

# See ?SKFS

References

Shumway, R. H., & Stoffer, D. S. (2017). Time Series Analysis and Its Applications: With R Examples. Springer.

Harvey, A. C. (1990). Forecasting, structural time series models and the Kalman filter.

See Also

SKF SKFS

  • Maintainer: Sebastian Krantz
  • License: GPL-3
  • Last published: 2024-06-09