SynthDiD.jl
SynthDiD.jl is a Julia implementation of synthetic difference-in-differences from Arkhangelsky, Athey, Hirshberg, Imbens, and Wager (2021). It works with balanced panel data and returns the synthetic DiD, synthetic control, and DiD estimates from the same setup.
Main pieces
- Three estimators:
synthdid_estimate,sc_estimate, anddid_estimate - Panel reshaping utilities:
panel_matricesconverts long data into the matrix representation used by the estimators - Inference tools:
vcov,se, and placebo-based diagnostics - Plotting support: plot recipes plus accessors for custom plots
Installation
using Pkg
Pkg.add(url="https://github.com/xao/SynthDiD.jl")Quick Start
using SynthDiD
df = california_prop99()
setup = panel_matrices(df, :State, :Year, :PacksPerCapita, :treated)
tau_sdid = synthdid_estimate(setup.Y, setup.N0, setup.T0)
tau_sc = sc_estimate(setup.Y, setup.N0, setup.T0)
tau_did = did_estimate(setup.Y, setup.N0, setup.T0)Tutorials
- Introduction: California Proposition 99 walkthrough and estimator overview
- More on Plotting: plot customization, weight summaries, and accessors
- Paper Results: replication-style estimates and placebo simulations