PanelVARResult.forecast#
- PanelVARResult.forecast(steps=1, *, unit=None)[source]#
Point forecasts for one unit.
Iterates the pooled autoregression from the unit’s own last
orderobservations, with the unit’s intercept under fixed effects or the pooled deterministic terms extended past that unit’s sample otherwise.- Parameters:
- Return type:
- Returns:
A
(steps, k)array of conditional means.- Raises:
SpecificationError – If
stepsis not positive,unitis omitted, or the unit is unknown.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> units = [rng.standard_normal((60, 2)) + shift for shift in (0.0, 5.0)] >>> res = PanelVAR(units, order=1).fit() >>> path = res.forecast(2, unit="unit2") >>> first = res.unit_effects["unit2"] + res.coefficients[0] @ units[1][-1] >>> path.shape, bool(np.allclose(path[0], first)) ((2, 2), True) >>> res.forecast(2) Traceback (most recent call last): cultivars.exceptions.SpecificationError: a panel forecast is unit-specific: pass ...