SignRestrictedSVARResult.fevd#
- SignRestrictedSVARResult.fevd(horizon=20, *, quantiles=(0.16, 0.5, 0.84))[source]#
Pointwise quantiles of the variance decomposition across the set.
Each accepted rotation is complete, so within a rotation the shares sum to one; the quantile surfaces, being pointwise, need not – except with two variables, where the second share is one minus the first and the quantiles mirror exactly.
- Parameters:
- Return type:
- Returns:
An array of shape
(len(quantiles), horizon + 1, k, k); entry[q, h, i, j]is theq-quantile of shockj’s share of variablei’s forecast-error variance at leadh.- 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, 3)), order=1).fit() >>> sset = SignRestrictedSVAR(res, {"d": {"y1": "+"}}, draws=50, seed=0).identify() >>> shares = sset.fevd(3) >>> shares.shape, bool(np.all((0.0 <= shares) & (shares <= 1.0))) ((3, 4, 3, 3), True) >>> draws = sset.irf_draws(3) >>> explained = np.cumsum(draws**2, axis=1) >>> own = explained / explained.sum(axis=3, keepdims=True) >>> bool(np.allclose(own.sum(axis=3), 1.0)) True >>> bool(np.allclose(shares[1].sum(axis=2), 1.0)) False