# Predicting sales Volume given a makeup index

I am trying to predict different products' sales volume where the data includes several products sales volume day for a month as well as a madeup index (a number that determines that products likelihood of selling fast). The data looks like this:

Product  April 1 Sales  April 1 Index ........ May 1 Sales   May 1 Index
1         12343           0           ........ 45466           4
2         10435           10          ........ 85849           2
3         23456           4           ........32455            20
4         34567           12          ......... 34556          19
5         90877            3         ........... 54556         34
6         ?               23         ........... ?              15


The reason why I am confused is that it is multivariate and time dependent. I am supposed to use this data and then predict the sales volume for product 6 for each day of the month. Any guidance on how to get started on this would be greatly appreciated. Any tutorials that is similar to this problem? Will I have to use LSTM for this? This clearly not a linear dataset Thank you

• Is the goal is to predict only product #6, based on data from all products? Also, how much data do you have available? – etov Mar 15 '18 at 7:10
• Yes need to predict 6 based on data. Obviously, this is just a sample dataset. The datset has 1500 rows – afzaaldeveloper1 Mar 15 '18 at 18:01

First of all, dataset is too small to forecast future value. If you have more information about the sales volume(Such that trend can be seen), then you can use ARIMA model.

ARIMA model is used for doing time-series foresting, you need to tune the model with historical dataset and after tuning ARIMA forecasts future values. For this you need to find suitable parameter of ARIMA model(p,d and q).

If you have some significant data, then you need to plot graphs from your data. You'll need to plot ACF (Auto Correlation Function) and PACF (Partial ACF), which shows the correlation between observations of a time series separated by k time units (lags). Means after how much time the pattern is repeated. So, based on ACF and PACF plots, you can decide parameters(p,d and q) of ARIMA model (From PACF plot decide q and from ACF plot decide q).

There are good tutorials available for this. Python and R has library for the ARIMA model.

• I wanted to use either LSTM or ARIMA model to do this. What I am struggling with is that there are 15000 products(rows) and 30 days of information(column). Typically, the time value is the row and you have the variables in the column. This dataset is reversed. Am I overcomplicating my thinking or is there a simpler way of dealing with that issue? – afzaaldeveloper1 Mar 18 '18 at 21:54
• So, what I've understood from this is that you have 1500 rows describing products, and 30 columns for a month having sales and Index information for each day for each product. And now you want to predict 1501st product Sale details for each day of the month.Am I right ? – Sanjay Chandlekar Mar 19 '18 at 4:15
• One possible way to model this problem is to prepare separate ARIMA (More specifically ARIMAX model to incorporate exogenous variables as suggested by @etov) model for each day of a month i.e. fit 30 model. For fitting a model for any one day, use the Product Sales information and Index information. Then use the model to predict next Sale value (Model finds a trend between the product sales and will return a value for the next product). Repeat this process for each of the day in the month. Hope this may solve your problem. – Sanjay Chandlekar Mar 19 '18 at 4:39
• Chanlekar, you are correct about the data organization. However, I am not sure if I understood your suggestion. You are saying ignore all the other data and train a model for day 1 for 1500 products and predict the values for day 2 when the index is inputted. Then take day 2 values for 1500 products and predict day 3 values, given index and so forth? – afzaaldeveloper1 Mar 19 '18 at 18:30
• Not exactly. I'm saying for predicting sales value of product for any particular day, focus on that day data only and ignore other days' data. So, for day 1 focus on day 1 data (Sales and Index) only and train a model for day 1 for 1500 products and predict the sales value of 1501st product for the day 1 using index as exogenous variable. Then take day 2 values for 1500 products and predict sales value for 1501st product for that day, and same for other days. – Sanjay Chandlekar Mar 20 '18 at 4:11

One way to formulate your question is as a time-series prediction problem, given a set of exogenous variables.

More specifically: we'd like to predict product #6 sales volume, given both its history, and a set of exogenous time-series: sales volume of other products, and product "indexes" (whatever they mean). This formulation does not aim to directly correlate indexes to sales volume, but instead uses tham independently (at least potentially) for prediction.

There are multiple models you can consider for this formulation, usually those containing "X" in their name; Specifically in Python, there's StatsModels ARMAX, VARMAX (tutorial notebook) and SARIMAX (tutorial notebook). Of course, you'll need to carefully consider the underlying statistical models of each to decide what's the best match for your case.