## 5.4 General Kalman Filter

The more general formulation of the state space model described in the previous section as an observation equation $y_t = A_t x_t + V_t$ and a state equation $x_t = \Theta x_{t-1} + W_t$ where $$y_t$$ is a $$p\times 1$$ vector, $$x_t$$ is a $$k\times 1$$ vector, $$A_t$$ is a $$p\times k$$ matrix and $$\Theta$$ is $$k\times k$$ matrix. We can think of $$V_t\sim\mathcal{N}(0, S)$$ and $$W_t\sim\mathcal{N}(0, R)$$.

Given an initial state $$x_0^0$$ and $$P_0^0$$, the prediction equations are (analogous to above) $\begin{eqnarray*} x_1^0 & = & \Theta x_0^0\\ P_1^0 & = & \Theta P_0^0\Theta^\prime + R \end{eqnarray*}$ and the updating equations are, given a new observation $$y_1$$, $\begin{eqnarray*} x_1^1 & = & x_1^0 + K_1(y_1 - A_1 x_1^0)\\ P_1^1 & = & (I - K_1A_1) P_1^0 \end{eqnarray*}$ where $K_1 = P_1^0A_1^\prime(A_1P_1^0A_1^\prime + S)^{-1}.$ In general, given the current state $$x_{t-1}^{t-1}$$ and $$P_{t-1}^{t-1}$$ and a new observation $$y_t$$, we have $\begin{eqnarray*} x_t^{t-1} & = & \Theta x_{t-1}^{t-1}\\ P_t^{t-1} & = & \Theta P_{t-1}^{t-1}\Theta^\prime + R \end{eqnarray*}$ and the updating equations are, given a new observation $$y_t$$, $\begin{eqnarray*} x_t^t & = & x_t^{t-1} + K_t(y_t - A_t x_t^{t-1})\\ P_t^t & = & (I - K_tA_t) P_t^{t-1} \end{eqnarray*}$ where $K_t = P_t^{t-1}A_t^\prime(A_tP_t^{t-1}A_t^\prime + S)^{-1}.$