Skip to main content

Estimate two way fixed effect labor models

Project description

PyTwoWay

https://badge.fury.io/py/pytwoway.svg https://anaconda.org/tlamadon/pytwoway/badges/version.svg https://anaconda.org/tlamadon/pytwoway/badges/platforms.svg https://circleci.com/gh/tlamadon/pytwoway/tree/master.svg?style=shield https://img.shields.io/badge/doc-latest-blue https://badgen.net/badge//gh/pytwoway?icon=github

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 bias correction as in Kline, Saggio, and Sølvsten

  4. group fixed estimator as in Bonhomme, Lamadon, and Manresa

  5. group correlated random effect as presented in the main paper

If you want to give it a try, you can start an example notebook for the FE estimator here: binder_fe for the CRE estimator here: binder_cre and for the BLM estimator here: binder_blm. These start fully interactive notebooks with simple examples that simulate data and run the estimators.

The code is relatively efficient. Solving large sparse linear models relies on PyAMG. This is the code we use to estimate the different decompositions on US data. Data cleaning is handled by BipartitePandas.

The package provides a Python 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 via pip, from the command line run:

pip install pytwoway

Authors

Thibaut Lamadon, Assistant Professor in Economics, University of Chicago, lamadon@uchicago.edu

Adam A. Oppenheimer, Research Professional, University of Chicago, oppenheimer@uchicago.edu

Citation

Please use 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}
}

Development

If you want to contribute to the package, the easiest way is to use poetry to set up a local environment:

poetry install
poetry run python -m pytest

To push the package to PiP, increase the version number in the pyproject.toml file and then:

poetry build
poetry publish

Finally to build the package for conda and upload it:

conda skeleton pypi pytwoway
conda config --set anaconda_upload yes
conda-build pytwoway -c tlamadon --output-folder pytwoway

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

pytwoway-0.2.13.tar.gz (74.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytwoway-0.2.13-py3-none-any.whl (79.1 kB view details)

Uploaded Python 3

File details

Details for the file pytwoway-0.2.13.tar.gz.

File metadata

  • Download URL: pytwoway-0.2.13.tar.gz
  • Upload date:
  • Size: 74.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.11

File hashes

Hashes for pytwoway-0.2.13.tar.gz
Algorithm Hash digest
SHA256 02696e6e17b0cc5eca454174f5a4aac080161dc47187a554db835eaede6fb1f8
MD5 5654262a664b0d404b0bd7e8143c8574
BLAKE2b-256 48c1e749a7abfd32bd4e9f24ba114d633ff4ce14e289f31ba515983baa9ea1d6

See more details on using hashes here.

File details

Details for the file pytwoway-0.2.13-py3-none-any.whl.

File metadata

  • Download URL: pytwoway-0.2.13-py3-none-any.whl
  • Upload date:
  • Size: 79.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.11

File hashes

Hashes for pytwoway-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 f4acb32d1e811d4a6b5bd48aa2038e3c3b4afadb188561d62ad732e297cc24b6
MD5 89c4647a6e2183a036e09b89bc2852c4
BLAKE2b-256 6643a505a9f95ff3d8cdcdf7257274620c96ae13197256455bb735ad93daca17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page