QVARResult.quantile_path#

QVARResult.quantile_path(name, quantile)[source]#

One variable’s in-sample conditional quantile path.

Parameters:
  • name (str) – An endogenous variable.

  • quantile (float) – An estimated level.

Return type:

NDArray[double]

Returns:

An array of length nobs.

Raises:

SpecificationError – If the variable or level is unknown.

Example

The share of observations below the fitted tau-path is tau, the defining property of the check-loss optimum:

>>> import numpy as np
>>> y = np.random.default_rng(0).standard_normal((300, 2))
>>> res = QVAR(y, order=1).fit(quantiles=(0.25, 0.75))
>>> path = res.quantile_path("y2", 0.25)
>>> path.shape, bool(abs(np.mean(y[1:, 1] < path) - 0.25) < 0.01)
((299,), True)
>>> res.quantile_path("y3", 0.25)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: unknown variable 'y3'; expected one of ...