SpectralDensityResult._index#

SpectralDensityResult._index(name)[source]#

The axis index of a variable label, after checking it exists.

Parameters:

name (str) – One of names.

Return type:

int

Returns:

Its position.

Raises:

SpecificationError – If the label is unknown.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> y = np.random.default_rng(0).standard_normal((200, 2))
>>> res = VAR(y, order=1, names=("gdp", "rate")).fit()
>>> density = SpectralDensity(res, n_frequencies=16).compute()
>>> density._index("rate")
1
>>> density._index("cpi")
Traceback (most recent call last):
    ...
cultivars.exceptions.SpecificationError: unknown variable 'cpi'; the system has ...