Package: synthdid 0.0.9

David A. Hirshberg

synthdid: Synthetic Difference-in-Difference Estimation

Estimate average treatment effects in panel data. Currently provides methods only for the case that all treated units adopt treatment at the same time.

Authors:Dmitry Arkhangelsky [aut] Susan Athey [aut] David A. Hirshberg [aut, cre] Guido W. Imbens [aut] Stefan Wager [aut]

synthdid_0.0.9.tar.gz
synthdid_0.0.9.zip(r-4.5)synthdid_0.0.9.zip(r-4.4)synthdid_0.0.9.zip(r-4.3)
synthdid_0.0.9.tgz(r-4.4-any)synthdid_0.0.9.tgz(r-4.3-any)
synthdid_0.0.9.tar.gz(r-4.5-noble)synthdid_0.0.9.tar.gz(r-4.4-noble)
synthdid_0.0.9.tgz(r-4.4-emscripten)synthdid_0.0.9.tgz(r-4.3-emscripten)
synthdid.pdf |synthdid.html
synthdid/json (API)

# Install 'synthdid' in R:
install.packages('synthdid', repos = c('https://skranz.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/synth-inference/synthdid/issues

Datasets:

On CRAN:

3.34 score 1 packages 73 scripts 16 exports 1 dependencies

Last updated 3 years agofrom:a05029b97d (on master). Checks:OK: 1 NOTE: 6. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 22 2024
R-4.5-winNOTESep 22 2024
R-4.5-linuxNOTESep 22 2024
R-4.4-winNOTESep 22 2024
R-4.4-macNOTESep 22 2024
R-4.3-winNOTESep 22 2024
R-4.3-macNOTESep 22 2024

Exports:did_estimateestimate_dgplindsey_density_estimatepanel.matricessc_estimatesimulate_dgpsynthdid_controlssynthdid_effect_curvesynthdid_estimatesynthdid_placebosynthdid_placebo_plotsynthdid_plotsynthdid_rmse_plotsynthdid_sesynthdid_units_plottimesteps

Dependencies:mvtnorm

Readme and manuals

Help Manual

Help pageTopics
compute the correlation matrix of a time series generated by an ar2 modelar2_correlation_matrix
California proposition 99california_prop99
CPSCPS
Decompose Y into components F, M, and E as described in Section 3.1.1 also computes a set of 'unit factors': the first rank left singular vectors from SVD(Y)decompose_Y
synthdid_estimate for diff-in-diff estimates. Takes all the same parameters, but by default, passes options to use the diff-in-diff estimatordid_estimate
Estimates the DGP parameters used in the placebo studies in Sections 3 and 5 of the synthetic difference in differences paper. Described there in Section 3.1.1.estimate_dgp
Estimate ar2 coefficients from iid time seriesfit_ar2
Format a synthdid objectformat.synthdid_estimate
Computes a density estimator by smoothing a histogram using Poisson regression. Implementation of "Lindsey's method", as descrbied in Chapter 10 of "Computer age statistical inference: algorithms, evidence, and data science' by Bradley Efron and Trevor Hastie (2016).lindsey_density_estimate
Convert a long (balanced) panel to a wide matrixpanel.matrices
PENNPENN
Plot a synthdid objectplot.synthdid_estimate
Print a synthdid objectprint.synthdid_estimate
randomize treatment to n units with probability pi then if the number of treated units is zero, assign treatment to one unit uniformly at random and if the number of treated units exceeds a cap, remove treatment uniformly at random so it is exactly that caprandomize_treatment
synthdid_estimate for synthetic control estimates. Takes all the same parameters, but by default, passes options to use the synthetic control estimator By default, this uses only 'infinitesimal' ridge regularization when estimating the weights.sc_estimate
Simulates data from DGPs used in the placebo studies in Sections 3 and 5 of the synthetic difference in differences paper. Described there in Section 3.1.1.simulate_dgp
A function mapping a numeric vector to a (presumably sparser) numeric vector of the same shape to be passed onto synthdid_estimate.sparsify_function
Summarize a synthdid objectsummary.synthdid_estimate
Outputs a table of important synthetic controls and their corresponding weights, sorted by weight. The table is truncated to exclude synthetic controls that do not matter for any estimate - for each estimate, the truncated controls may have total weight no larger that 1-mass.synthdid_controls
Outputs the effect curve that was averaged to produce our estimatesynthdid_effect_curve
Computes the synthetic diff-in-diff estimate for an average treatment effect on a treated block.synthdid_estimate
Computes a placebo variant of our estimator using pre-treatment data onlysynthdid_placebo
For our estimator and a placebo, plots treated and synthetic control trajectories and overlays a 2x2 diff-in-diff diagram. Requires ggplot2synthdid_placebo_plot
Plots treated and synthetic control trajectories and overlays a 2x2 diff-in-diff diagram of our estimator. In this overlay, the treatment effect is indicated by an arrow. The weights lambda defining our synthetic pre-treatment time period are plotted below. If a list of estimates is passed, plots all of them. By default, does this in different facets. To overlay estimates in the same facet, indicate a facet for each estimator in the argument 'facet'.synthdid_plot
A diagnostic plot for sc.weight.fw.covariates. Plots the objective function, regularized RMSE, as a function of the number of Frank-Wolfe / Gradient steps taken. Requires ggplot2synthdid_rmse_plot
Calculate the standard error of a synthetic diff in diff estimate. Deprecated. Use vcov.synthdid_estimate.synthdid_se
Plots unit by unit difference-in-differences. Dot size indicates the weights omega_i used in the average that yields our treatment effect estimate. This estimate and endpoints of a 95% CI are plotted as horizontal lines. Requires ggplot2synthdid_units_plot
Get timesteps from panel matrix Ytimesteps
Calculate Variance-Covariance Matrix for a Fitted Model Objectvcov.synthdid_estimate