Postprocessing

From point to probabilistic forecasts

Building probabilistic forecasts from point predictions is the core functionality of PostForecasts.jl. The function point2quant turns PointForecasts into QuantForecasts, allowing to easily postprocess point predictions using a selected method, length of the training window and retraining frequency. See Models for details on the available postprocessing methods.

PostForecasts.point2quantFunction
point2quant(pf; method, window, quantiles[, start, stop, retrain])

Compute probabilistic forecast based on pf::PointForecasts using PostModel specified by method::Symbol.

Return QuantForecasts containing forecasts of specified quantiles:

  • quantiles::AbstractVector{<:AbstractFloat}: vector of probabilities
  • quantiles::AbstractFloat: a single probability value
  • quantiles::Integer: number of equidistant probability values (e.g. 99 for percentiles).

Available options for method:

  • :cp for conformal prediction
  • :hs for historical simulation
  • :idr for isotonic distributional regression
  • :qr for quantile regression
  • :iqr for isotonic quantile regression
  • :lassoqr for lasso quantile regression
  • :normal for normal distribution of errors
  • :zeronormal for normal distribution of errors with fixed mean equal to 0

Other keyword arguments:

  • window::Integer: the number of past observations used for training the model
  • start::Integer = pf.id[begin + window]: specify the identifier in pf at which quantile forecasts will start (if not provided, the first available will be used)
  • stop::Integer = pf.id[end]: specify the identifier in pf at which quantile forecasts will stop (if not provided, the last available will be used)
  • retrain::Integer = 1: specify how often to retrain the model. If retrain == 0, the model will be trained only once, otherwise it will be retrained every retrain steps

Note

  • the function can also be called with method, window and quantiles as positional arguments
  • :qr supports multiple regressors
  • :idr partially supports multiple regressors: one isotonic regression is fitted to each forecast and the final predictive distribution is an average of individual distributions
  • :cp, :normal and :zeronormal do not support multiple regressors: if pf contains multiple point forecasts, their average will be used for postprocessing
source

Conformalizing probabilistic forecasts

Apart from postprocessing point forecasts, the package offers postprocessing of probabilistic forecasts in a form of conformalization (Romano et al., 2019). Conformalizing quantiles is performed by adjusting the prediction of each quantile according to the formula $\hat{q}^{(c)}_{\tau} = \hat{q}_{\tau} + Q_{\tau}(\lambda)$, where $Q_{\tau}(\lambda)$ is the $(\tau)$-th sample quantile of non-conformity scores $\lambda_i := y_i - \hat{q}_{i,\tau}$ from the training window. See an example on Conformalizing weather forecasts.

PostForecasts.conformalizeFunction
conformalize(qf::QuantForecasts{F, I}; window::Integer[, start, stop)

Perform conformalization of quantile forecasts provided in qf. Conformalized quantiles will be calculated for observations between the start and stop identifiers in qf. The model is retrained every step on the last window observations.

Return QuantForecasts with conformalized quantiles.

source
PostForecasts.conformalize!Function
conformalize!(qf::QuantForecasts{F, I}; window::Integer[, start, stop)

In-place version of conformalize that mutates qf instead of creating a new QuantForecasts.

source