xuyiqing / fect_python

Python version of fixed effects counterfactual estimators

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fect_python

Lifecycle: experimental License: MIT

Fixed effects counterfactual estimator (fect) based on rpy2. This is a 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 (1.0.0)

Examples: The original R tutorial can be replicated in Python with this tutorial. You can also find a markdown version tutorial 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.

The original R package of fect can be found here: GitHub (1.0.0). This package is based on rpy2, which makes R objects available in Python environments.

Installation

You can install fect from github by the following command:

pip install git+https://github.com/xuyiqing/fect_python.git

Requirements

  • Python 3.7+
  • rpy2 3.5+
  • numpy 1.1+
  • pandas 1.1.2+

Although fect_python works on the latest version of rpy2, we strongly recommend installing rpy2 3.5.4 in case of potential conflits.

About

Python version of fixed effects counterfactual estimators

License:MIT License


Languages

Language:Jupyter Notebook 98.8%Language:Python 1.2%