detect_bias_drift: Check whether forecast bias is growing across the test window

View source: R/bias_drift.R

detect_bias_driftR Documentation

Check whether forecast bias is growing across the test window

Description

Splits the test window into n_splits sequential, roughly-equal chunks (oldest first) and computes compute_forecast_bias() in each – a simple, explainable drift signal (is ⁠|bias|⁠ growing chunk over chunk), not a full statistical trend test.

Usage

detect_bias_drift(fc_tib, test_df, n_splits = 2)

Arguments

fc_tib

A tibble with ds/yhat columns – a model's forecast.

test_df

A tibble with ds/y columns – the held-out actuals.

n_splits

Integer, how many sequential chunks to split the window into. Default 2. Capped so every chunk gets at least one row rather than erroring on a short window.

Value

A list with chunks (a tibble of chunk/bias/pct_bias/n, one row per chunk) and drifting (TRUE if ⁠|bias|⁠ strictly increases chunk over chunk, FALSE if not, NA if there isn't enough data for a read).

Examples

ds <- as.Date("2024-01-01") + 0:9
fc_tib <- tibble::tibble(ds = ds, yhat = c(rep(10, 5), rep(6, 5)))
test_df <- tibble::tibble(ds = ds, y = rep(10, 10))
detect_bias_drift(fc_tib, test_df, n_splits = 2)

forecastsuite documentation built on Oct. 18, 2026, 5:08 p.m.