Skip to contents

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.

Usage

synthdid_se_placebo(estimate, replications = 10000, seed = 1)

Arguments

estimate

An estimate object obtained from synthdid::synthdid_estimate() or causalverse::panel_estimate().

replications

The number of bootstrap replications to perform. Defaults to 10000.

seed

A numeric value for setting the random seed. Default is 1.

Value

When there is a single treated unit (N1 = 1), a single numeric scalar giving the placebo standard error. When there are multiple treated units (N1 > 1), a named numeric vector of length N1, one standard error per treated unit.

Note: If you have a single treated unit and pass a single synthdid_estimate object, the return value is a scalar (not a vector). This resolves the apparent discrepancy between the help page description ("vector of SEs") and a one-treated-unit setup.

Details

The function samples from the donor (control) units to construct placebo treatments and estimates the standard deviation of the resulting null distribution. The return value is automatically simplified to a scalar for single-treated-unit designs.

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)

# Returns a SCALAR when N1 = 1
se <- synthdid_se_placebo(estimate, replications = 200)
cat("SE =", se, "\n")
} # }