VECMResult.forecast#

VECMResult.forecast(steps=1)[source]#

Point forecasts in levels.

Iterates the levels representation from the last order observations, extending the deterministic terms of trend past the sample, so a restricted constant folded into deterministic shifts the path exactly as it shifts the relations.

Parameters:

steps (int) – Horizon.

Return type:

NDArray[double]

Returns:

A (steps, k) array of conditional means for the levels.

Raises:

SpecificationError – If steps is not positive.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> common = np.cumsum(rng.standard_normal(300))
>>> y = np.column_stack([common, 2 * common + rng.standard_normal(300)])
>>> res = VECM(y, order=2, rank=1).fit()
>>> path = res.forecast(12)
>>> path.shape, bool(np.all(np.abs(path[0] - y[-1]) < 2.0))
((12, 2), True)
>>> gap = path @ res.normalized_beta()[:, 0]
>>> bool(abs(gap[-1]) < abs(gap[0]) + 0.5)
True
>>> res.forecast(0)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: steps must be at least 1; got 0.