Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xuyiqing/gsynth
Generalized Synthetic Control Method
https://github.com/xuyiqing/gsynth
Last synced: 1 day ago
JSON representation
Generalized Synthetic Control Method
- Host: GitHub
- URL: https://github.com/xuyiqing/gsynth
- Owner: xuyiqing
- License: other
- Created: 2017-01-02T02:15:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-02-22T22:58:38.000Z (over 2 years ago)
- Last Synced: 2024-08-03T06:03:48.582Z (3 months ago)
- Language: R
- Size: 4.29 MB
- Stars: 131
- Watchers: 11
- Forks: 40
- Open Issues: 70
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# gsynth
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://www.tidyverse.org/lifecycle/#stablel)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)**gsynth** implements the [generalized synthetic control method](https://doi-org.stanford.idm.oclc.org/10.1017/pan.2016.2), 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](https://yiqingxu.org/) (Stanford), [Licheng Liu](https://polisci.mit.edu/people/licheng-liu) (MIT)
**Date:** Feb 22, 2022
**Repos:** [Github](https://github.com/xuyiqing/gsynth) (1.2.1)
[CRAN](https://cran.r-project.org/web/packages/gsynth/index.html) (1.2.1)**Example:** R code used in the [tutorial](https://yiqingxu.org/packages/gsynth/articles/tutorial.html) can be downloaded from [here](https://yiqingxu.org/packages/gsynth/gsynth_examples.R).
---
## Installation
You can install **gsynth** directly from CRAN by typing the following command in the **R** console:
```{r eval=FALSE}
install.packages('gsynth', type = 'source')
```You can also install the development version of the package from Github by typing:
```{r eval=FALSE}
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:
```{r eval=FALSE}
## 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](https://github.com/xuyiqing/gsynth/releases/download/1.2.1/gsynth_1.2.1.tgz)), 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](https://cran.r-project.org/bin/windows/Rtools/) to avoid C++17 complier errors when installing fastplm.
3. For Rcpp, RcppArmadillo and MacOS "-lgfortran" and "-lquadmath" error, click [here]( http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/) for details.
4. Installation failure related to OpenMP on MacOS, click [here](http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/) for a solution.
5. To fix these issues, try installing gfortran 6.1 from [here]( https://gcc.gnu.org/wiki/GFortranBinaries#MacOS clang4 R Binaries from https://github.com/coatless/r-macos-clang).
6. Mac users who have updated to MacOS Big Sur will likely encounter compilation problems. See [here](http://yiqingxu.org/public/BigSurError.pdf) 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](https://yiqingxu.org/packages/panelview/). Much appreciated!