# The Causal Impact Package in R could not trace the right number in the test group

I have this sample dataset which is as follow:

head(data)

2016-03-19 0.01109 0.01418
2016-03-20 0.00882 0.01445
2016-03-21 0.00953 0.00977
2016-03-22 0.01022 0.00998
2016-03-23 0.01141 0.01145
2016-03-24 0.00973 0.00966
....

As I plot the whole dataset in Excel, the trend is as following:

However, in R, when I used Causal Impact, I would get a different view for the plot data, as you can see the first panel of this plot.

Can anyone please help me with it? Why is there the difference between these two charts? The test starts from 5/19.2016. I think the impact between control group and test group should be neutral. However, in causal impact package, it's significantly positive.

the dataset is in the google link. docs.google.com/spreadsheets/d/1xcdK04ut9EOyiRjkUhsQ3l95T1V_zrH02Qk3JBDQWvM/edit?usp=sharing

• There is no way for us to answer this question unless you provide us the background data. – forecaster Jul 24 '16 at 14:18
• Hi forecaster, here is the link for the dataset. docs.google.com/spreadsheets/d/… – Rania Z Jul 24 '16 at 14:30
• What is your question? "Please help me with it" is not specific enough to be answerable on this site. – whuber Jul 24 '16 at 14:37
• Hi whuber, I just edited my question. This is my first time asking question here. Thank you for the advice! – Rania Z Jul 24 '16 at 14:43

## 1 Answer

The two plots don't agree because they are showing different things:

• The first chart shows the observed data in the test group (red) and the observed data in the control group (blue).
• The top panel in the CausalImpact plot, by contrast, shows the observed data in the test group (black, matching the red line in the first chart) and an estimated counterfactual of the test group. The counterfactual is an estimate of what would have happened in the test group had the test group not been treated. In this particular case, since there seems to be only a single predictor variable (i.e., the control group), the expectation of the counterfactual is simply $\beta_1 \times \textrm{control group} + \beta_0$ for two model parameters $\beta_0, \beta_1$.
• Hi Kay, so in this case, causal impact is not a really good modeling method to model the impact, right? I feel like the impact should be neutral but not like significantly increased. – Rania Z Jul 26 '16 at 6:44