FactorSVResult.idiosyncratic_volatility#

FactorSVResult.idiosyncratic_volatility(series, *, quantiles=(0.16, 0.5, 0.84))[source]#

Posterior quantiles of one series’ idiosyncratic standard deviation.

The quantiles of \(\exp(\eta_{it} / 2)\) across draws at each date: the part of the series’ volatility the factors do not carry.

Parameters:
  • series (str | int) – A series label or column index.

  • quantiles (Sequence[float]) – Probability levels, each in (0, 1).

Return type:

NDArray[double]

Returns:

An array of shape (len(quantiles), T).

Raises:

SpecificationError – If the series is unknown or a quantile is outside the open unit interval.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> f = rng.standard_normal(200)
>>> y = np.outer(f, [1.0, 0.8, 0.6]) + 0.3 * rng.standard_normal((200, 3))
>>> res = FactorSV(y, n_factors=1, series_names=("a", "b", "c")).fit(
...     n_draws=200, n_burn=50, seed=0
... )
>>> band = res.idiosyncratic_volatility("b")
>>> band.shape, bool(np.array_equal(band, res.idiosyncratic_volatility(1)))
((3, 200), True)
>>> bool(0.2 < band[1].mean() < 0.4)
True
>>> res.idiosyncratic_volatility("d")
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: unknown series 'd'; have ('a', 'b', 'c').