KimFilterResult#
- class cultivars.state_space.regime_switching.KimFilterResult(*, loglikelihood, loglikelihood_contributions, filtered_prob, predicted_prob, filtered_state, filtered_state_cov, regime_state)[source]#
Output of the Kim (1994) regime-switching Kalman forward pass.
In a state-space model whose system matrices depend on a Markov regime, the exact filter would have to track one Gaussian per regime history, which is \(K^t\) components after \(t\) periods. Kim’s (1994) filter keeps \(K\) of them. At each date it runs the \(K \times K\) Kalman updates from every regime-\(i\) posterior into every regime \(j\), weights them by Hamilton’s recursion, and then collapses over the origin regime by moment matching,
\[a^{j}_{t \mid t} = \frac{\sum_{i=1}^{K} \Pr(S_{t-1} = i, S_t = j \mid y_{1:t})\, a^{(i,j)}_{t \mid t}}{\Pr(S_t = j \mid y_{1:t})},\]with the matching expression for the covariance, which adds the spread of the \(a^{(i,j)}_{t \mid t}\) around \(a^{j}_{t \mid t}\). The collapse is the approximation: the result is exact only when the regime does not affect the state law.
filtered_probandpredicted_probare the regime probabilities,regime_statethe per-regime collapsed states \(a^{j}_{t \mid t}\), andfiltered_statewithfiltered_state_covtheir mixture over regimes, \(\sum_j \Pr(S_t = j \mid y_{1:t})\, a^{j}_{t \mid t}\).- Variables:
filtered_prob (
NDArray[double]) – Contemporaneous regime probabilities,(n, K).predicted_prob (
NDArray[double]) – One-step-ahead regime probabilities,(n, K).filtered_state (
NDArray[double]) – Regime-marginal filtered state means,(n, m).filtered_state_cov (
NDArray[double]) – Regime-marginal filtered covariances,(n, m, m)– mixture covariances, including the between-regime spread.regime_state (
NDArray[double]) – Per-regime collapsed state means,(n, K, m).
See also
KimFilterResult– the public name of this class.RegimeSwitchingLinearSSM.filter()– returns an instance._RegimeSwitchingLinearStateSpace.filter()– returns an instance.
Attributes#
Contemporaneous regime probabilities, |
|
One-step-ahead regime probabilities, |
|
Regime-marginal filtered state means, |
|
Regime-marginal filtered covariances, |
|
Per-regime collapsed state means, |
|
Total log-likelihood of the data under the model. |
|
Per-period contributions, shape |