Description Usage Arguments Details References See Also Examples
View source: R/thief_reconcile.R
This function fits ensemble univariate forecast models on all levels of temporal aggregation for a series and reconciles the supplied univariate forecast object
1 2 3 4 5 6 7 8 9 10 |
y |
Either a |
original_forecast |
Either a |
forecast_residuals |
Optional |
lambda |
|
frequency |
|
return_aggregates |
|
prior_aggregates |
Optional result of a previous call to |
max_agg |
(optional) |
Series in y
are aggregated at all possible levels up to annual using tsaggregates
.
ensemble_base
is used on all levels of aggregation to find a weighted ensemble of nine
univariate forecast models that minimises mean absolute scaled error. Forecasts are then reconciled
using reconcilethief
and are optionally constrained using non-negative optimisation if there are no
negative values in y
. Adjustments to the original supplied forecast are incorporated and
this adjusted forecast is returned
Athanasopoulos, G., Hyndman, R., Kourentzes, N., and Petropoulos, F. Forecasting with temporal hierarchies. (2017) European Journal of Operational Research 262(1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(mvforecast)
data("ixodes_vets_dat")
#Fit a univariate model to one of the series in the ixodes data
y <- ixodes_vets_dat$y_train[,1]
xts.to.ts <- function(x, freq = 52) {
start_time <- floor((lubridate::yday(start(x)) / 365) * freq)
ts(as.numeric(x), start = c(lubridate::year(start(x)), start_time), freq = freq)}
original_forecast <- forecast(auto.arima(xts.to.ts(y, freq = 52)), h = 52)
reconciled <- thief_reconcile(y = y, original_forecast = original_forecast, frequency = 52)
#Plot the original and reconciled forecasts
reconciled <- thief_reconcile(y = y, original_forecast = original_forecast, frequency = 52)
autoplot(original_forecast)
autoplot(reconciled)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.