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 — Function
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 probabilitiesquantiles::AbstractFloat: a single probability valuequantiles::Integer: number of equidistant probability values (e.g. 99 for percentiles).
Available options for method:
:cpfor conformal prediction:hsfor historical simulation:idrfor isotonic distributional regression:qrfor quantile regression:iqrfor isotonic quantile regression:lassoqrfor lasso quantile regression:normalfor normal distribution of errors:zeronormalfor 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 theidentifier inpfat which quantile forecasts will start (if not provided, the first available will be used)stop::Integer = pf.id[end]: specify theidentifier inpfat 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 everyretrainsteps
Note
- the function can also be called with
method,windowandquantilesas positional arguments :qrsupports multiple regressors:idrpartially supports multiple regressors: one isotonic regression is fitted to each forecast and the final predictive distribution is an average of individual distributions:cp,:normaland:zeronormaldo not support multiple regressors: ifpfcontains 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 — Function
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.
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.