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 factorjat leadhmoves the curve by thej-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:
- Return type:
- Returns:
An array of shape
(horizon + 1, n_points, k_factors)whose entry[h, :, j]is the whole curve’s response at leadhto a shock in factorj, 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)