16.2 Notes on the Kalman filter

The classic Kalman filter/smoother algorithm, as shown in page 331-335 in Shumway and Stoffer (2006), is based on the original smoother presented in Rauch (1963). This Kalman filter is provided in function MARSSkfss(), but the default Kalman filter and smoother used in the MARSS package is based on the algorithm in Kohn and Ansley (1989) and papers by Koopman et al. This Kalman filter and smoother is provided in the KFAS package (Helske 2021). Table 2 in Koopman (1993) indicates that the classic algorithm is 40-100 times slower than the algorithm given in Kohn and Ansley (1989), Koopman (1993), and Koopman, Shephard, and Doornik (1999).

The MARSS package function MARSSkfas() provides a translator between the model objects in MARSS and those in KFAS so that the KFAS functions can be used. MARSSkfas() also includes a lag-one covariance smoother algorithm as this is not output by the KFAS functions, and it provides proper formulation of the priors so that one can use the KFAS functions when the prior on the states is set at \(t=0\) instead of \(t=1\). Simply off-setting your data to start at t=2 and sending that value to \(t_{init}=1\) in the KFAS Kalman filter would not be mathematically correct!