# How to handle many time series?

At first, I should apologize if this question is not relevant to this website, but since there are some researchers from the management science community, I ask the question here.

I have data for the demand of 1200 products for 25 periods. That is, 1200 time series. I want to predict the demand for each product for the next period (26). However, because of the high-complexity of tuning the parameters $$(p,d,q)$$ of the ARIMA model, it is not possible to use the ARIMA model.

I have used the time-slicing approach to train ML approaches (random forest, xgboost, catboost, ....) to predict the demand, but it is satisfactory. I would like to know if there is any other approach for demand prediction of 1200 products?

Edit: I have used the following approach. I would be thankful if someone can suggest any idea. At first, I have generated new feature (trend) for each time-slicing time serie as if the demand of a product for a period is increase compared to the previous period (+1 for increase, 0 no difference, -1 decrease) and then clustered time-slicing time series based on the trend data (not the value of demand) and then predict the demand of each product according to the demand of products which fall into the same cluster with KNN. KNN algorithm is trained on the demand values but clustering is trained on trend data. KNN algorithm with a large number of neighbors produces good results but other algorithms such as catboost, xgboost, knn with small k produces poor results.

• Perhaps Stats.SE has more information on time series. – TheSimpliFire Aug 4 '19 at 10:39
• Can't you just train 1200 independent models, one for each product? – Simon Aug 4 '19 at 11:45
• @Simon Since it is needed to tune (p,d,q) parameters, it takes a long time and it is neither acceptable nor applicable. – Katatonia Aug 4 '19 at 12:09
• Here is a list of many sych posts at CrossValidated. – kjetil b halvorsen Aug 4 '19 at 19:12
• @kjetil b halvorsen You seem to be carrying over the practice from Cross Validated of editing posts to remove "Thanks". I think it's stupid to "disallow" "Thanks" and even stupider for someone to edit someone else's post just to remove it. Nevertheless, that seems to be the rule at Cross Validated, so I accepted it there. it doesn't seem to be the rule on this forum, and 'd rather not see it become the rule or practice here. I'm generally against editing other people's posts unless there's a good reason, and I don't think removing "Thanks" is a good reason. Peace out. – Mark L. Stone Aug 5 '19 at 1:26

## 3 Answers

If the 1200 products are closely related, so that trend (if any) and noise are likely to be correlated across products, a single model might make sense. If they are loosely related (so that they might share a common trend but separate noise processes), you might consider fitting a single trend model (linear regression on time?), "detrending" the data, then fitting separate ARMA models ... or perhaps just separate exponential smoothing models? If the products are unrelated, either separate ARIMA models or separate exponential smoothing models would be warranted, and a composite model would not be.

• I am working on a similar problem, but i have only 6 queues for which i want to forecast the incoming volumes.I ran correlation on the series and see that they are highly positively correlated [ 0.99] both at the actual level and pct. change level.But when I look into the granular level I see that the peaks are on different days of the week.does this seem right ? given that the correlation is high,shouldn't the peaks and troughs be on similar days? Also would a composite model work for this? – Lalitha Sundar Iyer S Aug 29 '19 at 8:48
• If there is significant trend (in the same direction) in each series, it could give them a high correlation regardless of when peaks occur. – prubin Aug 30 '19 at 15:32

This problem is a multivariate (simply when you have more than one time-dependent variables) time series for which you can use Vector Auto Regression (VAR) technique among some others. Explanation and Python implementation of this technique has been discussed in details in here. This technique is also considered the dependencies between various time-dependent variables in the $$AR(n)$$ calculations.

I am not pretty sure that the implementation code will take less than your own approaches for the forecasting of variables but at least it gives you some hints to accelerate other approaches. (of course, it also required some familiarities with univariate time-series and Python programming language).

The demand of 1200 product will often be related. There might be common events (Christmas, some large accident, ...) that influence all or many of the demands, substitution effects, ... or there may be relations imposed by the cost function (inventory control ...)

These can be tackled by some common model, and this is often hierarchical forecasting. There are some posts on Cross Validated, and rather than rewrite here, this is a list.