HeteroskedasticSVAR.identify#
- HeteroskedasticSVAR.identify()[source]#
Recover the impact matrix from the variance shifts.
Whitens every later regime’s covariance by the first regime’s Cholesky factor, takes the eigenvectors of the whitened second regime, refines them by joint diagonalization when there are more than two regimes, orders the columns by descending ratio, and signs each column so its largest entry is positive.
- Return type:
- Returns:
The complete structural result, shock columns in descending order of second-regime variance ratio, unit variance in the first regime, with the per-regime variance ratios, the minimum ratio separation, an identification verdict and – beyond two regimes – the co-diagonalization residual in its diagnostics.
- Raises:
NumericalError – If a regime covariance is not positive definite, or two variance ratios coincide and the shocks sharing them are unidentified.
Example
A system whose shocks both triple their standard deviation across the split carries no identifying information – the ratios tie up to sampling noise – and the diagnostics say so; with three regimes the over-identified fit reports its residual:
>>> import numpy as np >>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR >>> rng = np.random.default_rng(0) >>> B = np.array([[1.0, 0.5], [0.3, 1.0]]) >>> eps = rng.standard_normal((402, 2)) >>> eps[201:] *= 3.0 >>> y = np.zeros((402, 2)) >>> for t in range(1, 402): ... y[t] = 0.4 * y[t - 1] + B @ eps[t] >>> labels = ["calm"] * 200 + ["volatile"] * 201 >>> tied = HeteroskedasticSVAR(VAR(y, order=1).fit(), labels).identify() >>> dict(tied.diagnostics)["Identification"] 'WEAK: separation within sampling noise' >>> eps = rng.standard_normal((402, 2)) >>> eps[131:261, 0] *= 3.0 >>> eps[261:, 1] *= 2.5 >>> for t in range(1, 402): ... y[t] = 0.4 * y[t - 1] + B @ eps[t] >>> three = ["a"] * 130 + ["b"] * 130 + ["c"] * 141 >>> svar = HeteroskedasticSVAR(VAR(y, order=1).fit(), three, shock_names=("u", "v")) >>> report = dict(svar.identify().diagnostics) >>> report["Regimes"], report["Identification"], "Co-diagonalization residual" in report ('3', 'distinct ratios', True)