I'm using the CausalImpact package to evaluate the effect of a programme. My covariates are seasonal and I wonder whether I need to deseasonalise/ detrend the regressors before using the R package?

Hal Varian did this in the below analysis:


slide 24:

  • Deseasonalize predictors using R command stl
  • Detrend predictors using simple linear regression
  • Let bsts choose predictors
  • $\begingroup$ No, you can use seasonality within causalimpact itself. The documentation clearly provides on how this could be done. $\endgroup$ – forecaster Jun 28 '15 at 19:30
  • $\begingroup$ Yes, and with a customised bsts model? When I evaluate the fit of the bsts model before I pass it into Causalimpact, would i need to pre-process the data to fit the bsts model? $\endgroup$ – TinaW Jun 30 '15 at 22:30

Using raw predictors in CausalImpact (or bsts) has the advantage that your counterfactual predictions automatically inherit the seasonality structure contained in your predictors (e.g., day-of-week as well as seasonal effects throughout the year and their interactions).

Deseasonalizing your predictors, on the other hand, can be a useful strategy in cases where seasonal variation dominates all other features in your predictors, making it potentially harder for the regression component to find the right combination of predictors. In this case you'll want to include an explicit seasonal component in the model (using model.args in CausalImpact() or AddSeasonal() in bsts()). See the documentation for details.

Unless you have too many predictors you could also consider using both raw and deseasonalized regressors and let the model decide.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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