Skip to contents

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.

Authors: Yiqing Xu (Stanford), Licheng Liu (UMich), Ziyi Liu (Berkeley), Shiyun Hu (PKU)

Date: Dec 7, 2025

Repos: Github (1.3.1) CRAN (1.3.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:

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:

packages <- c("ggplot2", "panelViews", "fect")

# install packages if not already installed
install_all <- function(packages) {
  installed_pkgs <- installed.packages()[, "Package"]
  for (pkg in packages) {
    if (!pkg %in% installed_pkgs) {
      install.packages(pkg)
    }
  }
}
install_all(packages)

Report bugs

gsynth is now a wrapper of fect. Please check fect User Manual for updates. We maintain gsynth solely for backward compatibility.