MarkovSwitchingARResult.probabilities#

MarkovSwitchingARResult.probabilities(kind='smoothed')[source]#

Return one of the three regime posteriors.

Parameters:

kind (Literal['smoothed', 'filtered', 'predicted']) – "smoothed" conditions on the whole sample and is what you want for dating regimes after the fact; "filtered" conditions on data through t and is the real-time view; "predicted" conditions through t - 1 and is the one-step-ahead forecast of the state.

Return type:

NDArray[double]

Returns:

An array of shape (nobs, K) whose rows sum to one.

Raises:

SpecificationError – If kind is not one of the three.

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)
>>> res.probabilities("filtered").shape, res.probabilities().sum(axis=1).round(6).max()
((299, 2), np.float64(1.0))
>>> res.probabilities("viterbi")
Traceback (most recent call last):
    ...
cultivars.exceptions.SpecificationError: kind must be one of ('smoothed', ...