ConditionalSpectralCausality.compute#

ConditionalSpectralCausality.compute()[source]#

Decompose every effect’s restricted innovation power.

Evaluates the full transfer function on the grid, builds the restricted lag polynomial \(Q(\omega)\) and embeds it in the full dimension, forms \(G = Q \Psi P\) with the cause’s shock ordered last in the Cholesky factor, and for each effect splits \(\sum_s |G_{ys}|^2\) into the cause’s column and the rest. The consistency diagnostic compares the total against the restricted innovation variance. Deterministic.

Return type:

ConditionalSpectralCausalityResult

Returns:

The ConditionalSpectralCausalityResult.

Raises:

NumericalError – If the full system’s innovation covariance is not positive definite, so the Cholesky factor does not exist.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> y = np.random.default_rng(0).standard_normal((200, 3))
>>> full = VAR(y, order=1).fit()
>>> without = VAR(y[:, [0, 2]], order=1, names=("y1", "y3")).fit()
>>> given = ConditionalSpectralCausality(full, without, n_frequencies=16).compute()
>>> given.frequencies.shape, given.measure.shape, bool(np.all(given.measure >= 0.0))
((16,), (16, 2), True)