# Lecture 12: historical and current gender pay gaps

## Historical earnings

`gender_history.csv` uses the Census Bureau's
[Table P-20](https://www2.census.gov/programs-surveys/cps/tables/time-series/historical-income-people/p20.xlsx),
median annual earnings of workers aged 25 and over by sex and education.
The original workbook is saved as `source/p20.xlsx`, downloaded October 8,
2026. It includes income years through 2025; the classroom extract retains
1991–2024 to end in the same year as the ACS investigation. There are 204
rows: 34 years, two sexes, and three education groups (all workers,
bachelor's degree, master's degree). The lecture filters to the two degrees.

One row describes a year/sex/education group. `pay` is published median
annual earnings in thousands of that year's dollars. These include full-
and part-time workers. Run `Rscript course_design/prepare_gender_history.R`
from f26. Where the workbook reports two survey versions for a year
(2010, 2013, 2017), preparation retains the first, newer-methodology row.
No medians are calculated from the old group means or combined across degrees.
The F25 mean-earnings source remains unchanged in F25.

Source workbook SHA-256:
`c7d52097e0e57f76489b88bd99dc4d0d1cd92e450e500037da5b28dc4337cc4b`.

The female/male ratio is unchanged if both earnings amounts receive the
same annual inflation adjustment. This series measures annual earnings;
[Pew's headline estimate](https://www.pewresearch.org/short-reads/2025/03/04/gender-pay-gap-in-us-has-narrowed-slightly-over-2-decades/)
uses median hourly earnings among workers aged 16 and over.

## Current ACS workers

`gender_acs.csv` contains all 27,028 eligible person records from the national
2024 ACS one-year public-use file already downloaded for Lectures 10–11.
It uses Lecture 11's filters: currently employed civilian wage/salary
workers (ESR 1–2, COW 1–5), ages 25–50, computer/math occupations (SOCP starts
with 15), bachelor's or master's degree (SCHL 21–22), at least 35 usual
weekly hours and 50 weeks worked, positive wages and person weights.

Run `uv run --project course_design/skill_returns/acs python
course_design/prepare_gender_acs.py` from f26. The file retains every
eligible person and uses `pay = WAGP * ADJINC / 1000000 / 1000`, in thousands
of 2024 dollars. There is no trimming, sampling, or wage imputation.

```text
Column            Meaning
sex               SEX: 1 Male, 2 Female
age               AGEP: age in years
degree            SCHL: Bachelor's (21), Master's (22)
pay               Adjusted annual wage/salary income, $1,000 of 2024 dollars
hours             WKHP: usual weekly hours worked
weeks             WKWN: weeks worked in the previous 12 months
sector            Private (COW 1–2), Public (COW 3–5)
occupation_code   OCCP: Census occupation code
weight            PWGTP: person survey weight
```

[2024 ACS documentation](https://www.census.gov/programs-surveys/acs/microdata/documentation/2024.html)
defines the released fields. SEX records male/female sex categories; this
field does not record gender identity. Source archive checksums and extraction
metadata are in `course_design/skill_returns/acs/data/acs_2024.json`.

`gender_occupations.csv` supplies one label for each of the 16 occupation
codes present. These unchanged codes and labels are taken from the saved
Census 2018 ACS occupation list also used in Lecture 10's current-pay
preparation. The 2024 SOCP patterns for these codes agree with that list's
occupation families. Some codes describe several occupations together;
`Other mathematical science occupations` should not be relabeled as
data scientists alone. The optional exercise selects four named occupations
with more than 100 sampled men and women each.

## Classroom analysis

ACS descriptive earnings summaries use sample medians, with each respondent
receiving equal weight. Person weights remain available. The main age
investigation joins the occupation names and keeps software developers
with bachelor's degrees: 7,653 workers. Pooled median pay at ages 25–29
is $111,677.50 for each sex. At ages 40–49 it is $121,830 for women and
$159,394.25 for men. Keeping exactly 40-hour workers leaves the young
medians equal and gives an older-group gap of $30,965.125. Age-group
medians are computed from individual records.

The age regression uses the same 7,653 individual records with ordinary
lm(), which models mean pay. Its section explicitly switches to mean earnings and displays sample
means alongside the fitted lines. It does not estimate a median regression.
The interaction expresses two separate simple regressions; no general
many-predictor regression or quantile regression is introduced.

The earnings-distribution investigation returns to all 27,028 workers.
quantile() computes within-sex 10th and 90th percentiles; median() supplies
the 50th. Female p10/p50/p90 are $55,838.75/$101,525/$203,050; male values
are $60,915/$121,830/$253,812.50. These use R's default quantile method
and equal respondent weights. Students reshape the three percentile
columns for plotting. The corresponding dollar gaps are about
$5,076/$20,305/$50,763.

The historical CPS groups and the current ACS computer/math sample describe
different populations. They are analyzed separately. Age comparisons use
different workers observed in 2024, not repeated observations of the same
people. The hourly calculation divides annual pay by usual hours times
weeks worked and is an approximation. Regression coefficient tests use
ordinary lm() assumptions and do not estimate causal discrimination effects.
Keep this methodological context in presenter notes and oral discussion.
