
Calculate Jackknife Standard Errors for Synthetic DID
synthdid_se_jacknife.RdComputes the standard error of estimates using the jackknife method. It is specifically tailored for use with
synthetic difference-in-differences estimates from the synthdid package. This function supports both the usual
jackknife estimate of variance and the fixed-weights jackknife estimate as described by Arkhangelsky et al.
Usage
synthdid_se_jacknife(estimate, weights = attr(estimate, "weights"), seed = 1)References
Arkhangelsky, D., Athey, S., Hirshberg, D. A., Imbens, G. W., & Wager, S. (2021). Synthetic difference-in-differences. American Economic Review, 111(12), 4088-4118.
Examples
if (FALSE) { # \dontrun{
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"
) |>
dplyr::mutate(treatvar = if_else(time_to_treatment >= 0, 1, 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_jacknife(estimate, seed = 123)
} # }