MarkovSwitchingVARResult.regime#
- MarkovSwitchingVARResult.regime(index)[source]#
One regime’s closed-system view, identity-stable across calls.
- Parameters:
index (
int) – Regime label in0..M-1, under the fit’s ordering convention.- Return type:
_RegimeSystemResult- Returns:
The
RegimeSystemResult. The same object every call, so an identification result built from it remembers its source by identity.- Raises:
SpecificationError – If
indexis out of range.
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) >>> view = res.regime(1) >>> view is res.regime(1), view.index, view.is_stable, view.ma_representation(2).shape (True, 1, True, (3, 2, 2)) >>> res.regime(2) Traceback (most recent call last): cultivars.exceptions.SpecificationError: regime must be in 0..1; got 2.