
Panel Estimate Function
panel_estimate.RdThis 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.
Arguments
- setup
A list containing matrices
Y,N0, andT0for panel data analysis, as produced bysynthdid::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)whereNis total units,Tis time periods, andKis the number of covariates. Only used when the"sdid"estimator is selected. Seesynthdid::synthdid_estimate()for details. DefaultNULL(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)
} # }