Spillover#

class cultivars.multivariate.large_dim.spillover.Spillover(result, *, horizon=10)[source]#

Diebold-Yilmaz connectedness of any fitted closed reduced form.

Not an estimator: constructs with a fitted result – anything exposing the closed-system surface, from an OLS VAR to a sparse hundred-variable system to one regime of a Markov-switching VAR – and reads its generalized variance decomposition as a directed network. Nothing is re-estimated; the view composes with whatever estimator produced the result, so the connectedness of a lasso VAR on a hundred series is the same two lines as that of a three-variable OLS VAR.

Variables:
  • _result – The fitted closed reduced-form result read from.

  • _horizon – The largest moving-average lead in the decomposition.

Parameters:
  • result (ClosedSystemResult) – A fitted closed reduced-form result – one exposing names, k_endog, sigma_u and ma_representation.

  • horizon (int) – Forecast horizon the decomposition is read at, at least 1; ten to twelve steps is the literature’s habit.

Raises:

SpecificationError – If the result is not a closed system or the horizon is not positive.

See also

  • SpilloverResult – the record compute returns.

  • SparseVAR – the estimator for the wide panels the framework was built for.

  • GraphicalVAR – the sparsity-based network readings of the same system.

References

Diebold, F. X., & Yilmaz, K. (2009). Measuring financial asset return and volatility spillovers, with application to global equity markets. Economic Journal, 119(534), 158-171.

Demirer, M., Diebold, F. X., Liu, L., & Yilmaz, K. (2018). Estimating global bank network connectedness. Journal of Applied Econometrics, 33(1), 1-15.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((300, 3))
>>> a = np.array([[0.5, 0.3, 0.0], [0.0, 0.5, 0.0], [0.0, 0.0, 0.5]])
>>> for t in range(1, 300):
...     y[t] = a @ y[t - 1] + rng.standard_normal(3)
>>> spill = Spillover(VAR(y, order=1).fit(), horizon=10).compute()
>>> spill.table.shape
(3, 3)
>>> bool(np.all(np.abs(spill.table.sum(axis=1) - 100.0) < 1e-8))
True
>>> Spillover(y, horizon=10)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: Spillover reads a fitted closed reduced-form ...

Methods#

compute()

Read the connectedness table off the generalized decomposition.