Custom model using BSTS does not match with CausalImpact in R (please help!) I am trying to match the results from using CausalImpact with those from using BSTS for a custom model. I followed exactly what the package instruction says but the results completely do not match.
Here I tried a simple local level model. Dataset name: stopcount_trial, Y variable: stopcount, pre-period: 1-79, post-period:80-158.
First, I tried the CausalImpact package.
pre.period <- c(1, 79)
post.period <- c(80, 158)
impactpractice1 <- CausalImpact(stopcount_trial, pre.period, post.period, model.args = list(niter = 1000))
plot(impactpractice1)

And I get this:

Here, I tried the BSTS package (but should be the same as CausalImpact)
post.period <- c(80, 158)
post.period.response <- stopcount_final$stopcount[post.period[1] : post.period[2]]
stopcount_final$stopcount[post.period[1] : post.period[2]] <- NA
ss <- AddLocalLevel(list(), stopcount_final$stopcount)
bsts.model <- bsts(stopcount_final$stopcount, ss, niter = 1000)
impact <- CausalImpact(bsts.model = bsts.model,
                       post.period.response = post.period.response)
plot(impact)

And I get this:

The results are supposed to be identical, but they are not. What the heck I am doing wrong here? Please help.

Python uses a different approach than R in generating forecasts without an intervention — the former uses the Kalman filter with the aim of maximising the likelihood function observed across the time series, while the latter relies more on a Bayesian approach that emphasises user prior knowledge. The details are described in the pycausalimpact documentation.
Therefore, it is not surprising that different results can be yielded among the two. In the documentation, it is notable that they recommend setting the prior as None. In your case, doing so might see the obtained results resemble that obtained by BSTS more closely. However, that depends on the type of data you are working with and the appropriate assumption for the prior (i.e. your prior beliefs about the distribution of a set of data).
