fks.SP is typically called after the fkf.SP function to calculate "smoothed" estimates of state variables and their corresponding variances. Smoothed estimates are used
when utilizing expectation-maximization (EM) to efficiently estimate the parameters of a state space model.
Sequential Processing Kalman smoother solution:
The fks.SP function uses the solution to the Kalman smoother through sequential processing provided in the textbook of Durbin and Koopman (2001).
Given a state space model has been filtered through the sequential processing Kalman filter algorithm described in fkf.SP, the smoother can be reformulated for the univariate series:
y_t'=(y_(1,1),y_(1,2),,y_(1,p_1),y_(2,1),,y_(t,p_t))y_t'=(y_(1,1),y_(1,2),...y_(1,p_1),y_(2,1),...,y_(t,p_t))
The sequential processing Kalman smoother approach iterates backwards through both observations and time, i.e.: i=p_t, , 1i=p[t], ... ,1 and t=n,,1t=n, ... ,1,
where p_tp_t is the number of observations at time tt and nn is the total number of observations.
The initialisations are:
r_(n,p_n) = 0r(n,p_n)=0
N_(n,p_n)=0N(n,p_n)=0
Then, rr and NN are recursively calculated through:
L_t,i = I_m - K_t,i Z_t,iL(t,i) = I_m - K(t,i) Z(t,i)
r_(t,i-1) = Z_t,i' F_t,i^-1 v_t,i + L_t,i' r_t,ir(t,i-1) = Z(t,i)' F(t,i)^-1 v(t,i) + L(t,i)' r(t,i)
N_t,i-1 = Z_t,i' F_t,i^-1 Z_t,i + L_t,i' N_t,i L_t,iN(t,i-1) = Z(t,i)' F(t,i)^-1 Z(t,i) + L(t,i)' N(t,i) L(t,i)
r_t-1,p_t = T_t-1' r_t,0r(t-1,p_t) = T(t-1)' r(t,0)
N_t-1,p_t = T_t-1' N_t,0 T_t-1N(t-1,p_t) = T(t-1)' N(t,0) T(t-1)
for i=p_t,,1i=p_t, ..., 1 and t=n,,1t=n, ..., 1
The equations for r_t-1,p_tr(t-1,p_t) and N_t-1,p_tN(t-1,p_t) do not apply for t=1t=1
Under this formulation, the values for r_t,0r(t,0) and N_t,0N(t,0) are the same as the values for the smoothing quantities of r_t-1r(t-1) and
N_t-1N(t-1) of the standard smoothing equations, respectively.
The standard smoothing equations for a_tahat(t) and V_tV(t) are used:
a_t = a_t + P_t r_t-1ahat(t) = a(t) + P(t) r(t-1)
V_t = P_t - P_t N_t-1 P_tV(t) = P(t) - P(t) N(t-1) P(t)
Where:
a_t=a_t,1a(t) = a(t,1)
P_t = P_t,1P(t) = P(t,1)
In the equations above, r_t,ir(t,i) is an m 1m X 1 vector, I_mI_m is an m mm X m identity matrix,
K_t,iK(t,i) is an m 1m X 1 column vector, Z_t,iZ(t,i) is a 1 m1 X m row vector, and both F_t,i^-1F(t,i)^-1 and
v_t,iv(t,i) are scalars. The reduced dimensionality of many of the variables in this formulation compared to traditional Kalman smoothing can result in increased computational efficiency.
Finally, in the formulation described above, a_ta(t) and P_tP(t) correspond to the values of att and ptt returned from the fkf.SP function, respectively.