bernardodionisi / differences

difference-in-differences in Python
https://bernardodionisi.github.io/differences/latest/
GNU General Public License v3.0
92 stars 19 forks source link
causal-inference difference-in-differences econometrics panel-data

<img src="./docs/logo/bw/logo_name_bw.png" alt="drawing" width="200" style="display: block;margin-left: auto;margin-right: auto;width: 80%;"/>

difference-in-differences estimation and inference for Python

For the following use cases

see the Documentation for more details.

NOTE: Please note that in v0.2.0 the .plot() methods have been temporarily removed as well the TWFE class. They will be added back to this library in a future release. Please refer to the Release Notes for a list of changes.

Installing

The latest release can be installed using pip

pip install differences

requires Python >= 3.9

Quick Start

ATTgt

the ATTgt class implements the estimation procedures suggested by Callaway and Sant'Anna (2021) , Sant'Anna and Zhao (2020) and the multi-valued treatment case discussed in Callaway, Goodman-Bacon & Sant'Anna (2021)

from differences import ATTgt, simulate_data

df = simulate_data()

att_gt = ATTgt(data=df, cohort_name='cohort')

att_gt.fit(formula='y')

att_gt.aggregate('event')

differences ATTgt benefited from