scale_by_mase: Scale a group time series by using a factor derived from the...

View source: R/scale-by-mase.R

scale_by_maseR Documentation

Scale a group time series by using a factor derived from the MASE error function

Description

scale_by_mase() scales a group time series by using a factor derived from the MASE error function.

Usage

scale_by_mase(.tbl, .value, ...)

Arguments

.tbl

tibble; data with a value (class: numeric) column and group (class: character) column(s)

.value

numeric; unquoted name of the column that contains the numeric values

...

character; one or more unquoted grouping columns

Details

Scaling a grouped time series can be helpful for global forecasting methods when using machine learning and deep learning algorithms. Scaling by MASE and using MASE as the error function is equivalent to to minimizing the MAE in the preprocessed time series.

For each series, a MASE scale factor is calculated using the denominator of the MASE scaled error equation. Then, the series is divided by this factor.

Value

The original tibble with the .value column back-transformed to the orginal scale.

References

Pablo Montero-Manso, Rob J. Hyndman, Principles and algorithms for forecasting groups of time series: Locality and globality, International Journal of Forecasting, 2021 link

Examples


library(dplyr, warn.conflicts = FALSE)

group_ts_tbl <- tsbox::ts_tbl(fpp2::arrivals)

head(group_ts_tbl)

new_tbl <- scale_by_mase(.tbl = group_ts_tbl, .value = value, id)

head(new_tbl)

attributes(new_tbl)$scale_factors

ercbk/ebtools documentation built on Feb. 22, 2025, 1:51 p.m.