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.point2quant
— Functionpoint2quant(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 probabilitiesquantiles::AbstractFloat
: a single probability valuequantiles::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 modelstart::Integer = pf.id[begin + window]
: specify theid
entifier inpf
at which quantile forecasts will start (if not provided, the first available will be used)stop::Integer = pf.id[end]
: specify theid
entifier inpf
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. Ifretrain == 0
, the model will be trained only once, otherwise it will be retrained everyretrain
steps
Note
- the function can also be called with
method
,window
andquantiles
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: ifpf
contains multiple point forecasts, their average will be used for postprocessing
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.conformalize
— Functionconformalize(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
id
entifiers in qf
. The model is retrained every step on the last window
observations.
Return QuantForecasts
with conformalized quantiles.
PostForecasts.conformalize!
— Functionconformalize!(qf::QuantForecasts{F, I}; window::Integer[, start, stop)
In-place version of conformalize that mutates qf
instead of creating a new QuantForecasts
.