Skip to content

Commit

Permalink
Integrate STATA code.
Browse files Browse the repository at this point in the history
  • Loading branch information
drarnau committed Sep 25, 2023
1 parent 32a87eb commit f029e3d
Show file tree
Hide file tree
Showing 45 changed files with 22,230 additions and 35 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ docs/site/
# committed for packages, but should be committed for applications that require a static
# environment.
Manifest.toml

# CSV files containing NLSY microdata passed to the model
/nlsy_data/*
111 changes: 95 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,113 @@
# RauhValladaresEsteban2023.jl
[This package](https://github.com/drarnau/RauhValladaresEsteban2023) solves the on-the-job human capital accumulation model with heterogeneity in the initial human capital endowment and the lifelong ability to accumulate human capital, and endogenous labor supply at the extensive and intensive margins in [_On the Black-White Gaps in Labor Supply and Earnings over the Lifecycle in the US_](https://arnau.eu/RaceGap.pdf) by [Christopher Rauh](https://sites.google.com/site/econrauh/) and [Arnau Valladares-Esteban](https://arnau.eu/).
[This package](https://github.com/drarnau/RauhValladaresEsteban2023) provides all codes to replicate the main exhibits of [_On the Black-White Gaps in Labor Supply and Earnings over the Lifecycle in the US_](https://arnau.eu/RaceGap.pdf) by [Christopher Rauh](https://sites.google.com/site/econrauh/) and [Arnau Valladares-Esteban](https://arnau.eu/).

## Documentation
The user needs to download the raw data from the [National Longitudinal Survey of the Youth 1979](https://www.nlsinfo.org/content/cohorts/nlsy79) and store it in the folder `stata/` following the naming details in `stata/main.do`.

## `produce_exhibits.jl`
Produces all the figures and tables displayed below and reported in the paper.

## Model Documentation
[![Docs][docs-img]][docs-url]

[docs-img]: https://img.shields.io/badge/docs-stable-blue.svg
[docs-url]: https://drarnau.github.io/RauhValladaresEsteban2023.jl/

## `produce_exhibits.jl`
Produces all the figures and tables displayed below and reported in the paper.
#### Figure 1: Employment, hours worked, cumulative experience, and annual earnings over the lifecycle by Black and White men
![](figures/d_employed_hours_exp_earnings.png)

#### Table 1: Test of parallelism in earnings experience profiles between Black and White men
See `stata/main.do`.

#### Figure 2: Mean annual earnings over the lifecycle for Black and White men that do not experience any non-employment spell
![](figures/d_earnings_byage_byhours.png)

#### Figure 3: Distribution of AFQT deciles by race
![](figures/d_afqt_distribution.png)

### Model simulated wages (using data labour supply) vs. data
#### Figure 4: Hourly earnings conditional on working by race for AFQT deciles over the lifecycle
![](figures/d_hearnings_byagroups.png)

#### [Table 2: Regressing hourly earnings conditional on working on race and cumulative labor market experience for AFQT deciles 1-5](tables/hearnings_1.pdf)
<object data="tables/hearnings_1.pdf" type="application/pdf" width="100%">
<embed src="tables/hearnings_1.pdf">
<p>The PDF cannot be displayed in the GitHub README file. Please click here to view it: <a href="tables/hearnings_1.pdf">View PDF</a>.</p>
</embed>
</object>

#### Figure 5: Employment rates over the lifecycle by race and AFQT deciles
![](figures/d_employed_byagroups.png)

#### Figure 6: Mean hourly wages over the lifecycle conditional on working by AFQT/ability decile (data vs. model)
![](figures/mvsd_wage_dataLS.png)

### Model simulated hours vs. data
![](figures/mvsd_hours_Black.png)
![](figures/mvsd_hours_White.png)
### Figure 7: Hours worked over the lifecycle conditional on employment for AFQT/ability groupings by race (data vs. model)
![](figures/mvsd_hours_Black_1.png)
![](figures/mvsd_hours_White_1.png)

### Model simulated employment vs. data
![](figures/mvsd_employed_Black.png)
![](figures/mvsd_employed_White.png)
#### Figure 8: Employment rates over the lifecycle by AFQT/ability decile (data vs. model)
![](figures/mvsd_employed_Black_1.png)
![](figures/mvsd_employed_White_1.png)

### Model racial gaps over the life cycle vs. data
#### [Table 5: How racial gaps respond to assigning characteristics of White men to Black men](tables/counterfactuals.pdf)
<object data="tables/counterfactuals.pdf" type="application/pdf" width="100%">
<embed src="tables/counterfactuals.pdf">
<p>The PDF cannot be displayed in the GitHub README file. Please click here to view it: <a href="tables/counterfactuals.pdf">View PDF</a>.</p>
</embed>
</object>

#### Figure 9: Racial gaps over the lifecycle in the data: benchmark and counterfactual of equal initial conditions
| Hourly Wage | Employment |
|:-----------------------------:|:---------------------------------:|
| ![](figures/mvsdcf_wage.png) | ![](figures/mvsdcf_employed.png) |

### [Counterfactual experiments](tables/counterfactuals.pdf)
<object data="tables/counterfactuals.pdf" type="application/pdf" width="100%">
<embed src="tables/counterfactuals.pdf">
<p>The PDF cannot be displayed in the GitHub README file. Please clik here to view it: <a href="tables/counterfactuals.pdf">View PDF</a>.</p>
#### Figure B.1: Annual (left) and hourly (right) log labor income over the lifecycle
![](figures/d_logearnings.png)

#### [Table B.1: Regressing hourly earnings conditional on working on race and cumulative labor market experience by AFQT deciles](tables/hearnings_2.pdf)
<object data="tables/hearnings_2.pdf" type="application/pdf" width="100%">
<embed src="tables/hearnings_2.pdf">
<p>The PDF cannot be displayed in the GitHub README file. Please click here to view it: <a href="tables/hearnings_2.pdf">View PDF</a>.</p>
</embed>
</object>

#### Figure B.2: Hours worked conditional on working by race for AFQT deciles over the lifecycle
![](figures/d_hours_byagroups.png)

#### Figure B.3: Mean annual earnings over the lifecycle conditional on working for Black and White men that experience no non-employment spells, by education groups
![](figures/d_earnings_byedu.png)

#### Figure B.4: Mean annual earnings by cumulative hours worked conditional on working for Black and White men that experience no non-employment spells, by education groups
![](figures/d_earnings_byedu_byhours.png)

#### Figure B.5: AFQT score distributions by race and education (absolute)
![](figures/d_afqt_distribution_byedu_abs.png)

#### Figure B.6: AFQT score distributions by race and education (relative)
![](figures/d_afqt_distribution_byedu_rel.png)

#### Figure B.7: Hourly wages conditional on working for AFQT score groupings by race over the lifecycle for men without non-employment spells
![](figures/d_hearnings_byagroups_alwaysE.png)

#### Figure B.8: Mean individual fixed effect (left) and experience effect (right) for hourly wage by race and AFQT decile
![](figures/d_hearnings_FE.png)

#### Figure B.9: Distribution of individual fixed effects (left) and experience effects (right) for hourly wage by race and AFQT decile
![](figures/d_hearnings_FE_distribution.png)

#### Figure B.10: Mean hourly wages at age 23
![](figures/d_hearnings0_bydeciles.png)

#### Figure B.11: Mean hourly wages at age 23 for Blacks and Whites
![](figures/d_hearnings0_bydeciles_byrace.png)

#### Figure B.12: Yearly earnings for AFQT/ability groupings by race over the lifecycle (data vs. model
![](figures/mvsd_wage_Black_1.png)
![](figures/mvsd_wage_White_1.png)

#### Figure B.13: Employment rates for AFQT/ability deciles 5-10 by race over the lifecycle (data vs. model
![](figures/mvsd_employed_Black_2.png)
![](figures/mvsd_employed_White_2.png)

#### Figure B.14: Hours worked conditional on working for AFQT/ability deciles 5-10 by race over the lifecycle (data vs. model)
![](figures/mvsd_hours_Black_2.png)
![](figures/mvsd_hours_White_2.png)
Binary file added figures/d_afqt_distribution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_afqt_distribution_byedu_abs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_afqt_distribution_byedu_rel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_earnings_byage_byhours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_earnings_byedu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_earnings_byedu_byhours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_employed_byagroups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_employed_hours_exp_earnings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hearnings0_bydeciles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hearnings0_bydeciles_byrace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hearnings_FE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hearnings_FE_distribution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hearnings_byagroups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hearnings_byagroups_alwaysE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_hours_byagroups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/d_logearnings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed figures/mvsd_employed_Black.png
Binary file not shown.
Binary file added figures/mvsd_employed_Black_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/mvsd_employed_Black_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed figures/mvsd_employed_White.png
Binary file not shown.
Binary file added figures/mvsd_employed_White_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/mvsd_employed_White_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed figures/mvsd_hours_Black.png
Binary file not shown.
Binary file added figures/mvsd_hours_Black_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added figures/mvsd_hours_Black_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed figures/mvsd_hours_White.png
Diff not rendered.
Binary file added figures/mvsd_hours_White_1.png
Binary file added figures/mvsd_hours_White_2.png
Binary file added figures/mvsd_wage_Black_1.png
Binary file added figures/mvsd_wage_Black_2.png
Binary file added figures/mvsd_wage_White_1.png
Binary file added figures/mvsd_wage_White_2.png
Binary file modified figures/mvsd_wage_dataLS.png
49 changes: 30 additions & 19 deletions produce_exhibits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ using RauhValladaresEsteban2023
using StatsBase
using Tectonic

## Run data work in Stata
run(`stata -q do stata/main.do`)

# Compile LaTeX tables
for i 1:2
tectonic() do bin
run(`$bin tables/hearnings_$i.tex`)
end
end

## Define race groups and load parameters for each group
groups = ["Black", "White"]
p = Dict(r => generateparameters(r) for r groups)
Expand All @@ -28,28 +38,29 @@ plotmvsd(:wage,
)
png("figures/mvsd_wage_dataLS")

## Model simulated hours and employment vs. data
## Model simulated hours employment, and wage vs. data
# Simulate model microdata for both groups
benchmarkmd = Dict(r => solvemodel(p[r]) for r groups)

# Define ability groupings
groupings = [1, 2, 3, 4, 5:10]

for r groups
# Create vector of subplot titles
spttls = ["$r Ability Decile $i" for i groupings]

# Plot hours and employment rates
for s [:hours, :employed]
plotmvsd(s,
groupingmean(groupings, statsfbyage(mean, benchmarkmd[r]), p[r]),
statsfbyage(mean, catmicrodata(groupings, nlsymd[r])),
de = statsfbyage(sterror, catmicrodata(groupings, nlsymd[r])),
haxis = p[r].agerange,
spttls = spttls,
ylms = (0, 1.1)
)
png("figures/mvsd_$(string(s))_$r")
# Iterate over ability groupings
for (ig, groupings) enumerate([[1, 2, 3, 4, 5:10], [5, 6, 7, 8, 9, 10]])
for r groups
# Create vector of subplot titles
spttls = ["$r Ability Decile $i" for i groupings]

# Plot hours and employment rates
for s [:hours, :employed, :wage]
plotmvsd(s,
groupingmean(groupings, statsfbyage(mean, benchmarkmd[r]), p[r]),
statsfbyage(mean, catmicrodata(groupings, nlsymd[r])),
de = statsfbyage(sterror, catmicrodata(groupings, nlsymd[r])),
haxis = p[r].agerange,
spttls = spttls,
ylms = (0, (s == :hours ? 1 : Inf)),
lyt = (1, length(groupings))
)
png("figures/mvsd_$(string(s))_$(r)_$(ig)")
end
end
end

Expand Down
Loading

0 comments on commit f029e3d

Please sign in to comment.