Evaluate models using expanding-window time-series cross-validation.
Usage
get_cv(
x,
eval_start_date = NULL,
h = 4,
models = default_models(),
step = h,
n_origins = NULL,
origins = NULL
)Arguments
- x
An
insightcast_dataorinsightcast_ncastobject.- eval_start_date
Date (or character string coercible to a date) giving the first forecast origin to evaluate. Must fall within the data window. All earlier observations are used as the initial training period. This argument is exclusive with
n_originsandorigins.- h
Forecast horizon in reporting intervals. Defaults to
4.- models
Named list of
fableor joint insight.cast model specifications, such asHHH4. Defaults todefault_models.- step
Reporting intervals between forecast origins. Defaults to
h.- n_origins
Integer giving the number of forecast origins to evaluate, as an alternative to
eval_start_date. Origins are placed so that the last forecast ends at the last observation:eval_start_date = t - ((h - 1) + (n_origins - 1) * step) * interval, wheretis the last observation date. This argument is exclusive witheval_start_dateandorigins.- origins
Explicit forecast origin dates. Use non-contiguous dates to evaluate corresponding weeks in previous seasons. This argument is exclusive with
eval_start_dateandn_origins;stepis ignored.
Value
An insightcast_cv object containing:
- forecasts
Forecasts for each model, series, and cross-validation origin.
- oracle
Observed values used for scoring.
- score
Model performance metrics, including WIS and interval coverage, for each model and series.
- models
The evaluated model specifications.
- meta
Cross-validation settings including dates, horizon, step, number of origins, series keys, target, and reporting interval.
- data
Input data with revisions collapsed, used by
get_fcast.
Details
Forecast performance is measured using weighted interval score (WIS) and
interval coverage. Models are ranked separately for each series, and the
resulting rankings are used by get_fcast.
