difference-in-differences estimation and inference in Python
Project description
difference-in-differences estimation and inference for Python
For the following use cases
- Balanced panels, unbalanced panels & repeated cross-section
- Two + Multiple time periods
- Fixed + Staggered treatment timing
- Binary + Multi-Valued treatment
- Heterogeneous treatment effects & triple difference
- One + Multiple treatments per entity
see the Documentation for more details.
Installing
The latest release can be installed using pip
pip install differences
requires Python 3.8+
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 treatement 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 benefitted substantially from the original authors' R packages: Callaway & Sant'Anna's did and Sant'Anna and Zhao's DRDID
TWFE
from differences import TWFE, simulate_data
df = simulate_data()
att_gt = TWFE(data=df, cohort_name='cohort')
att_gt.fit(formula='y')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
differences-0.1.2.tar.gz
(403.4 kB
view hashes)
Built Distribution
differences-0.1.2-py3-none-any.whl
(414.9 kB
view hashes)
Close
Hashes for differences-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0dfbcb1200cd3039b906bc5f75598b2c9b82324b27b5a6d44fd392dcf10c683 |
|
MD5 | 96018c3ad557a13446f9eb30c1fdca43 |
|
BLAKE2b-256 | 8cc52f9e9e197298492e63e71aeeed4ea365be959a56651c08adb599fc1c79d3 |