Skip to content

Latest commit

 

History

History
100 lines (79 loc) · 3.42 KB

README.md

File metadata and controls

100 lines (79 loc) · 3.42 KB

gsynth

Lifecycle: stable License: MIT

gsynth implements the generalized synthetic control method, which imputes counterfactuals for each treated unit using control group information based on a linear interactive fixed effects model. This version supports unbalanced panels and implements the matrix completion method.

Authors: Yiqing Xu (Stanford), Licheng Liu (MIT)

Date: Feb 22, 2022

Repos: Github (1.2.1) CRAN (1.2.1)

Example: R code used in the tutorial can be downloaded from here.


Installation

You can install gsynth directly from CRAN by typing the following command in the R console:

install.packages('gsynth', type = 'source')

You can also install the development version of the package from Github by typing:

install.packages('devtools', repos = 'http://cran.us.r-project.org') # if not already installed
devtools::install_github('xuyiqing/gsynth')

gsynth depends on the following packages, which will be installed automatically when gsynth is being installed; you can also install them manually:

## for processing C++ code
require(Rcpp) 
## for plotting
require(ggplot2)  
require(GGally) 
## for parallel computing 
require(foreach)  
require(future)
require(doParallel) 
require(abind) 
require(lfe)

Notes on installation failures

  1. Quick solution: download a binary build (v.1.2.1), which does not require compilation, and install it from file in RStudio.
  2. Windows users please consider upgrading R to 4.0.0 or higher and installing the latest Rtools to avoid C++17 complier errors when installing fastplm.
  3. For Rcpp, RcppArmadillo and MacOS “-lgfortran” and “-lquadmath” error, click here for details.
  4. Installation failure related to OpenMP on MacOS, click here for a solution.
  5. To fix these issues, try installing gfortran 6.1 from here.
  6. Mac users who have updated to MacOS Big Sur will likely encounter compilation problems. See here for a potential solution.

Report bugs

Please report bugs to yiqingxu [at] stanford.edu with your sample code, data file, and a treatment status plot generated by panelview. Much appreciated!