MarkovSwitchingARResult.most_likely_regime#
- property MarkovSwitchingARResult.most_likely_regime: NDArray[int64][source]#
Pointwise most probable regime under the smoothed posterior.
This is the marginal MAP state at each date, taken independently, not the Viterbi path. The distinction matters: the sequence returned here can contain a one-period switch whose transition probability is near-zero, so as a path it may have essentially no posterior mass even though every element of it is individually most likely. Use it to date regimes, not to reason about the sequence of switches.
- Returns:
An integer array of length
nobswith values in0..K-1.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> res = MarkovSwitchingAR(rng.standard_normal(300), order=1).fit(seed=0, n_init=2) >>> regime = res.most_likely_regime >>> regime.dtype, regime.shape, bool(set(regime) <= {0, 1}) (dtype('int64'), (299,), True)