Select 包含在 CausalImpact 或 bsts 中的先验概率?

Select prior probability of inclusion in CausalImpact or bsts?

在论文的 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 中,他们说通过 "asking about the expected model size M." 获取值 我检查了 CausalImpact 的文档,但找不到更多信息。这在包中的哪里完成?我可以在函数调用中设置一个参数来决定为什么我想要 M 吗?

你是对的,这不能直接通过 CausalImpact 实现,但它是可能的。 CausalImpact 在幕后使用 bsts,这个包允许设置参数。因此,您必须首先使用 bsts 定义模型,设置参数,然后将其提供给您的 CausalImpact 调用,如下所示(CausalImpact 手册中的修改示例):

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)