MarkovSwitchingVARResult.most_likely_regime#

property MarkovSwitchingVARResult.most_likely_regime: NDArray[int64][source]#

Pointwise most probable regime under the smoothed posterior.

The marginal MAP state at each date, not the Viterbi path: the sequence can contain a one-period switch whose transition probability is near zero. Use it to date regimes, not to reason about the sequence of switches.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> s = np.repeat([0, 1, 0, 1], 100)
>>> y = np.array([[-1.0, -0.5], [1.5, 1.0]])[s] + 0.4 * rng.standard_normal((400, 2))
>>> res = MarkovSwitchingVAR(y, order=1, n_regimes=2).fit(seed=0)
>>> path = res.most_likely_regime
>>> path.shape, path.dtype.name, bool((path == s[1:]).mean() > 0.98)
((399,), 'int64', True)