google / CausalImpact

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

How coefficients work? #73

Open NicolasFradin opened 7 months ago

NicolasFradin commented 7 months ago

Hi,

I'm trying to understand the coefficient plot and how to interpret them. Following the official documentation of the package I have:

plot(impact$model$bsts.model, "coefficients")

The size of the bars in the plot depict the inclusion probabilities of the model coefficients. The bars are shaded by the conditional probability that a coefficient is positive, given that it is nonzero (white means the coefficient is negative, black means the coefficient is positive, grey means the coefficient has the same probability of being negative or positive). For more information on the plot, see

In an experiment I am using a demand metric and the coefficient plot is giving me a white bar with the value 1.0.

But after trying to plot the posterior distribution for each coefficient I found that colors seem to be inversed:

image

average: 0.9163787 median: 0.9220158 mode: 0.5444738 argmax: 1.365314 max: 1.365314 min: 0.5444738

I should have a black bar for positive value right?

Does anyone knows how to find the inclusion probability value and if I am missing something here?

Thank you!