labormarket is an R package for simulating worker-firm matched datasets and correcting limited mobility bias in two-way fixed effects models. It is designed as a teaching and research tool for labor economics.
Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("hugosantanna/labormarket")library(labormarket)
# Simulate a labor market with 6 firm types, 10 worker types, 4 periods, 100k workers
lm_obj <- simlabormarket(nk = 6, nl = 10, nt = 4, ni = 100000, lambda = 0.05)
# Access the panel data
panel <- lm_obj@panel
head(panel)After fitting a two-way fixed effects (AKM) model, use lmbias() to correct
the limited mobility bias following Azkarate-Askasua and Zerecero (2022):
library(fixest)
# Fit an AKM model
panel$fid <- as.factor(panel$fid)
panel$i <- as.factor(panel$i)
model <- feols(lw ~ 1 | i + fid, data = panel)
# Add predicted values
panel$xbeta <- predict(model, type = "link")
# Bootstrap bias correction
results <- lmbias(model, panel, R = 100)
print(results)- Azkarate-Askasua, M. and Zerecero, M. (2022). "The Macroeconomics of Firms' Financing."
MIT
