0
$\begingroup$

In the documentation (https://google.github.io/CausalImpact/CausalImpact.html) for CasualImpact there is an example of setting pre and post periods of the treatment:

pre.period <- as.Date(c("2014-01-01", "2014-03-11"))
post.period <- as.Date(c("2014-03-12", "2014-04-10"))

Can I use a staggered vector (or similar) series of dates instead?

For example, if I want to measure the impact of TV advertising (TV Spend) on web transactions over the course of a year and that TV is live for the full months (for simplicity) of April (1st - 30th), July (1st - 31st), September (1st - 30th)and December (1st - 30th).

Can I make my pre period for analysis something like:

pre.period <- list(
          as.Date(c("2016-04-01", "2016-04-30")),
          as.Date(c("2016-07-01", "2016-07-31")),
          as.Date(c("2016-09-01", "2016-09-30")),
          as.Date(c("2016-12-01", "2016-12-31"))
          )

And then post.period the inverse of this for the year 2016? If yes, how can I pass r causalimpact the pairs of date ranges for each instance of treatment (TV spend)?

$\endgroup$
  • $\begingroup$ The pre period needs to be a contiguous interval. CausalImpact estimates the impact of a single intervention; it sounds like you're trying to estimate the impact of one time series (TV spend) on another (web transactions), which this can't do. $\endgroup$ – Max Ghenis Apr 5 '17 at 4:57
  • $\begingroup$ Hi Max thanks for responding. I don't know what contiguous means. Are you saying that measuring the impact of the treatment across staggered time instances is not feasible? What is I used a single CasualImpact() for each instance of TV with the pre period being the time since the previous TV campaign? $\endgroup$ – Doug Fir Apr 5 '17 at 8:34
  • $\begingroup$ Correct, you can only have one single pre period; it can't be broken up. You could run CausalImpact multiple times, though if the pre-period is affected by the previous treatment you could end up underestimating the impact. $\endgroup$ – Max Ghenis Apr 5 '17 at 18:12
  • $\begingroup$ Thanks for Clarifying, that answers my question. For conversation, is there a feasible model that would do this? In the documentation for CasualImpact they provide a means of using a custom machine learning model via bsts package for predicting "regular" outcome (no treatment) in post period. What do you make of that here? I.E. is it just that default CasualImpact() uses bayesian timeseries that I cannot do this? $\endgroup$ – Doug Fir Apr 6 '17 at 3:35

Your Answer

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

Browse other questions tagged or ask your own question.