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 correction as in KSS

  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 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 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 via pip, from the command line run:

pip install pytwoway

To run PyTwoWay via the command line interface, from the command line run:

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

Example config.txt:

data = file.csv
filetype = csv
col_dict = "{'i': 'your_workerid_col', 'j': 'your_firmid_col', 'y': 'your_compensation_col', 't': 'your_year_col'}"

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.1.24.tar.gz (48.5 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.1.24-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytwoway-0.1.24.tar.gz
  • Upload date:
  • Size: 48.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for pytwoway-0.1.24.tar.gz
Algorithm Hash digest
SHA256 31795d0b876c0a65e5dd096ea6269fe1b7048b59ff5a75ba790826738d913f83
MD5 7a513e4b63c236e14f8e1678dd6fbbcc
BLAKE2b-256 f30c45dd7c824006c2adb4ce0965c72997fd65ee43da0c4bd96c642842563375

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytwoway-0.1.24-py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11

File hashes

Hashes for pytwoway-0.1.24-py3-none-any.whl
Algorithm Hash digest
SHA256 9287b523751a21d1713bca48370dada093c0daff8a6c529fa43c4e4914ddb9d0
MD5 dd2da0117d9a185a28d88a0fae982422
BLAKE2b-256 9f16d2acc72af407310fd724b730e11b7b75f8d8b0c91ba43657e5a52f19792d

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