exdqlmForecast: k-step-ahead quantile forecasts

View source: R/exdqlmForecast.R

exdqlmForecastR Documentation

k-step-ahead quantile forecasts

Description

Computes filtered and k-step-ahead forecast quantiles from a fitted dynamic quantile model and optionally adds them to an existing plot.

Usage

exdqlmForecast(
  y,
  start.t,
  k,
  m1,
  fFF = NULL,
  fGG = NULL,
  plot = TRUE,
  add = FALSE,
  cols = c("purple", "magenta"),
  cr.percent = 0.95
)

Arguments

y

A univariate numeric time series (vector or ts) of the observed response.

start.t

Integer index at which forecasts start (must be within the span of the fitted model in m1).

k

Integer; number of steps ahead to forecast.

m1

A fitted exDQLM model object, typically returned by exdqlmISVB() or exdqlmMCMC().

fFF

Optional state vector(s) for the forecast steps. A numeric matrix with p rows and either 1 column (non–time-varying) or k columns (time-varying). Its dimension must match the fitted model in m1.

fGG

Optional evolution matrix/matrices for the forecast steps. Either a numeric p \times p matrix (non–time-varying) or a p \times p \times k array (time-varying). Its dimensions must match the fitted model in m1.

plot

Logical; if TRUE, plot filtered and forecast quantiles with equal–tailed credible intervals. Default TRUE.

add

Logical; if TRUE, add the forecasted quantiles to the current plot. Default FALSE.

cols

Character vector of length 2 giving the colors for filtered and forecasted quantiles respectively. Default c("purple","magenta").

cr.percent

Numeric in (0, 1); the probability mass for the credible intervals (e.g., 0.95). Default 0.95.

Value

A list with components:

  • fa Forecast state mean vectors (p \times k matrix).

  • fR Forecast state covariance matrices (p \times p \times k array).

  • ff Forecast quantile means (length-k numeric).

  • fQ Forecast quantile variances (length-k numeric).

Examples


 # Toy example; keep small and fast
 y <- scIVTmag[1:100]
 model <- polytrendMod(1, stats::quantile(y, 0.85), 10)
 M0 <- exdqlmISVB(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
                  gam.init = -3.5, sig.init = 15)
 exdqlmForecast(y, start.t = 90, k = 10, m1 = M0)



exdqlm documentation built on Sept. 11, 2025, 9:09 a.m.