Skip to contents

This function computes estimates and standard errors for panel data using selected estimators. It allows the user to select specific estimators and set parameters for Monte Carlo replications and seed. Optionally supports covariate adjustment for the "sdid" (Synthetic DID) estimator.

Usage

panel_estimate(
  setup,
  selected_estimators = setdiff(names(panel_estimators), "mc"),
  X = NULL,
  mc_replications = 200,
  seed = 1
)

Arguments

setup

A list containing matrices Y, N0, and T0 for panel data analysis, as produced by synthdid::panel.matrices().

selected_estimators

A character vector specifying which estimators to use. Available options: "sc", "sdid", "did", "sc_ridge", "difp", "difp_ridge", "mc". Defaults to all available estimators except "mc".

X

A 3-dimensional array of covariates for the Synthetic DID estimator, with dimensions (N, T, K) where N is total units, T is time periods, and K is the number of covariates. Only used when the "sdid" estimator is selected. See synthdid::synthdid_estimate() for details. Default NULL (no covariates).

mc_replications

The number of Monte Carlo replications for computing standard errors. Applicable if the "mc" estimator is used. Defaults to 200.

seed

An integer value to set the random seed for reproducibility. Defaults to 1.

Value

A list where each element corresponds to an estimator and contains its estimate and standard error. Each element is a list with:

estimate

The estimator object.

std.error

The placebo standard error.

Details

Covariate Support: The X argument adds covariate adjustment to the Synthetic DID estimator, as described in Arkhangelsky et al. (2021). When covariates are supplied, sdid will partial out the covariate effects before computing synthetic weights. Other estimators (sc, did, etc.) do not support the X argument and will use setup$Y, setup$N0, and setup$T0 directly.

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{
library(synthdid)
setup <- panel.matrices(california_prop99)
results_all <- panel_estimate(setup)
results_selected <- panel_estimate(setup, selected_estimators = c("did", "sc", "sdid"))
summary(results_selected$sdid$estimate)
} # }