Skip to main content

Estimate two way fixed effect labor models

Project description

pytwoway

Two way fixed effect models for labor in python

Full documentation can be found here.

Quick start:

To install from pip:

pip install pytwoway

To run using command line interface:

pytw --my-config config.txt --akm --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'}"

To run in Python:

  • If you have data
from pytwoway import twfe_network
tn = twfe_network.twfe_network
# Create twfe object
tw_net = tn.twfe_network(data, formatting, col_dict)
# Convert long data into event study data (not necessary if the data is already in event study format):
tw_net.refactor_es()
# Run the bias-corrected AKM estimator:
tw_net.run_akm_corrected(user_akm)
# Cluster firms based on their wage CDFs (required for the CRE estimator)
tw_net.cluster(user_cluster)
# Run the CRE estimator
tw_net.run_cre(user_cre)
  • If you want to simulate data
from pytwoway import sim_twfe_network
sn = sim_twfe_network.sim_twfe_network
# Create simulated twfe object
stw_net = sn(sim_params)
# Generate data
sim_data = stw_net.sim_network()
  • If you want to run Monte Carlo on simulated data
from pytwoway import sim_twfe_network
sn = sim_twfe_network.sim_twfe_network
# Create simulated twfe object
stw_net = sn(sim_params)
# Run Monte Carlo
stw_net.twfe_monte_carlo(N, ncore, akm_params, cre_params, cluster_params)
# Plot results
stw_net.plot_monte_carlo()

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytwoway-0.0.2.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for pytwoway-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5f9830c5da9ac163fc3dfa3fb36dc8733cd559da5b2babd11a8aeaeeae390df7
MD5 9b1fdf4fd7f7549b3931fb8b9bfd1583
BLAKE2b-256 dd170cc49d5dea173d3278ad861e1a091cc2db3da5060fbf0948c32e9419dd73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytwoway-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for pytwoway-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4082a6998b781206fcd6f68a5587b958ac47cd564668660a7ec64ae63a335ffd
MD5 e00a488abe1889f58f67025710a5d2e9
BLAKE2b-256 08a47b58b6c4166cfdb0be5c044c2c306be0382bdcf19567e075f8d0620114fa

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