SpectralCausalityResult.integrated#

SpectralCausalityResult.integrated()[source]#

The measures integrated over frequency: the time-domain reading.

\[F_{j \to i} = \frac{1}{\pi} \int_0^{\pi} f_{j \to i}(\omega)\, d\omega,\]

which equals the average over the full circle by symmetry, and recovers Geweke’s time-domain measure \(\ln(\sigma^2_{\text{restricted}} / \sigma^2_{\text{full}})\) up to the approximation the literature documents. Trapezoidal on the grid.

Return type:

NDArray[double]

Returns:

A (k, k) array, [effect, cause], zero diagonal.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((500, 2))
>>> for t in range(1, 500):
...     y[t, 0] = 0.5 * y[t - 1, 0] + 0.4 * y[t - 1, 1] + rng.standard_normal()
...     y[t, 1] = 0.5 * y[t - 1, 1] + rng.standard_normal()
>>> causal = SpectralCausality(VAR(y, order=1).fit(), n_frequencies=64).compute()
>>> totals = causal.integrated()
>>> totals.shape, bool(totals[0, 1] > 10 * totals[1, 0])
((2, 2), True)