@misc{synthdid,
title = {synthdid},
author = {Arkhangelsky and Athey and Hirshberg and Imbens and Wager},
howpublished = {\url{https://github.com/synth-inference/synthdid}},
note = {Software / documentation}
}Solve for unit weights (so pre-treatment fit is nearly exact) AND time weights (so periods that look like the treatment period count more), then run a weighted DiD on the reweighted panel. More robust than plain SC when parallel trends only approximately hold.
Input · what goes in
A balanced panel (unit × time), with one or a few treated units that switch on at a known time.
Show data format & exampleHide example
Format — a unit × time outcome matrix; treatment turns on for some units after T0.
unit 2010 2011 2012* 2013*
A 8.1 8.4 9.0 9.3 # treated after 2011
B 7.9 8.0 8.1 8.2
Pipeline · the recipe ⑂ has parallel branches
↑ Click any step in the diagram to read its logic, code, assumptions & discussion.
Balanced panel + treated block
Data preparation — shapes the raw inputs into what the estimator expects.
Reshape to a (unit × time) outcome matrix with the treated cells marked.
library(synthdid)
setup <- panel.matrices(panel)
- No comments on this step yet — be the first.
Log in to comment on this step.
Solve for unit & time weights
The core estimate — where the causal quantity itself is computed.
Unit weights match pre-trends; time weights downweight uninformative periods.
tau.hat <- synthdid_estimate(setup$Y, setup$N0, setup$T0)
- No comments on this step yet — be the first.
Log in to comment on this step.
Placebo / jackknife standard errors
Uncertainty quantification — standard errors, intervals, and aggregation.
Variance from placebo reassignments or a jackknife over control units.
se <- sqrt(vcov(tau.hat, method = 'placebo'))
- No comments on this step yet — be the first.
Log in to comment on this step.
Plot trajectories & the gap
Reporting — turn the numbers into a figure or table a reader can act on.
Treated vs synthetic path, with the estimated effect shaded.
plot(tau.hat)
- No comments on this step yet — be the first.
Log in to comment on this step.
Output · what you get
⚠️ Unofficial community showcase of synthdid. Not affiliated with the authors; all credit to them.
Reweight both control units and pre-periods to build a synthetic control, then apply a DiD correction — robust where plain SC or TWFE struggle.
Discussion (0)
Log in to join the discussion.