Computes 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.

synthdid_se_jacknife(estimate, weights = attr(estimate, "weights"), seed = 1)

Arguments

estimate

A synthdid estimate object.

weights

Optional; custom weights for the fixed-weights jackknife. If NULL, the usual jackknife estimate is calculated.

seed

A numeric value for setting the random seed (only for placebo SE). Default is 1.

Value

Returns the standard error of the provided estimate.

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) {
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)
}