Reference

Estimation

SynthDiD.synthdid_estimateFunction
synthdid_estimate(Y, N0, T0; kwargs...)

Compute the synthetic diff-in-diff estimate (Algorithm 1 of Arkhangelsky et al. 2021).

Arguments

  • Y: N×T outcome matrix. Rows 1:N0 are control units, rows N0+1:N are treated.
  • N0: number of control units.
  • T0: number of pre-treatment periods.
  • X: optional N×T×C covariate array.
  • eta_omega: regularization parameter for omega. Default: (N1*T1)^(1/4).
  • eta_lambda: regularization for lambda. Default: 1e-6.
  • omega_intercept, lambda_intercept: whether to demean when estimating weights.
  • omega, lambda, beta: optional pre-specified values.
  • min_decrease: convergence tolerance.
  • max_iter: maximum iterations.
  • do_sparsify: whether to sparsify weights. Default: true.
  • max_iter_pre_sparsify: iterations before sparsification. Default: 100.
  • units, times: optional vectors of unit/time labels (used for plotting/diagnostics).
source
SynthDiD.sc_estimateFunction
sc_estimate(Y, N0, T0; kwargs...)

Synthetic control estimator. Uses zero time weights and no unit intercept.

source

Data Preparation

SynthDiD.panel_matricesFunction
panel_matrices(panel, unit, time, outcome, treatment; covariates=Symbol[], treated_last=true)

Convert a long balanced panel DataFrame to matrix format. Returns a NamedTuple (Y, N0, T0, W, X, units, times) where Y is N×T and X is N×T×C.

source
SynthDiD.california_prop99Function
california_prop99()

Load the California Proposition 99 dataset (Abadie, Diamond & Hainmueller 2010). Returns a DataFrame with columns: State, Year, PacksPerCapita, treated.

source

Inference and Diagnostics

SynthDiD.vcovFunction
vcov(est::SynthDiDEstimate; method=:bootstrap, replications=200)

Estimate variance. Methods: :bootstrap, :jackknife, :placebo.

source
SynthDiD.seFunction
se(est::SynthDiDEstimate; method=:bootstrap, replications=200)

Standard error of the estimate.

source
SynthDiD.effect_curveFunction
effect_curve(est::SynthDiDEstimate)

Return the per-period treatment effect curve that was averaged to produce the estimate.

source
SynthDiD.placeboFunction
placebo(est::SynthDiDEstimate; treated_fraction=nothing)

Compute a placebo estimate using pre-treatment data only.

source
SynthDiD.synthdid_controlsFunction
synthdid_controls(estimates; sort_by=1, mass=0.9, weight_type="omega")

Return a DataFrame of control weights, sorted by magnitude.

  • weight_type: "omega" for unit weights, "lambda" for time weights
  • mass: retains controls with cumulative weight ≥ mass (default 90%)
  • sort_by: which estimate to sort by (1-indexed)
source