SignRestrictedSVARResult.irf#

SignRestrictedSVARResult.irf(horizon=20, *, quantiles=(0.16, 0.5, 0.84), cumulative=False)[source]#

Pointwise quantiles of the impulse responses across the accepted set.

Parameters:
  • horizon (int) – Largest lead to return.

  • quantiles (Sequence[float]) – Probability levels, each in (0, 1).

  • cumulative (bool) – Return running sums before taking quantiles.

Return type:

NDArray[double]

Returns:

An array of shape (len(quantiles), horizon + 1, k, k). Read it as a summary of the identified set: no single rotation traces any one of these surfaces.

Raises:

SpecificationError – If a quantile is outside the open unit interval.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> rng = np.random.default_rng(0)
>>> res = VAR(rng.standard_normal((121, 2)), order=1, names=("gdp", "infl")).fit()
>>> sset = SignRestrictedSVAR(res, {"d": {"gdp": "+"}}, draws=50, seed=0).identify()
>>> bands = sset.irf(3)
>>> bands.shape, sset.irf(3, quantiles=(0.5,)).shape
((3, 4, 2, 2), (1, 4, 2, 2))
>>> bool(np.all(bands[0] <= bands[1]) and np.all(bands[1] <= bands[2]))
True
>>> bool(np.all(bands[0, 0, 0, 0] > 0.0))
True
>>> sset.irf(3, quantiles=(0.0, 1.0))
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: quantiles must lie in (0, 1); got (0.0, 1.0).