MarkovSwitchingVARResult._likelihood_ratio_obstacle#
- MarkovSwitchingVARResult._likelihood_ratio_obstacle(counterpart)[source]#
Block only the comparison that changes the number of regimes.
A test holding
Mfixed – dropping a switching block, say – is perfectly valid; testingMitself is not, because under the smaller model the extra regime’s parameters are unidentified and its transition probabilities sit on the boundary. A non-switching result counts as the one-regime case, which is exactly the classic invalid test.- Parameters:
counterpart (
_ComparisonMixin) – The other result in the comparison.- Return type:
- Returns:
Nonewhen the test may proceed, else the refusal message.
Example
>>> import numpy as np >>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR >>> 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)) >>> full = MarkovSwitchingVAR(y, order=1, n_regimes=2).fit(seed=0) >>> model = MarkovSwitchingVAR(y, order=1, n_regimes=2, switching_variance=False) >>> same_m = model.fit(seed=0) >>> full._likelihood_ratio_obstacle(same_m) is None True >>> full._likelihood_ratio_obstacle(VAR(y, order=1).fit())[:60] 'a chi-squared likelihood-ratio test cannot compare 2 regimes' >>> same_m.likelihood_ratio_test(full).df 3