QVARResult.irf#

QVARResult.irf(horizon=20, *, quantile, cumulative=False)[source]#

Reduced-form propagation of one level’s coefficients.

Read this as “how a unit perturbation propagates if the tau-th quantile system were the law of motion” – the pseudo-linearization the quantile-connectedness literature works with, stated as such. There is deliberately no orthogonalized option: quantile regression produces no innovation covariance, so there is nothing to factor and no recursive scheme to declare. Structural language on top of a quantile system is a modelling assumption this result will not smuggle in through a keyword.

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

  • quantile (float) – An estimated level.

  • cumulative (bool) – Return running sums.

Return type:

NDArray[double]

Returns:

An array of shape (horizon + 1, k, k); entry [h, i, j] is the response of variable i at lead h to a unit perturbation of equation j.

Raises:

SpecificationError – If horizon is negative or the level was not estimated.

Example

On the growth-at-risk system the lower-tail response of growth to a financial-conditions perturbation is larger in magnitude than the median response:

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((400, 2))
>>> for t in range(1, 400):
...     fci = 0.6 * y[t - 1, 1] + rng.standard_normal()
...     shock = rng.standard_normal()
...     if shock < 0.0:
...         shock *= np.exp(0.4 * y[t - 1, 1])
...     y[t] = [0.3 * y[t - 1, 0] - 0.2 * y[t - 1, 1] + shock, fci]
>>> res = QVAR(y, order=1).fit(quantiles=(0.1, 0.5))
>>> tail, median = res.irf(4, quantile=0.1), res.irf(4, quantile=0.5)
>>> tail.shape, bool(np.allclose(tail[0], np.eye(2)))
((5, 2, 2), True)
>>> bool(abs(tail[1, 0, 1]) > abs(median[1, 0, 1]))
True
>>> running = res.irf(4, quantile=0.5, cumulative=True)
>>> bool(np.allclose(running[-1], median.sum(axis=0)))
True