synthdid_se_placebo.Rd
Computes placebo standard errors for synthetic difference-in-differences (DID) estimates. This function is based on the methodology described in Arkhangelsky et al. (2021). It is particularly useful when there is only one treated unit and performs a bootstrap procedure to estimate the standard errors.
synthdid_se_placebo(estimate, replications = 10000, seed = 1)
An estimate object obtained from synthetic DID estimation.
The number of bootstrap replications to perform. Defaults to 500.
A numeric value for setting the random seed. Default is 1.
A vector of standard errors corresponding to the input estimates.
Arkhangelsky, D., Athey, S., Hirshberg, D. A., Imbens, G. W., & Wager, S. (2021). Synthetic Difference-in-Differences. American Economic Review, 111(12), 4088-4118. American Economic Association 2014 Broadway, Suite 305, Nashville, TN 37203.
if (FALSE) {
setup <- get_balanced_panel(
data = fixest::base_stagg,
adoption_cohort = 5,
lags = 2,
leads = 3,
time_var = "year",
unit_id_var = "id",
treated_period_var = "year_treated"
) |>
# get treatment status
dplyr::mutate(treatvar = if_else(time_to_treatment >= 0, 1, 0)) |>
# correct those control units to have treatment status to be 0
dplyr::mutate(treatvar = as.integer(if_else(year_treated > (5 + 2), 0, treatvar))) |>
synthdid::panel.matrices(
unit = "id",
time = "year",
outcome = "y",
treatment = "treatvar"
)
estimate <- synthdid::synthdid_estimate(setup$Y, setup$N0, setup$T0)
se_results <- synthdid_se_placebo(estimate, replications = 1000)
}