Skip to main content

Estimate two way fixed effect labor models

Project description

PyTwoWay

https://badge.fury.io/py/pytwoway.svg https://circleci.com/gh/tlamadon/pytwoway/tree/master.svg?style=shield 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 PyAMG. This is the code we use to estimate the different decompositions on 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 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'}"

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

Easiest is to use poetry to set up a local environment:

poetry install poetry shell python -m pytest

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytwoway-0.1.7.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.5 Linux/5.8.0-53-generic

File hashes

Hashes for pytwoway-0.1.7.tar.gz
Algorithm Hash digest
SHA256 96acc3214eca7d5aa2ab9cc6df942dcf72f9b00b3b0d18320e5d80594ced3f00
MD5 e1a8b9455b6331f251050776cfde4475
BLAKE2b-256 81d2b64c3001b5d7cac054f912e72dcca48a7c4f65e242f13b6ca1034d2b4c50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytwoway-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 44.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.5 Linux/5.8.0-53-generic

File hashes

Hashes for pytwoway-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1ad64f85292f938e451e7e9853f36cf5ff1006f4ab85393427c3b12939832a02
MD5 921e2b4d235c6410776fd9f177d09f96
BLAKE2b-256 ecac355b77b19f926afd2f61f1f45651856b46f1f6ed782849853f56e662b44d

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