Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

pytwoway

https://travis-ci.com/tlamadon/pytwoway.svg?branch=master https://img.shields.io/badge/doc-latest-blue

pytwoway is the Python package associated with the following paper:

"How Much Should we Trust Estimates of Firm Effects and Worker Sorting?." by Stéphane Bonhomme, Kerstin Holzheu, Thibaut Lamadon, Elena Manresa, Magne Mogstad, and Bradley Setzler. No. w27368. National Bureau of Economic Research, 2020.

The package provides implementations for a series of estimators for models with two sided heterogeneity:

  1. two way fixed effect estimator as proposed by Abowd Kramarz and Margolis
  2. homoskedastic bias correction as in Andrews et al
  3. heteroskedastic correction as in KSS (TBD)
  4. a group fixed estimator as in BLM
  5. a group correlated random effect as presented in the main paper

If you want to give it a try, you can start the example notebook here: binder . This starts a fully interactive notebook with a simple example that generates data and runs the estimators.

The code is relatively efficient. Solving large sparse linear models relies on using pyamg. This is the code we used to estimate the different decompositions on the US data.

The package provides a python interface as well as an intuitive command line interface. Installation is handled by pip or conda (TBD). The source of the package is available on github at pytwoway. The online documentation is hosted here.

Quick Start

To install from pip, run:

pip install pytwoway

To run using the command line interface:

pytw --my-config config.txt --fe --cre

Example config.txt:

data = file.csv
filetype = csv
col_dict = "{'fid': 'your_firmid_col', 'wid': 'your_workerid_col', 'year': 'your_year_col', 'comp': 'your_compensation_col'}"

Citation

Please use the following citation to cite pytwoway in academic publications:

Bibtex entry:

@techreport{bhlmms2020,
  title={How Much Should We Trust Estimates of Firm Effects and Worker Sorting?},
  author={Bonhomme, St{\'e}phane and Holzheu, Kerstin and Lamadon, Thibaut and Manresa, Elena and Mogstad, Magne and Setzler, Bradley},
  year={2020},
  institution={National Bureau of Economic Research}
}

About

Two way models in python

Resources

License

Releases

No releases published

Packages

No packages published