google / CausalImpact

An R package for causal inference in time series
Apache License 2.0
1.71k stars 254 forks source link

Plot function didn't show error bar for Pre-intervention after using customized BSTS model #34

Closed MengyingLi closed 3 years ago

MengyingLi commented 5 years ago

Hi I used a customized BSTS model for CausalImpact by using zoo object for response variable. however the plot function didn't show the pre-intervention error bar shown as below. Any ideas about how to fix it? Thanks!

image

stumakha commented 4 years ago

Same issue here. Did not even use customized model. Just moved the code to a new computer. Same code does not produce prediction interval bars.

alhauser commented 4 years ago

@MengyingLi : zooming into the screenshot, it seems credible bands are present in the pre-period, but super narrow. So it could be an artifact of the custom BSTS model that it overfits data in the pre-period, but adds a strong random walk component which makes the credible bands very wide in the post-period. I'd play around with the model to find one that better fits the actual signal.

@stumakha : did moving the code just remove the credible band in the pre-period, or everywhere? If the latter, is this the same as https://github.com/google/CausalImpact/issues/36 which is fixed in the latest version on Github?

stumakha commented 4 years ago

@MengyingLi I had a problem solved in #36 . slategray2 vs SlateGray2 Thank you.