LongRunSVAR.identify#
- LongRunSVAR.identify()[source]#
Factor the long-run covariance and map back to impact.
- Return type:
- Returns:
The complete structural result, shock columns ordered by permanence.
- Raises:
SpecificationError – If the autoregressive polynomial has a unit root, so no long-run impact matrix exists.
NumericalError – If the recovered impact matrix fails to reproduce the innovation covariance, which indicates the long-run matrix is too ill-conditioned to identify through.
Example
Either ordering reproduces the innovation covariance; the long-run matrix is triangular in the declared one:
>>> import numpy as np >>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR >>> rng = np.random.default_rng(0) >>> y = np.zeros((402, 2)) >>> for t in range(1, 402): ... y[t] = 0.4 * y[t - 1] + rng.standard_normal(2) >>> res = VAR(y, order=1, names=("dy", "u")).fit() >>> first = LongRunSVAR(res).identify() >>> second = LongRunSVAR(res, order=("u", "dy")).identify() >>> bool(abs(first.long_run_impact[0, 1]) < 1e-10) True >>> bool(abs(second.long_run_impact[1, 1]) < 1e-10), second.shock_names (True, ('u', 'dy')) >>> bool(np.allclose(second.impact @ second.impact.T, res.sigma_u)) True