fect

Lifecycle: experimental License: MIT

R package for implementing counterfactual estimators in panel fixed-effect settings. It is suitable for panel/TSCS analysis with binary treatments under (hypothetically) baseline randomization. It allows a treatment to switch on and off and limited carryover effects. It supports linear factor models—hence, a generalization of gsynth—and the matrix completion method.

Repo: GitHub (0.4.1)

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

Reference: Licheng Liu, Ye Wang, Yiqing Xu (2021). A Practical Guide to Counterfactual Estimators for Causal Inference with Time-Series Cross-Sectional Data. American Journal of Political Science, conditionally accepted.

Installation

You can install the development version of fect from GitHub by typing the following commands:

devtools::install_github('xuyiqing/fect')

panelview for panel data visualization is also highly recommended:

devtools::install_github('xuyiqing/panelView')

fect depends on the following packages, which will be installed automatically when fect is being installed. You can also install them manually.

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

Report bugs

Please report bugs to yiqingxu [at] stanford.edu with your sample code and data file. Much appreciated!