Closed sleitner closed 5 years ago
Hi @sleitner, thanks for reporting! The confidence is much wider in the python version, I'll try to see if it's a problem of definition (e.g. 99% confidence vs 90%) or a consequence of the estimators themselves. Thanks for sharing the dataset too!
Hi @tcassou, I'm not 100% sure but I think the problem is that you're taking the cumsum of confidence intervals when you should be taking confidence intervals of cumsums.
Thanks @btengels ! I need to give a closer look at the R package first, I find it intriguing that the confidence interval has a fixed width in R, despite the time series component (for which the confidence should naturally decrease with the horizon of the prediction). Maybe the confidence interval in R is only based on the regression component then? Do you know this already?
As for this package, I'm simply using the conf_int()
method from the UnobservedComponent
object, which I will inspect as well.
BTW I can see on the plot that the confidence interval is missing right before the intervention date, this is not expected, I give it a look too.
Hi @sleitner, As @btengels pointed out, I had a silly mistake in the expression of the confidence interval for the cumulative sum of impact, which is fixed by 1eccfb9377a2baefb0f53df02c054f59d6e49c09. I'll release it shortly, thanks again for reporting!
New plots for the same dataset:
Just released 1.0.4, I'll close this issue for now, please feel free to reopen if you spot anything wrong!
Thanks for the update @tcassou ! The cumulative impact certainly looks more consistent, but there's something else going on: the uncertainty on the pointwise plot (middle panel) still looks substantially different, and the cumulative plot uncertainty band at the last point looks like 300-800 instead of 500-1,000.
About the cumulative plot I would need to dig a bit more into the R implementation - I know it's a different solver (MCMC) so to some extent I expect slight differences. If you actually look at the pointwise difference graph, you can see that the signal keeps being higher than the model after intervention in R, while it goes back to a similar level in python. So that the cumulative impact grows higher too, while the interval width is the same. So I'd say this comes either from the model, solver or parameters and not the confidence interval (which is supposed to be symmetrical here given the normally distributed noise).
As I pointed out earlier, I find it surprising that for the pointwise difference as well as the prediction plot, the confidence interval has a fixed width in the R implementation, while there's is a set of time series components in the model (trend and season for example) for which uncertainty should grow bigger as you get further from intervention date.
If you know more about any of this please feel free to share! I'll try to explore more on my end too, thanks again for sharing!
Hi Thomas, Thanks for working on this! I just wanted to flag that your package doesn't produce results comparable to the R CausalImpact package yet for the same reason that @bange83 identified in https://github.com/jamalsenouci/causalimpact/issues/7
To reproduce:
Compare to the R CausalImpact result (see referenced issue for code):![image](https://user-images.githubusercontent.com/2593347/41181689-b2015f52-6b40-11e8-92d6-cd1dbf651d9f.png)