MixedSVAR.identify#

MixedSVAR.identify()[source]#

Solve for the rotation satisfying every declared cell.

Both components of the orthogonal group are searched – rotations directly, reflections through a fixed sign flip of the factor – so a pattern with nonzero fixed values is reachable wherever it lives. Columns whose fixed cells are all zero are signed so their largest entry is positive; a column with a nonzero fixed value keeps the sign that value implies.

Return type:

SVARResult

Returns:

The complete structural result.

Raises:
  • SpecificationError – If the autoregressive polynomial has a unit root, so no long-run matrix exists.

  • NumericalError – If no rotation satisfies the restrictions, which is the rank condition failing at this pattern – the declared cells are arranged so that no factorization of this covariance can honor all of them at once.

Example

A single long-run zero in two variables is the Blanchard-Quah triangle, and the rotation lands on the closed form; a fixed impact value no factorization can reach is refused:

>>> 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()
>>> nan = np.nan
>>> mixed = MixedSVAR(res, long_run=[[nan, 0.0], [nan, nan]]).identify()
>>> bool(np.allclose(mixed.impact, LongRunSVAR(res).identify().impact))
True
>>> dict(mixed.diagnostics)["At the long run"], mixed.restriction[:27]
('1', '0 cells fixed on impact and')
>>> MixedSVAR(res, impact=[[nan, 5.0], [nan, nan]], long_run=[[nan, nan], [nan, 0.0]])
...
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: a rotation-solved mixed pattern needs ...
>>> MixedSVAR(res, long_run=[[nan, 5.0], [nan, nan]]).identify()
Traceback (most recent call last):
cultivars.exceptions.NumericalError: no factorization of the innovation covariance ...