R package for implementing counterfactual estimators, also known as imputation estimators, in panel fixed-effect settings. Suitable for causal panel analysis with binary treatments under (hypothetically) baseline randomization. It allows a treatment to switch on and off and limited carryover effects. It supports two-way fixed effects, linear factor models, and the matrix completion method.
Starting from v.2.0.0, all gsynth functionalities have been merged into fect.
Source Code: GitHub
User Manual: Quarto Book
Main References:
Xu, Yiqing (2017). Generalized Synthetic Control Method: Causal Inference with Interactive Fixed Effects Models. Political Analysis 25 (1): 57–76.
Liu, Licheng, Ye Wang, Yiqing Xu (2024). A Practical Guide to Counterfactual Estimators for Causal Inference with Time-Series Cross-Sectional Data. American Journal of Political Science, 68 (1): 160–76.
Chiu, Albert, Xingchen Lan, Ziyi Liu, and Yiqing Xu. (2025). Causal Panel Analysis Under Parallel Trends: Lessons from a Large Reanalysis Study. American Political Science Review, First View.
Report bugs: Please report any bugs by submitting an issue on GitHub or emailing me (yiqingxu [at] stanford.edu). We’d really appreciate it if you can include your minimally replicable code & data file and a panelView treatment status plot. Your feedback is highly valued!