ConditionalSpectralCausalityResult.integrated#

ConditionalSpectralCausalityResult.integrated()[source]#

The measures integrated over frequency, one value per effect.

\(\frac{1}{\pi} \int_0^{\pi} f_{x \to y \mid z}(\omega)\, d\omega\) by the trapezoidal rule on the grid, which recovers Geweke’s time-domain conditional measure up to the two models’ compatibility.

Return type:

NDArray[double]

Returns:

A (k - 1,) array in effect_names order.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((600, 3))
>>> for t in range(1, 600):
...     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()
...     y[t, 2] = 0.5 * y[t - 1, 2] + rng.standard_normal()
>>> full = VAR(y, order=1).fit()
>>> without = VAR(y[:, [0, 2]], order=1, names=("y1", "y3")).fit()
>>> ConditionalSpectralCausality(full, without).compute().integrated().round(2)
array([0.16, 0.  ])