Skip to main content

Module backtest

Module backtest 

Source
Expand description

Rolling-origin evaluation, model selection and empirical intervals.

  1. Rolling origin — for each of the last origins periods, every candidate is fitted ONLY on the data before the origin and forecasts 1 to horizon periods ahead; errors are measured against what happened. Horizon h has origins − h + 1 pairs.
  2. Selection — the candidate with the lowest error averaged over the horizons, the simple average of the best few models included.
  3. Empirical intervals — no normality assumed: for each horizon, the quantiles of the relative error r = actual/forecast − 1 seen in the backtest; the interval is forecast × (1 + q). With few pairs the wider levels are close to the worst error observed.
  4. Cumulative intervals — the same for the ratio of sums over the first k periods of each origin, because adding up the limits of k intervals overstates the uncertainty of a total.

Structs§

Backtest
Configuration of the evaluation. The defaults suit monthly data: 36 origins, 12 periods ahead, at least 48 observations to train.
Band
Quantiles of a relative error r (actual/forecast − 1) for one coverage level: the interval is forecast × (1 + lower) to forecast × (1 + upper).
Candidate
A model taking part in a backtest, under a name of the caller’s choice.
CandidateReport
Backtest and forecast of one candidate (a model or an average of models).
HorizonStats
What the backtest measured at one horizon.
Interval
An interval around a forecast.
Point
A forecast with its intervals.
Report
Result of a backtest.

Enums§

Metric
Error measure averaged over the horizons to rank the candidates.

Functions§

max_threads
The most threads a backtest or an ensemble will use: what was set with set_max_threads, or the number of cores.
set_max_threads
Limits the threads used by backtests and ensembles, in the whole process. Zero, the default, stands for every core the system reports.