Distributional Synthetic Controls Estimation

The method of synthetic controls is a widely-adopted tool for evaluating causal effects of policy changes in settings with observational data. In many settings where it is applicable, researchers want to identify causal effects of policy changes on a treated unit at an aggregate level while having access to data at a finer granularity. This package implements a simple extension of the synthetic controls estimator, developed in Gunsilius (2023) , that takes advantage of this additional structure and provides nonparametric estimates of the heterogeneity within the aggregate unit. The idea is to replicate the quantile function associated with the treated unit by a weighted average of quantile functions of the control units. The package contains tools for aggregating and plotting the resulting distributional estimates, as well as for carrying out inference on them.


DiSCos

The DiSCos package contains tools for computing counterfactual quantile functions in a Distributional Synthetic Controls (DiSco) setting, following the method proposed in Gunsilius (2023).

Getting Started

Have a look at the vignette replicating the empirical application in the paper to get started.

Installation

To install the latest stable version, run

install.packages("DiSCos")

You can install latest development version from GitHub with:

devtools::install_github("Davidvandijcke/DiSCos")

If you find any bugs or have any questions, please email [email protected].

If you are using this package in your research, please cite:

Gunsilius, Florian F. 2023. “Distributional Synthetic Controls.” Econometrica 91 (3): 1105–17.

Van Dijcke, David, Florian Gunsilius, and Austin Wright. "Return to Office and the Tenure Distribution." arXiv preprint arXiv:2405.04352 (2024).

FAQ

Q: Why does the code sometimes run slower than expected?
A: The approach in DiSCo is non-parametric and requires integrating over entire distributions, which naturally increases computational complexity. In particular, it can be costly for large datasets or large values of M and G.


Q: Is there a faster backend?
A: The optimization relies on libraries (e.g., “quadprog” or “CVXR”) that ultimately call C++ or FORTRAN under the hood. Even though these libraries are optimized, fully non-parametric distance-matching remains computationally heavy.


Q: How can I reduce the runtime while developing or debugging?
A:

  • Use fewer quantile points by setting M = 100 in DiSCo.
  • Set a smaller grid, e.g., G = 100, to reduce evaluation points.
  • Start with only two time periods (Ts = 2).
  • Disable time-consuming features, such as confidence intervals (CI=FALSE) and permutation tests (permutation=FALSE).
  • Increase parallel execution with num.cores in DiSCo, for example, by using a cluster or multiple cores to split bootstrap/permutation tasks.

Q: Are there other suggestions for handling large real-world data?
A:

  • Verify correctness with a minimal working example, then gradually increase M, G, and the number of periods.
  • Use discrete or categorical grid options (grid.cat) if suitable for your data to reduce the dimension of the problem.
  • Ensure memory and CPU availability align with the size of the task.

Q: Can I get a progress bar?
A: When the package was first implemented, there were no functional solutions for progress bars with parallel computation in R. This may have changed—if you’d like to contribute, feel free to become that hero 🦸 and either enhance this repo or create your own parallel progress bar package!

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("DiSCos")

0.1.4 by David Van Dijcke, 3 months ago


http://www.davidvandijcke.com/DiSCos/, https://github.com/Davidvandijcke/DiSCos


Report a bug at https://github.com/Davidvandijcke/DiSCos/issues


Browse source code at https://github.com/cran/DiSCos


Authors: David Van Dijcke [aut, cre] (ORCID: , Florian Gunsilius [aut] (ORCID: , Siyun He [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports CVXR, pracma, Rdpack, parallel, evmix, utils, extremeStat, MASS

Depends on data.table, ggplot2

Suggests haven, latex2exp, knitr, rmarkdown, maps, testthat, quadprog


See at CRAN