KimSmootherResult#

class cultivars.state_space.regime_switching.KimSmootherResult(*, smoothed_prob, smoothed_joint_prob)[source]#

Output of the Kim backward smoother.

The backward pass turns the filtered probabilities into probabilities given the whole sample. With \(\xi_{t \mid T}(j) = \Pr(S_t = j \mid y_{1:T})\),

\[\Pr(S_t = i, S_{t+1} = j \mid y_{1:T}) = \xi_{t \mid t}(i)\, P_{ij}\, \frac{\xi_{t+1 \mid T}(j)}{\xi_{t+1 \mid t}(j)}, \qquad \xi_{t \mid T}(i) = \sum_{j=1}^{K} \Pr(S_t = i, S_{t+1} = j \mid y_{1:T}),\]

started from \(\xi_{T \mid T}\), the last filtered vector. smoothed_prob holds the marginals and smoothed_joint_prob the pairwise terms. The joint terms are what an EM step needs: their sum over \(t\) is the expected number of \(i \to j\) transitions, which is the sufficient statistic for the transition matrix.

Variables:
  • smoothed_prob (NDArray[double]) – Full-sample regime probabilities \(\Pr(S_t = j \mid y_{1:T})\), shape (T, K).

  • smoothed_joint_prob (NDArray[double]) – Consecutive-pair probabilities \(\Pr(S_t = i, S_{t+1} = j \mid y_{1:T})\), shape (T - 1, K, K); entry [t] links period \(t\) to \(t + 1\). Empty when T == 1. These are the expected-transition weights of the EM M-step.

See also

Attributes#

smoothed_prob

Full-sample regime probabilities \(\Pr(S_t = j \mid y_{1:T})\), shape (T, K).

smoothed_joint_prob

Consecutive-pair probabilities \(\Pr(S_t = i, S_{t+1} = j \mid y_{1:T})\), shape (T - 1, K, K); entry [t] links period \(t\) to \(t + 1\).