LongMemorySVResult.volatility_bands#

LongMemorySVResult.volatility_bands(level=0.95)[source]#

Smoother bands on the volatility at a Gaussian coverage level.

The band is the smoother’s stationary error, so its width in logs is the same at every observation.

Parameters:

level (float) – Coverage probability in (0, 1).

Return type:

tuple[NDArray[double], NDArray[double]]

Returns:

(lower, upper) bands, each (n,).

Raises:

SpecificationError – If level is outside (0, 1).

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> res = LongMemorySV(rng.standard_normal(300)).fit()
>>> lower, upper = res.volatility_bands()
>>> bool(np.all(lower < res.volatility)), bool(np.all(res.volatility < upper))
(True, True)
>>> ratio = upper / lower
>>> bool(np.allclose(ratio, ratio[0]))
True
>>> res.volatility_bands(1.0)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: level must lie in (0, 1); got 1.0.