# Automated forecasting of 1000 weekly time series (food product retail)

I have a set of 1000 time series with weekly data.
These time series data are concerning the sales of food product retail.
Can anyone suggest me the best/correct way to make good forecasts of this set of time series with R?
Obviously I can't analyze them one at a time because there are too many of them!

1. Learn R, at least well enough to program for loops to loop over your time series. Plus, learn enough R to read and write your data (e.g., using the read.table() and write.table() commands). There are tons of introductions to R around, pick almost any one.
2. Read Hyndman & Athanasopoulos "Forecasting: principles and practice", which contains many worked examples in R.

This will get you a long way. Retail time series will likely exhibit some yearly seasonality, so concentrate on seasonal methods (e.g., seasonal exponential smoothing, but don't necessarily include trends).

Skip ARIMA models - ARIMA doesn't like "long" seasonal cycles, and 52 weeks qualify as "long", plus, you may need to take seasonal differences, and most retail time series don't cover many years, so each differencing loses a lot of data.

Consider some kind of regression-based forecast to capture the effect of promotions, if there are any in your data.

Potentially:

1. Attend this year's International Symposium on Forecasting in Cairns, in particular one of the pre-conference workshops, like the one on forecasting with R or the one on forecasting to meet demand, which is given by an experienced retail forecaster.

(Disclaimer: the guy giving the second workshop is a colleague of mine. If you come to Cairns, say hello to me and feel free to ask me all about retail forecasting.)

• Which function you suggest? the ets function? How can I add the regressors with that function? I'm just using the auto.arima function of the forecast Hyndman's package with the xreg parameter and it seems to works weel enough...
– Mig
Feb 6, 2017 at 8:11
• ets cannot handle external regressors, only level, trend and seasonality. If auto.arima() with xreg works for you, all the better! I'd recommend you read "The ARIMAX model muddle" by Hyndman if you plan on using ARIMAX or regression with ARIMA errors, because there are subtle differences between the two that may trip you up if you don't know them, especially if you work off multiple sources. Feb 6, 2017 at 10:19

AUTOBOX ( a piece of software that I had helped develop) has an R version that you can try out . It will detect not only the ARIMA structure but the week of the year structure and changes in the week-of-the-year structure along with level shifts and local time trends while incorporating the lead and lag effects of user-specified causals.