ConditionalSpectralCausalityResult._index#

ConditionalSpectralCausalityResult._index(name)[source]#

The column index of an effect label, after checking it exists.

Parameters:

name (str) – One of effect_names.

Return type:

int

Returns:

Its position.

Raises:

SpecificationError – If the label is unknown, including when it is the cause.

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._index("y3")
1
>>> given._index("y2")
Traceback (most recent call last):
    ...
cultivars.exceptions.SpecificationError: unknown effect 'y2'; the conditional system ...