MarkovSwitchingVARResult._conditional_mean#
- static MarkovSwitchingVARResult._conditional_mean(model, stack, deterministic)[source]#
One regime’s one-step conditional means over the effective sample.
Lays the regime’s blocks out against the model’s
[deterministic | lags]design and multiplies through.- Parameters:
model (
_MarkovSwitchingVectorAutoRegressionModel[MarkovSwitchingVARResult]) – The model, read for its design matrix.stack (
NDArray[double]) – The regime’s(p, k, k)lag coefficients.deterministic (
NDArray[double]) – The regime’s(d, k)deterministic block.
- Return type:
- Returns:
A
(nobs, k)array of conditional means as if the regime held at every date.
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)) >>> model = MarkovSwitchingVAR(y, order=1, n_regimes=2) >>> res = model.fit(seed=0) >>> view = res.regimes[1] >>> mean = MarkovSwitchingVARResult._conditional_mean( ... model, view.coefficients, view.deterministic ... ) >>> hand = view.deterministic[0] + y[:-1] @ view.coefficients[0].T >>> mean.shape, bool(np.allclose(mean, hand)) ((399, 2), True)