I'm trying out top-down method for forecasting demand of products in a retail store.
fourier_forecasts = forecast(sales_weekly_hts, h=12,method="tdfp", FUN=function(x) auto.arima(x, xreg=fourier(x, K=12), seasonal=FALSE))
sales_weekly_hts is an hts object containing 2.5 years of weekly sales data.
It gives me the error :-
"Error in forecast.Arima(models, h = h) : No regressors provided"
I'm guessing that error is because its not able to obtain the fourier terms for out of sample forecast but I don't get how to resolve this. Is it not able to know how many periods to forecast into the future?
Minimum reproducible example:-
library(dplyr)
library(hts)
# creating a time series matrix containing 4 series and 133 weeks random data
min_rep_eg = matrix(data = rnorm(n = 133*4 ,mean = 2), nrow = 133, ncol = 4) %>% ts(frequency = 365.25/7)
# giving names to the 5 time series. These names are used to create the hierarchy.
colnames(min_rep_eg) = c("10011001","10011003","10031021","10031031")
# creating the hts.
min_rep_eg_hts = hts(min_rep_eg, characters = c(4, 4))
min_rep_eg_hts_fc = forecast(min_rep_eg_hts, h=2,method="tdfp", FUN=function(x) auto.arima(x, xreg=fourier(x, K=12), seasonal=FALSE))