*! version 1.0.0 05aug2026

Title

causalimpact postestimation -- Postestimation tools for
causalimpact

Postestimation commands

The following commands are available after causalimpact:

command

predict counterfactual,
effects and their credible bands

causalimpact replay the summary table

causalimpact, report print the verbal interpretation

estimates cataloguing estimation results

lincom point estimates and tests of linear combinations of the
regression coefficients

test Wald tests on the regression coefficients

Syntax for predict

predict [type] newvar [if] [in] [, statistic]

statistic

Counterfactual
counterfactual counterfactual, posterior mean; the default

lower lower bound of its credible band

upper upper bound of its credible band

cumcounterfactual cumulative counterfactual

cumlower its lower bound

cumupper its upper bound

Causal effect
effect pointwise causal effect, eq. (2.15)

efflower its lower bound

effupper its upper bound

cumeffect cumulative causal effect, eq. (2.16)

cumefflower its lower bound

cumeffupper its upper bound

avgeffect running-average causal effect, eq. (2.17)

Data
response observed response, as used by the model

cumresponse cumulative observed response

xb regression (synthetic-control) component only

Options for predict

counterfactual, the default, stores the posterior mean of the
counterfactual: what the model expects the response would have been in the
absence of the intervention. It is defined over the whole modelling window, so it
also covers the pre-period, where it is the fitted value and can be used to judge
how well the model tracks the data before anything happened.

lower and upper give the central credible band of the counterfactual
at the level used at estimation. These are quantiles of the posterior predictive
draws of the response, so they include observation noise; the point
prediction is the mean of the noise-free state, which is why the point prediction
is not the midpoint of the band in general.

effect, efflower and effupper give the pointwise causal effect
and its band. They are missing outside the pre- and post-periods.

cumeffect, cumefflower and cumeffupper give the cumulative
effect. It is exactly zero throughout the pre-period by construction; see
help causalimpact methods.

avgeffect gives the running average of the pointwise effect over the
post-period, eq. (2.17). Use it in place of the cumulative effect whenever the
response is a stock quantity that cannot meaningfully be summed across time.

xb computes the regression component alone, using e(b). It requires
the model to have had covariates. Note that the coefficients are in the metric
the model was fitted in, so unless nostandardize was used, xb is on
the standardised scale and is a diagnostic, not a prediction of the response.

Replay and report

Typing causalimpact with no arguments redisplays the summary table.
Typing

. causalimpact, report

prints the verbal interpretation of the results: a paragraph-by-paragraph
account of the average effect, the cumulative effect, the relative effect, and
whether the finding is significant, with the standard caveats about model
assumptions. This is a port of summary(impact, "report") in the R package
and is intended to be pasted into a results section as a starting point.

. causalimpact, report digits(3)

controls the rounding used in that text.

Working with e()

The complete summary table is available as a matrix, with the same layout as
impact$summary in R:

. matrix S = e(summary)

. matrix list S, format(%9.4f)

. display "cumulative effect = " S[2,6]

. display "95% CI = [" S[2,7] ", " S[2,8] "]"

Rows are Average and Cumulative; the fifteen columns are
Actual, Pred, Pred_lower, Pred_upper, Pred_sd,
AbsEffect, AbsEffect_lower, AbsEffect_upper,
AbsEffect_sd, RelEffect, RelEffect_lower,
RelEffect_upper, RelEffect_sd, alpha, p.

The posterior summary of the regression component is in e(inclusion), with
one row per covariate and columns P_include, PostMean,
PostSD, P_positive. To list the controls the model actually selected:

. matrix I = e(inclusion)

. local nm : rownames I

. forvalues j = 1/`=rowsof(I)' {

. if I[`j',1] > 0.5 di "`:word `j' of `nm''"

. }

Because e(b) and e(V) are posted, test and lincom
work on the regression coefficients. Bear in mind that these are posterior
moments of a model-averaged, spike-and-slab coefficient vector, not sampling
moments of a maximum-likelihood estimator: a coefficient whose posterior
inclusion probability is low will have a posterior mean shrunk toward zero and a
posterior variance dominated by the mass at exactly zero. Read
e(inclusion) before reading any Wald test.

Remarks

predict reads the fitted series from memory rather than recomputing them,
which is why it is instant and why it reproduces generate() exactly. The
consequence is that the series do not survive discard, mata clear,
or re-loading the package; predict then stops with a clear message rather
than returning something wrong. If the series are needed permanently, ask for
them at estimation time:

. causalimpact y x1, pre(1 70) post(71 100) generate(ci)

which creates the same fifteen series as ordinary variables in one step, and
survives anything.

predict respects if and in and fills only the observations in
the estimation sample; everything else is left missing.

Examples

. causalimpact y x1, pre(1 70) post(71 100) niter(2000) seed(42)

The counterfactual and its band:

. predict cf, counterfactual

. predict cf_lo, lower

. predict cf_hi, upper

The effects:

. predict eff, effect

. predict ceff, cumeffect

. predict aeff, avgeffect

A hand-built version of the top panel:

. twoway (rarea cf_hi cf_lo t, color(gs14)) (line y t) (line cf t, lpattern(dash)), xline(70)

How large was the effect in the first week after the intervention?

. summarize eff if inrange(t, 71, 77)

The verbal report and the underlying numbers:

. causalimpact, report

. matrix list e(summary), format(%9.4f)

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane

Also see

Help: causalimpact,
causalimpact methods,
causalimpact interpretation,
causalimpact rcheck