1
$\begingroup$

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:-

# creating a time series matrix containing 5 series and 133 weeks random data 
min_rep_eg = matrix(data = rnorm(n = 133*5 ,mean = 2), nrow = 133, ncol = 5) %>% 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","10041034","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))
$\endgroup$

closed as off-topic by Tim Feb 12 at 7:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Tim
If this question can be reworded to fit the rules in the help center, please edit the question.