BVARResult.forecast#
- BVARResult.forecast(steps=8, *, seed=None)[source]#
The posterior predictive: parameter and shock uncertainty.
The three-number summary of
forecast_paths(): at every lead and variable, the 16th percentile, mean, and 84th percentile across the simulated paths, a pointwise 68% central band of the predictive distribution \(p(y_{T+h} \mid Y)\). Because each path was simulated under its own draw of \((B, \Sigma)\), the band integrates over parameter uncertainty as well as over the shocks. The point path’s intervals condition on the estimated parameters instead, and for a large shrunk system that conditioning discards the larger half of the uncertainty; the width of this band relative to that one is a direct reading of how much the posterior is still spread.The middle entry is the predictive mean estimated by Monte Carlo, not the point forecast from iterating
beta_mean. The two differ from lead two onward because a multi-step forecast is nonlinear in the coefficients, and they differ at every lead by the Monte Carlo error ofSpaths. For the mean forecast of a specific draw, or of the posterior mean, usesimulate()or iteratecoefficientsanddeterministicdirectly.- Parameters:
steps (
int) – Horizons aheadH; the summary coversT + 1 .. T + H.seed (
int|Generator|None) – Seed or generator for the predictive shocks, passed toforecast_paths(); the same seed reproduces the same summary.
- Return type:
- Returns:
An array of shape
(steps, k, 3)whose last axis is(16th percentile, mean, 84th percentile); entry[h, i, :]summarizes variableiat leadh + 1.- Raises:
SpecificationError – If
stepsis not positive.
Example
>>> import numpy as np >>> from cultivars.multivariate.large_dim.bayesian import BVAR >>> rng = np.random.default_rng(0) >>> y = np.zeros((120, 2)) >>> for t in range(1, 120): ... y[t] = 0.7 * y[t - 1] + rng.standard_normal(2) >>> res = BVAR(y, order=1, names=("growth", "inflation")).fit(n_draws=200, seed=0) >>> fc = res.forecast(4, seed=0) >>> fc.shape (4, 2, 3)
The summary is exactly that of the paths under the same seed:
>>> paths = res.forecast_paths(4, seed=0) >>> np.allclose(fc[..., 1], paths.mean(axis=0)) True
For a stationary system the predictive band widens with the lead:
>>> width = fc[:, :, 2] - fc[:, :, 0] >>> bool((width[-1] > width[0]).all()) True
See also
forecast_paths()– the paths this summarizes, for scoring, fan charts, and path-dependent quantities.Backtest– rolls the predictive through the sample and scores it out of sample.VARResult– the point-estimated counterpart, whose forecast intervals condition on the estimated coefficients.
References
Kadiyala, K. R., & Karlsson, S. (1997). Numerical methods for estimation and inference in Bayesian VAR-models. Journal of Applied Econometrics, 12(2), 99-132.
Karlsson, S. (2013). Forecasting with Bayesian vector autoregression. In G. Elliott & A. Timmermann (Eds.), Handbook of Economic Forecasting (Vol. 2A, pp. 791-897). Elsevier.