CAUSAL INFERENCE

Causal Impact (Time Series)

Estimate the effect of an intervention by comparing observed outcomes to a Bayesian time‑series counterfactual with credible intervals.

What Makes This Trustworthy

BSTS Counterfactual

Uses Google's CausalImpact package with Bayesian structural time series (BSTS) to create counterfactual predictions.

Bayesian Credible Intervals

95% credible intervals for both pointwise and cumulative effects, using 1000 MCMC iterations for robust uncertainty quantification.

Component Decomposition

Separates trend and seasonal components, with optional control variables that weren't affected by the intervention.

What You Need to Provide

Required Data Structure

Your data needs a date_column, target metric to analyze, and an intervention_date (when the change occurred). Optional control_variables improve the model.

Data format: Time series with regular intervals (daily/weekly/monthly). The CausalImpact package automatically detects seasonality and builds the BSTS model.

Minimum requirements: At least 30 pre-intervention observations, ideally 50+. Post-intervention period should be long enough to detect meaningful changes.

What you get: Average and cumulative treatment effects with credible intervals, pointwise impact over time, relative effect percentages, detailed report narrative.

Time Series Schema / Pre‑Post Split

Quick Specs

Indexdate or timestamp
Outcomenumeric series
Pre‑period≥ 12–24 points recommended
Covariatesoptional drivers/seasonality

How We Estimate Impact

From pre‑period modeling to post‑period inference

1

BSTS Model Fitting

CausalImpact fits a Bayesian structural time series model on pre-intervention data, learning trend, seasonality, and regression components.

2

Posterior Prediction

Uses MCMC sampling to generate counterfactual predictions with full Bayesian uncertainty for the post-intervention period.

3

Impact Quantification

Calculates average and cumulative effects, both absolute and relative (%), with 95% credible intervals and automated report generation.

Why This Analysis Matters

When a single global change ships (pricing, policy, homepage), Causal Impact provides defensible lift numbers without a control group.

Use it for marketing bursts, product launches, SEO changes, or outages. The counterfactual forecast makes assumptions explicit and uncertainty visible—easy to socialize with leadership.

Key Assumption: The pre‑period model generalizes to the post‑period absent intervention; covariates capture major drivers.

Ready to Measure Lift?

Turn your time series into causal evidence

Read the article: Causal Impact