Thin wrapper around CausalImpact::CausalImpact() (Brodersen
et al. 2015). Fits a Bayesian structural time-series counterfactual
to a single-series treatment using the pre-intervention window and
reports the post-intervention causal effect with credible
intervals.
Arguments
- data
A data frame, matrix, or
zooobject whose first column is the outcome and remaining columns are concurrent covariate predictors.- pre_period
Integer length-2 vector giving the start and end row indices (or time indices for
zoo) of the pre-intervention window.- post_period
Integer length-2 vector giving the start and end row indices of the post-intervention window.
- model_args
Optional named list passed to
CausalImpact::CausalImpact()'smodel.argsargument (e.g.list(niter = 1000L)).- alpha
Posterior credible-interval coverage (default 0.05, meaning 95 percent intervals).
Value
Named list with elements average_effect,
cumulative_effect, ci_lower, ci_upper,
posterior_prob_causal, and summary (the upstream
CausalImpact summary matrix), plus the original
impact object.