QVARResult.forecast#

QVARResult.forecast(quantile)[source]#

The one-step-ahead conditional quantile of every variable.

One step only, and deliberately so: iterating this equation would feed a quantile into a quantile, and the tau-quantile of a variable whose regressors are themselves tau-quantiles is not the two-step tau-quantile of the process. The multi-horizon object that means what it says is a direct quantile regression of y_{t+h} on date-t information – a different specification per horizon, which the caller states by fitting it.

Parameters:

quantile (float) – An estimated level.

Return type:

NDArray[double]

Returns:

A (k,) array – the next period’s tau-th conditional quantile.

Raises:

SpecificationError – If the level was not estimated.

Example

The forecast is the level’s coefficients applied to the last observation, and the forecasts order with the level:

>>> import numpy as np
>>> y = np.random.default_rng(0).standard_normal((300, 2))
>>> res = QVAR(y, order=1).fit(quantiles=(0.1, 0.5, 0.9))
>>> point = res.forecast(0.5)
>>> point.shape
(2,)
>>> by_hand = res.deterministic(0.5)[0] + res.coefficients(0.5)[0] @ y[-1]
>>> bool(np.allclose(point, by_hand))
True
>>> bool(np.all(res.forecast(0.1) < point)), bool(np.all(point < res.forecast(0.9)))
(True, True)