1
$\begingroup$

I have two sets of data. Set 1 is a count of sales & date Set 2 is a count of event x occurring & date.

What is the best method to find out how a change in an element of Set 1 (date t, sales s) effects a series of elements in Set 2?

Q: After an increase in sales, when can i expect an increase in the count of event x ?

What's the best model or method /analysis to answer this ? Thank you !

$\endgroup$
1
  • $\begingroup$ You could start looking at the cross-correlation function $\endgroup$ Commented May 24, 2021 at 16:59

1 Answer 1

1
$\begingroup$

You have two options (probably a few more, but these 2 are these, I have in my mind):

1.) If sale und spendings happen continously, meaning that sales not suddenly drop to 100 and then again down to 0 for a certain period and again to 50 or so, than a simple VAR would be enough, assuming that the spendings granger cause the sales, although there might be other variables inbetween like brand consideration or brand awareness. With a VAR you can capture season, trend levels. If a VAR in levels is not possible (which would be the case with sales and spendings) use VECM or VAR in differences. When using VAR in differences, an impulse response function is not useful, but you need it to answer the when, more preciseley.

For VAR/VECM:

https://otexts.com/fpp2/VAR.html

https://towardsdatascience.com/vector-autoregressions-vector-error-correction-multivariate-model-a69daf6ab618

https://www.r-econometrics.com/timeseriesintro/

Buteikis offer a very good start for beginners: http://web.vu.lt/mif/a.buteikis/wp-content/uploads/2018/04/Lecture_07.pdf

The when, you asked for, would be then answered with an impulse response function: https://www.r-econometrics.com/timeseries/irf/ It shows you if a certain shock (spendings) influence significantly the sales, and when it does so (amount of lag when it kicks in) and when the effect wears out, or in other words, when the time series of sales goes back to ins equilibrium (thus sales baseline without doing any advertisement)

However, this methods can not predict very well. Since you are only caring about the when effect in general, this might be sufficient.

2.) In case it is not. Fit a linear model with trend and saisonality parameters to a linear model. Then use this outcome and substract it from your sales. Use this model then to fit a tree/Boosting model to catch the remaining residuals.

The when question will be answered by feature engineer spending features with different lags (e.g. a feature that includes 3 weeks of spendings etc.) and let these loose on the residuals.

The idea is that the trend and the season will be learned by the linear model and you can extrapolate/predict, the tree lerans the residuals and can be better used to answer your when question.

(although trees may learn seasonality by themselbes, there are approaches that can be better than just learn season by the trees). however, the lag and when functionanility is alittle bit limited as it would need to integrate complex carryover effects of your spendings.

to summarize:

  • for time series approaches without caring about the prediction, just about the lag/when: use VAR/VECM with impulse response functions
  • with the regression approach you can catch the predict better, the remaining residuals may be explained by a tree/boosting model, which needs specific lagged spending variables, probably with carryover effects.

However, these are very complex approaches but are capapble of explaining the when very good. Especially the impulse response function. It may be sufficient to just compute a simple VAR model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.