KalmanFilterResult#
- class cultivars.state_space.linear_gaussian.KalmanFilterResult(*, loglikelihood, loglikelihood_contributions, predicted_state, predicted_state_cov, filtered_state, filtered_state_cov)[source]#
Output of a linear-Gaussian forward filtering pass.
For the model of
_LinearGaussianStateSpacethe pass carries two conditional laws of the state through the sample, each Gaussian and so summarized by a mean and a covariance:\[a_{t \mid t-1} = \mathbb{E}[\alpha_t \mid y_{1:t-1}], \quad P_{t \mid t-1} = \operatorname{Var}[\alpha_t \mid y_{1:t-1}], \qquad a_{t \mid t} = \mathbb{E}[\alpha_t \mid y_{1:t}], \quad P_{t \mid t} = \operatorname{Var}[\alpha_t \mid y_{1:t}].\]They are tied together by the update and prediction steps. With the innovation \(v_t = y_t - d_t - Z_t a_{t \mid t-1}\) and its covariance \(F_t = Z_t P_{t \mid t-1} Z_t^\top + H_t\),
\[ \begin{align}\begin{aligned}a_{t \mid t} = a_{t \mid t-1} + P_{t \mid t-1} Z_t^\top F_t^{-1} v_t, \qquad P_{t \mid t} = P_{t \mid t-1} - P_{t \mid t-1} Z_t^\top F_t^{-1} Z_t P_{t \mid t-1},\\a_{t+1 \mid t} = c_t + T_t a_{t \mid t}, \qquad P_{t+1 \mid t} = T_t P_{t \mid t} T_t^\top + R_t Q_t R_t^\top.\end{aligned}\end{align} \]predicted_stateandpredicted_state_covhold the first pair,filtered_stateandfiltered_state_covthe second.- Variables:
predicted_state – One-step-ahead predicted states \(a_{t \mid t-1}\),
(n, m).predicted_state_cov – Predicted state covariances \(P_{t \mid t-1}\),
(n, m, m).filtered_state – Contemporaneously filtered states \(a_{t \mid t}\),
(n, m).filtered_state_cov – Filtered state covariances \(P_{t \mid t}\),
(n, m, m).
See also
KalmanFilterResult– the public name of this class.MFVAR.filter()– returns an instance.LinearGaussianSSM.filter()– returns an instance.NonlinearSSM.extended_filter()– returns an instance.NonlinearSSM.unscented_filter()– returns an instance.
Attributes#
One-step-ahead predicted states \(a_{t \mid t-1}\), |
|
Predicted state covariances \(P_{t \mid t-1}\), |
|
Contemporaneously filtered states \(a_{t \mid t}\), |
|
Filtered state covariances \(P_{t \mid t}\), |
|
Total log-likelihood of the data under the model. |
|
Per-period contributions, shape |