# How to deal with building a linear model where I have sales data for 5 different chains and 117 weeks?

I have a sales data for brand1 (it has to be my dependent variable) and for brand2, brand3 and brand4. All of them are presented for 5 different chains. Data for every of chain is presented for each week from 1 to 117. It looks like presented below:

I have 585 rows. How can I build my model to explain brand1 sale? How can I deal with chain and weeks data? I thought about presenting chain data as dummy variables, but what in this case I should do with weeks?

With 117 weeks of sales data, your variables will most likely be non-stationary and have some kind of trend or seasonality. A simple linear regression model won't give you reliable results in such a case. You will have to apply a time series model, such as ARIMA or SARIMA. I would proceed as follows:

1. Check for stationarity: it's sales data, there is a good chance you will find some "trend" as the brand grows and sales increase over time. Moreover, the sales may vary up and down in a cyclical pattern because you might have some periods of high sales followed by low sales. This is called "seasonality", and it will depend on the nature of the products you are selling. Your data will likely be non-stationary due to these factors.

2. Look at ACF and PACF plots: these plots will show whether you will need any Autoregressive (AR) or Moving Average (MA) terms in your model. It will also give you a good idea about the number of these terms you will need. You can also detect the length of the seasonal pattern/cycle and seasonal-AR/MA terms using ACF and PACF, if there is any seasonality present.

3. Nature of seasonality: if there is seasonality, you'll have to check whether it is additive or multiplicative. For additive seasonality, the ARIMAX model should be enough by including seasonal-AR/MA term or seasonal differencing. For multiplicative seasonality, you will have to apply the SARIMAX model.

4. Apply ARIMAX/SARIMAX: the model will have brand1 sales as your dependent variable and all the other brands' sales as independent variables. Along with these, your model will have AR, MA, seasonal-AR and seasonal-MA terms as required. Such a model is called an ARIMAX model. If you have multiplicative seasonality in your data, then apply a SARIMAX model. This model will still have AR/MA and seasonal AR/MA terms, but their interaction is multiplicative.

This procedure should most likely do the trick for you and give you some good results.

This can be seen as a time series problem or a general regression problem.

If former, you can go for a SARIMAX model for each chain. The seasonal/cyclical/persistence variation across time can be exploited for better predictability.

Alternatively, you can convert use past brand1 weekly sale as regressors: y(t), other regressors, chain dummy, y(t-1), y(t-2)...

The same can be done with other brand sales too (to get more regressors). And then use a Gradient Boosting model like CatBoost for prediction.

• Gradient boosting is an optimization technique, not a model. What model is behind CatBoost, if any? Jan 23, 2022 at 19:56