Utilities

A place to store useful functions that didn't fit elsewhere

PostForecasts.getmodelFunction
getmodel([::Type{<:AbstractFloat}=Float64,] ::Val, params...)

Helper function that dispatches the model based on the model name passed as Val.

Available methods

  • getmodel([type,] Val(:qra), n, m, prob) for Quantile Regression Averaging
  • getmodel([type,] Val(:cp), n) for Conformal Prediction
  • getmodel([type,] Val(:hs), n) for Conformal Prediction Prediction with non-symmetric errors (a.k.a. Historical Simulation)
  • getmodel([type,] Val(:idr), n, m) for Isotonic Distributional Regression
  • getmodel([type,] Val(:normal)) for Normal distribution of errors
  • getmodel([type,] Val(:zeronormal)) for Normal distribution of errors with fixed mean equal to 0

where n is the length of the training window, m is the number of regressors and prob is the probability (scalar value or vector).

Return an appropriate PostModel.

source
PostForecasts.matchwindowFunction
matchwindow(m::PostModel, window::Integer)

Return true if window matches the specification of model m, otherwise return false.

source
PostForecasts.checkmatchFunction
checkmatch(fs::AbstractVector{T}; checkpred::Bool=false) where T<:Union{PointForecasts, QuantForecasts}

Check if Forecasts in fs correspond to the same timeseries, i.e.:

  • all their identifiers match
  • all their observations match.

Additionally, provided that checkpred=true, check if:

  • their number of forecasts match
  • their probabilities match.

The function checkmatch can also be called by passing PointForecasts or QuantForecasts objects as consecutive arguments, e.g. checkmatch(f1, f2, f3) is equivalent to checkmatch([f1, f2, f3]).

Return true or throw an ArgumentError if any of the requirements above is not met.

source