VECMXResult.forecast#
- VECMXResult.forecast(steps=1, *, exog_future=None)[source]#
Point forecasts conditional on a future path for the exogenous block.
Iterates the short-run equation forward in its own coordinates: at each step the disequilibrium \(\hat\beta' z_{t-1}\) is rebuilt from the joint path (with the restricted constant or trend appended when the Johansen case carries one), the lagged differences are read off the path, the contemporaneous impact uses the supplied exogenous change, and the modelled levels advance by the predicted difference.
- Parameters:
steps (
int) – Horizon.exog_future (
ArrayLike|None) – A(steps, k_x)path in the column order ofexog_names. Required.
- Return type:
- Returns:
A
(steps, k_y)array of conditional means for the modelled levels.- Raises:
SpecificationError – If
stepsis not positive or the path is omitted.DimensionError – If the path has the wrong shape.
Example
Holding
xat its last value, the modelled variable closes its gap to it over the horizon:>>> import numpy as np >>> rng = np.random.default_rng(0) >>> x = np.cumsum(rng.standard_normal(300)) >>> y1 = np.zeros(300) >>> for t in range(1, 300): ... y1[t] = y1[t - 1] + 0.4 * (x[t - 1] - y1[t - 1]) + 0.5 * rng.standard_normal() >>> res = VECMX(y1[:, None], x[:, None], order=2, rank=1).fit() >>> path = res.forecast(8, exog_future=np.full((8, 1), x[-1])) >>> gap = np.abs(path[:, 0] - x[-1]) >>> path.shape, bool(gap[-1] < 0.5 * gap[0]) ((8, 1), True) >>> res.forecast(3) Traceback (most recent call last): cultivars.exceptions.SpecificationError: a conditional forecast needs the exogenous ... >>> res.forecast(3, exog_future=np.zeros((3, 2))) Traceback (most recent call last): cultivars.exceptions.DimensionError: exog_future has 2 columns but the model was ...