Wraps synthdid::synthdid_estimate() (or sc_estimate() /
did_estimate()) with the inference and diagnostics a single-treated-unit
design needs on every specification.
Arguments
- Y
Outcome matrix, units x periods, controls first and the treated unit last – exactly what
synthdid::panel.matrices()returns.- N0
Number of control units (the first
N0rows ofY).- T0
Number of pre-treatment periods (the first
T0columns).- X
Optional unit x period x covariate array, handed to
synthdid, which estimates the covariate coefficients jointly with the weights. To residualise on untreated cells first instead, useproject_out_covariates()and pass the result asY.- replications
Placebo replications. 200 is
synthdid's default.- conf_level
Confidence level for the interval.
- trim_k
Passed to
placebo_se_trimmed(). Placebos fitting worse thantrim_ktimes the treated unit's pre-period trend RMSE are dropped from the reference distribution.Infreproducessynthdid's untrimmed placebo SE.- se_method
"placebo"(default) or"none". Placebo inference refits the model once per replication and dominates the runtime, so sweeps that only need point estimates should pass"none", which returnsNAforse,t,ci_loandci_hi.- estimator
"sdid"(default),"sc"for synthetic control, or"did"for plain difference-in-differences, all assynthdiddefines them. The placebo distribution is refitted with the same estimator.- keep
How much to return beyond the summary.
"none"(default) returns the summary fields only."est"adds thesynthdid_estimateobject, which every plot needs."all"adds the individual placebo draws. Neither consumes extra randomness, so the estimate and standard error are unchanged.
Value
A list with att, se, t, ci_lo, ci_hi, trend_rmse,
level_gap, N0, T0, n_periods, omega (unit weights, named by
the control rownames of Y), lambda (time weights), estimator, and
the placebo trimming record trim_k, placebos_kept, placebos_total.
With keep = "est", also est; with keep = "all", also
placebo_draws, treated_rmse, placebo_rmse_median, unit_ids and
periods.
Details
Three things it standardises:
Placebo inference. With a single treated unit the jackknife variance is undefined – it would require dropping the treated unit – so the placebo variance is the default. With
trim_k = Infit is exactlysynthdid's ownvcov(est, method = "placebo"); seeplacebo_se_trimmed()for what trimming changes.The right pre-period fit statistic. SDID carries unit fixed effects and therefore tolerates a constant level gap between treated and synthetic control; absorbing it is what the DiD half does. Raw RMSE against the synthetic path penalises exactly what the estimator is designed to ignore.
trend_rmseis the RMSE of the treated-minus- synthetic gap after removing its pre-period mean, which is the parallel-trends assumption;level_gapreports the absorbed offset separately. Both are computed on the outcome the estimator actually fits: when covariates are passed asX, that isY - X beta, notY.A confidence interval. When every estimate is null the bound is the result, and a bound cannot be read off a p-value.
Placebo standard errors are simulated: the same specification moves by a few percent between runs depending on the RNG state. Set a seed before calling if results must be reproducible.
References
Arkhangelsky, D., Athey, S., Hirshberg, D. A., Imbens, G. W. and Wager, S. (2021). Synthetic Difference-in-Differences. American Economic Review 111(12), 4088-4118.
Examples
# \donttest{
data("california_prop99", package = "synthdid")
setup <- synthdid::panel.matrices(california_prop99)
set.seed(1)
r <- fit_sdid(setup$Y, setup$N0, setup$T0, replications = 50)
c(att = r$att, lo = r$ci_lo, hi = r$ci_hi)
#> att lo hi
#> -15.603828 -37.387689 6.180034
# }