Skip to content

bernardodionisi/differences

Repository files navigation

drawing

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
  • Parallelized estimation & multiplier bootstrap (joblib, via n_jobs)

see the Documentation for more details.

Installing

The latest release can be installed using pip

pip install differences

requires Python >= 3.10

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)

import differences

df = differences.generate_data()  # requires the [all] extra: pip install differences[all]

att_gt = differences.ATTgt(data=df, cohort_column='cohort')

att_gt.fit(formula='y', n_jobs=-1)

att_gt.aggregate('event')

differences ATTgt was inspired by

  • Callaway & Sant'Anna's did
  • Sant'Anna and Zhao's DRDID

Packages

 
 
 

Contributors

Languages