FunctionalVARResult.irf_curves#

FunctionalVARResult.irf_curves(horizon=20, *, orthogonalized=True)[source]#

The curve’s response over time to a one-unit factor shock.

The factor impulse response \(\Psi_h\) of shape (r, r) is pushed through the basis as \(\Phi \Psi_h\), so a shock to factor j at lead h moves the curve by the j-th column. For the Nelson-Siegel basis a level shock therefore shifts the whole curve by the same amount at lead zero without orthogonalization.

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

  • orthogonalized (bool) – Whether to orthogonalize the factor shocks by the Cholesky factor of their innovation covariance, in the factor ordering – with the same ordering caveat that carries.

Return type:

NDArray[double]

Returns:

An array of shape (horizon + 1, n_points, k_factors) whose entry [h, :, j] is the whole curve’s response at lead h to a shock in factor j, the factor impulse response mapped through the basis.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> grid = np.linspace(0.0, 1.0, 25)
>>> curves = 0.1 * np.cumsum(rng.standard_normal(80))[:, None] + np.sin(np.pi * grid)
>>> res = FunctionalVAR(curves, grid, order=1, basis="fpca", n_components=1).fit()
>>> response = res.irf_curves(4, orthogonalized=False)
>>> response.shape, bool(np.allclose(response[0, :, 0], res.basis_matrix[:, 0]))
((5, 25, 1), True)