In the CausalImpact package, the supplied covariates are independently selected with some prior probability M/J
where M
is the expected model size and J
is the number of covariates. However, on page 11 of the paper, they say get the values by "asking about the expected model size M." I checked the documentation for CausalImpact but was unable to find any more information. Where is this done in the package? Is there a parameter I can set in a function call to decide why my desired M
?
Asked
Active
Viewed 340 times
0

Booley
- 819
- 1
- 9
- 25
1 Answers
1
You are right, this is not directly possible with CausalImpact, but it is possible. CausalImpact uses bsts behind the scenes and this package allows to set the parameter. So you have to define you model using bsts first, set the parameter and then provide it to your CausalImpact call like this (modified example from the CausalImpact manual):
post.period <- c(71, 100)
post.period.response <- y[post.period[1] : post.period[2]]
y[post.period[1] : post.period[2]] <- NA
ss <- AddLocalLevel(list(), y)
bsts.model <- bsts(y ~ x1, ss, niter = 1000, expected.model.size = 4)
impact <- CausalImpact(bsts.model = bsts.model,
post.period.response = post.period.response)

NaN
- 3,501
- 8
- 44
- 77
-
Hi, I have a follow-up question. I tried comparing the results from using CausalImpact (default) and those from using BSTS but the credible interval does not match at all - in the former the credible interval is very stable even in post intervention period, but in the latter it starts widening very rapidly which makes zero sense to me. Simply put, basically what you explained as a way to use BSTS in Causalimpact doesn't work at all. – Kang Inkyu Oct 04 '21 at 05:30