Skip to content

statsclaw/example-fect

Repository files navigation

fect

Lifecycle: stable License: MIT CRAN status CRAN downloads

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.

Example: The Effect of Indirect Democracy

Democracy Effect

ATT estimates with 95% CI bands. Pre-treatment placebo (grey) is centered around zero; post-treatment effect (blue) shows a significant positive impact. Golden bars indicate sample sizes at each relative time period.

EM Convergence Improvement (v2.2.0)

Convergence Fix

Component-wise convergence monitoring improves accuracy by 43–2,249× without speed regression. Fully backward-compatible at default settings.

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!

About

Forked from xuyiqing/fect — fixed effect counterfactual estimators

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors