STVARResult.regime_weight#

property STVARResult.regime_weight: NDArray[float64][source]#

The transition function evaluated over the sample.

Reproduces the estimator’s own weighting exactly, including the clipping of the exponent – an extreme gamma saturates the weight rather than overflowing exp. The logistic form is monotone in the standardized transition variable, so the two regimes are directional; the exponential form is symmetric about the threshold, so both tails share a regime and the middle is the other.

Returns:

An array of length nobs in [0, 1], aligned with resid.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(1)
>>> y = np.zeros((400, 2))
>>> for t in range(1, 400):
...     g = 1.0 / (1.0 + np.exp(-2.0 * y[t - 1, 0]))
...     y[t] = ((1.0 - g) * 0.6 - g * 0.3) * y[t - 1] + rng.standard_normal(2)
>>> res = STVAR(y, order=1, transition_variable="y1").fit()
>>> weight = res.regime_weight
>>> weight.shape, bool(np.all((0.0 <= weight) & (weight <= 1.0)))
((399,), True)
>>> order = np.argsort(res.threshold_values)
>>> bool(np.all(np.diff(weight[order]) >= 0.0))
True
>>> bool(np.isclose(weight.mean(), res.upper_fraction))
True