I work for a company that has an e-commerce website. Regularly we make specific campaigns in order to sell more. For example: We can make a campaign for fathers day, black Friday, crazy August, and so on.


It is hard to understand the impact of the campaign on sales. Because the impact of the campaign can not be isolated from a recent trend or a seasonality of the market.

Solution I thought so far

If I decompose the time-series using, for example STL, could I take the residuals and correlate them with predictors?


  • Correlate with expenses on media on the e-commerce (as long as I have the historical data)

  • Correlate with the period that a campaign was active (If positive peaks in the residuals agree with the investment in ads, while negative peaks happened when there was no investment, may I say that there is a correlation)?


  • I know that I can't interpret the result of this relationship as causation, but the main point is: Can I take the residuals and proceed with a regular regression analysis?

  • Is there a better approach to measure the impact of a campaign in this case?

  • I read that the US government removes the seasonality of the time-series to evaluate whether the unemployment rate increases/decreases over time. This was my inspiration for the question.

  • Thyme-boost use this approach for prediction;


1 Answer 1


You're right that this analysis will not be causal, but it could still be interesting for you to perform. Beware of unintended reasons residual peaks may correspond with patterns in your covariates though.

One way to attempt to overcome issues with your planned analysis would be to construct treatment and control groups. Research Difference-in-Differences to learn more about this.

There are other ideas, too, that might be worth your time and build upon the ideas above. Here is one from Google that goes into great detail on how they dealt with this very problem via bayesian structural time series models (it also provides both python and r code to boot).


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.