Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 036
Research workflow/4 steps

Synthetic control, the tidy way — weights, gaps and placebo inference (tidysynth)

Source tidysynth — Eric Dunford
01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 4 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 4
01
Data prep

Panel, treated unit, donor pool

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Pick the treated unit and intervention time; the rest of the units form the donor pool. Identification rests on a good pre-treatment fit.

Formula
\hat Y^{N}_{1t}=\textstyle\sum_{j\ge 2}\hat w_j\,Y_{jt}
Reads fromNot specified Feeds intoNot specified
Key code
synthetic_control(outcome = cigsale, unit = state,
                  time = year, i_unit = 'California', i_time = 1988)

Reference / docs ↗

Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

A balanced panel (unit × time) with one treated unit switching on at a known time, a donor pool, and a few pre-treatment predictors.

Show data format & exampleHide example

Format — long panel: unit, time, outcome, predictors; one treated unit after T0.

library(tidysynth)
out <- panel %>%
  synthetic_control(outcome = cigsale, unit = state, time = year,
                    i_unit = 'California', i_time = 1988) %>%
  generate_predictor(...) %>% generate_weights() %>% generate_control()
03
Read the evidence

Results & interpretation

2 figures Workflow discussion 2
01FigurePlacebo gaps (Abadie's California Prop-99): the treated unit's gap (magenta) plunges past nearly every donor-pool placebo after the 1988 intervention.
02FigureHow the synthetic control is built: convex weights on donor states (Utah, Nevada, …) and on the predictor variables.

Figures reproduced from tidysynth — Eric Dunford — unofficial community showcase; all credit to the original authors.

Context & interpretation

⚠️ Unofficial community showcase of tidysynth. Not affiliated with the authors; all credit to them.

Build a synthetic version of the treated unit from a convex blend of donors, read the treated-minus-synthetic gap, and test it against placebos run on every donor.

Peer notes

Discuss the workflow (2)

  • 2

    The pipe-friendly API finally makes SC readable end to end. plot_placebos() as the inference step is the part people skip.

  • 0

    Showing the donor and predictor weights side by side is underrated — it's the honest answer to 'where does the counterfactual come from?'.

    1

    Agreed. If one donor carries 0.8 of the weight, the 'synthetic' control is basically that one unit and you should say so.

IN THE MARGINS

Peer discussion