QVARResult._index_of#

QVARResult._index_of(quantile)[source]#

Resolve a level to its position, refusing levels never estimated.

Parameters:

quantile (float) – A level, matched to within 1e-9.

Return type:

int

Returns:

Its index along the level axis of every (Q, ...) array.

Raises:

SpecificationError – If no estimated level matches.

Example

>>> import numpy as np
>>> y = np.random.default_rng(0).standard_normal((120, 2))
>>> res = QVAR(y, order=1).fit(quantiles=(0.1, 0.5, 0.9))
>>> res._index_of(0.9), res._index_of(0.1 + 1e-12)
(2, 0)
>>> res._index_of(0.3)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: quantile 0.3 was not estimated; available ...