View source: R/scale-by-mase.R
scale_by_mase | R Documentation |
scale_by_mase()
scales a group time series by using a factor derived from the MASE error function.
scale_by_mase(.tbl, .value, ...)
.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 |
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.
The original tibble with the .value
column back-transformed to the orginal scale.
Pablo Montero-Manso, Rob J. Hyndman, Principles and algorithms for forecasting groups of time series: Locality and globality, International Journal of Forecasting, 2021 link
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.