qpm_forecast: Model forecast with uncertainty bands

View source: R/forecast.R

qpm_forecastR Documentation

Model forecast with uncertainty bands

Description

Iterates the solved model forward from an initial state and computes analytic forecast uncertainty from the shock variances,

V_h = P V_{h-1} P' + Q S Q'

giving Gaussian fan bands around the mean path. The result can then be conditioned on assumed paths with qpm_condition(), shifted by shock scenarios with qpm_scenario(), or adjusted with logged judgment via add_judgment().

Usage

qpm_forecast(
  object,
  from = NULL,
  horizon = 12,
  bands = c(0.5, 0.7, 0.9),
  sigma = NULL
)

Arguments

object

A qpm_solution.

from

Initial state: a qpm_filtration from qpm_filter() (the smoothed end-of-sample state is used and the smoothed history is kept for plotting), a qpm_sim from simulate(), a full named deviation vector over object$vars_all, or NULL (steady state).

horizon

Forecast horizon in quarters.

bands

Coverage levels for the fan, e.g. c(0.5, 0.7, 0.9).

sigma

Optional named vector of shock standard deviations.

Value

An object of class qpm_forecast: a list with paths (long data frame: variable, h, mean, and ⁠lo_*⁠/⁠hi_*⁠ per band, in levels), forecast-period labels in ⁠$periods⁠, plus the machinery needed for conditioning.

Examples

sol <- qpm_solve(qpm_template("bkl"))
histq <- simulate(sol, nsim = 40, seed = 7, burn = 20)
fc <- qpm_forecast(sol, from = histq, horizon = 12)
fc
plot(fc, vars = c("pi", "i", "y_gap", "q"))

qpmR documentation built on Sept. 29, 2026, 5:10 p.m.