# Questions about the paper “Inferring causal impact using Bayesian structural time series models”

I am simulating this model in the paper Brodersen et al. (2015) and found I have difficulties on figuring out how to choose the starting point of Bayesian inference.

To be explicit, to my understanding, if I choose Durbin and Koopman (2002)'s simulation smoother (I think this is what the paper used) to simulate the latent state $\boldsymbol \alpha$ from $p(\boldsymbol \alpha| \boldsymbol y, \theta, \beta, \sigma^2_\epsilon)$, I need to choose the starting points of $\eta_{\mu,t}$, $\eta_{\delta,t}$ and $\eta_{\gamma,t}$ in order to generate a set of new dataset $\boldsymbol w^+$, $\boldsymbol \alpha^+$ $\boldsymbol y^+$. However, I cannot figure out how to choose these values. If I generate a value or use the mean from the prior $1/\sigma^2 \sim Gamma(10^{-2}, 10^{-2} s_y^2)$ suggests in the paper to inference $\theta \sim P(\theta| \boldsymbol y, \boldsymbol \alpha, beta, \sigma^2_\epsilon$, the starting points would be too big.

Another question is how to choose the starting points for $\boldsymbol \beta$ and $\sigma^2$?

Last, I found the main part of R package CausalImpact is being compiled and thus I cannot open the code to see how it works. If anyone has the code or similar, would you help to share it if possible?

Thanks to everyones help.

• CausalImpact code is here github.com/google/CausalImpact – jaradniemi Jun 5 '15 at 16:53
• Thanks to your reply. It is a good resource. If check this code carefully, the core part of this code is being compiled into .so file. So I dont know how the bayesian inference works exactly. This is the part I am asking for answer. – Po Ning Jun 5 '15 at 17:37

## 1 Answer

You can either choose the prior mean or, more commonly, actually sample values from the prior, however extreme they might be. The Kalman filter and Durbin and Koopman's algorithm will quickly converge on more sane values as the number of MCMC samples increases.

• Thanks very much to your advise. I have figured it out yesterday after carefully debugging. However, here is another question. (Forgive me that I have so many questions) I want to replicate the prediction result as you did in AR(2) model, exactly the same setting in the CausalImpact package. From predicting time period t+1 to T, I use the predicted y value at t+1 to predict y value at t+2, and so on until T. What I found is I got the similar prediction value as the package did, but I got a wider confidence interval then yours. Are you using the same way to produce the prediction value? Thank – Po Ning Jun 14 '15 at 3:24
• Hi @PoNing, the package computes posterior predictive smoothing intervals, that is, the interval for time t is computed as p(y_t | y_1, ..., y_n), not as p(y_t | y_1, ..., y_{t-1}). – Kay Brodersen Jun 16 '15 at 20:44