# Regression Time based model [closed]

Say that I am trying to predict sales for the next year and I have a dataset that looks like this.

 Date || Sales || # of Salesmen|| Shoppers
Jan 2016|| 2032|| 55 || 10,000


Imagine this data goes back for 5 years. I am trying to create a forecast for the next year that incorporates the month, seasonality, number of salesmen, and shoppers with the end result of forecasting sales. Which model would best be appropriate and what methods would you suggest? Assume I would know the number of salesmen and shoppers per month for the next year since these are set values.

• Forecast using ARIMA model possibly . I would suggest using R – Quality Jan 19 '18 at 1:31
• Consider an ARIMAX model, or a regression on your causal factors with ARIMA errors. This textbook and this blog post may be helpful. – Stephan Kolassa Jan 21 '18 at 16:15

It is not really possible to say which type of model will fit the data best prior to doing some actual model-fitting and model-comparison. However, I can give you some advice on where I'd start. Obviously this is a regression-type problem, so I would start by thinking about the class of generalised linear models, and thinking about what kind of model might best fit this type of data.

You have $5$ years worth of monthly data, so you are going to have $n = 5 \times 12 = 60$ data points to work with. That is a small data set, so you will be restricted to fairly simple models with not too many unknown parameters.

Your response variable is Sales, which is a count value (i.e., a non-negative integer). Moreover, you would probably expect a priori that this variable would be roughly proportional to the Shoppers variable, so you probably want to treat the latter in a way that has a default multiplicative effect on the expected value of Sales, while still allowing some variation from this in the model. Based on those considerations, personally, I would start by fitting a negative binomial GLM with the following basic form:

$$\text{Sales }_{i} \sim \text{NegBin} (\text{Mean} = \exp (\lambda_i), \text{Dispersion} = \phi_i)$$

$$\lambda_i = \theta_0 + (1 + \theta_1) \cdot \ln(\text{Shoppers }_i) + \theta_2 \cdot \text{Salesmen }_i + \sum_{k=2}^{12} \theta_{3,k} \cdot \mathbb{I}(\text{Month }_i=k).$$

This kind of model respects the fact that your response is a count value, and it uses the Shoppers variable as a default multiplicative effect. (Note that Month would be treated as a categorical variable, so it manifests in the model as 11 indicator variables. That is sufficient to take care of seasonality at the monthly level.) This model has $m = 13$ explanatory variables plus an intercept term, so you would have $n-m-1 = 46$ degrees-of-freedom (i.e., you are losing about a quarter of your data to the model).

I hasten to add that this model is not carved in stone tablets - it might not fit well, and maybe some other model will be better. However, it would be a reasonable place to start, and it is sufficiently basic that you do not lose too many degrees-of-freedom. Count data is often well-modelled by a negative binomial GLM, and that model has some basic theoretical properties that suit this sort of data. Hope this is helpful.

• say for example I have the data at the daily grain as well, would your approach change? – Prashant Jan 21 '18 at 9:43
• If you have data at the daily level, there are two main changes: (1) You then have approximately 30 times as many data points, so now you can fit more complicated models with more parameters, and still have plenty of degrees-of-freedom left over; (2) you will want to amend your seasonality term (e.g., you might have an indicator for the day of the week, an indicator for public holidays/weekends, and one or more sinusoidal seasonality terms to allow a general periodic function). – Ben - Reinstate Monica Jan 21 '18 at 23:19