Exercise: Causal Reasoning and the Gender Wage Gap

causal-inference
statistics
R
exercise
MA
Practice DAG-based causal reasoning using a three-model regression progression on the gender wage gap — identify confounders and mediators, interpret coefficient changes, and specify a DAG in dagitty.
Author

Claudius Gräbner-Radkowitsch

Published

June 16, 2026

Modified

June 16, 2026

TipBefore you start

This exercise accompanies the Causal Reasoning with DAGs tutorial. Work through that page first.

Data: morg-2014-emp.csv — CPS MORG 2014. Download from gabors-data-analysis.com and place in a data/ subfolder.

Business question: Is there a gender wage gap — and what would it take to interpret a regression coefficient as evidence of discrimination?


1 Setup

Code
library(tidyverse)
library(broom)
library(modelsummary)
library(flextable)
library(dagitty)
library(ggdag)

raw <- read_csv("data/morg-2014-emp.csv", show_col_types = FALSE)

cps <- raw |>
  filter(
    !is.na(earnwke), earnwke > 0,
    !is.na(uhours),  uhours  > 0,
    !is.na(occ2012), !is.na(grade92),
    !is.na(age), !is.na(sex)
  ) |>
  mutate(
    wage   = earnwke / uhours,
    female = as.integer(sex == 2),
    educ   = grade92,
    occ    = factor(occ2012)
  ) |>
  filter(wage > 0, wage < 500) |>
  select(wage, female, age, educ, occ)

2 Task 1: Explore the Raw Gap

Summarise median and mean hourly wages by gender. Then produce a density plot of log wages by gender.

Code
# summary table
Code
# density plot

1a. What is the raw gender wage gap in percentage terms?

Your answer:

1b. Why is it not appropriate to interpret this raw difference as evidence of pay discrimination?

Your answer:


3 Task 2: The Three-Model Progression

Fit the following three models with log(wage) as the outcome:

Code
m1 <- lm(log(wage) ~ female,                    data = cps)
m2 <- lm(log(wage) ~ female + age + educ,        data = cps)
m3 <- lm(log(wage) ~ female + age + educ + occ,  data = cps)

Display them in a single table:

Code
# modelsummary(...)

2a. The female coefficient moves from Model 1 to Model 2 to Model 3. Describe the direction and magnitude of each change.

Your answer:

2b. The gap grows from Model 1 to Model 2. What explains this counterintuitive result? (Hint: look at how education is distributed across genders.)

Your answer:

2c. Model 3 shows the smallest gap. Does this mean Model 3 is the most accurate estimate of discrimination? Explain.

Your answer:


4 Task 3: Causal Reasoning about Occupation

3a. Is occupation a confounder, a mediator, or a collider in the relationship between gender and wages? Justify your answer by checking each definition: does occupation affect wages? Is it affected by gender?

Your answer:

3b. What happens to the estimated gender–wage coefficient when we control for a mediator? Select the correct statement and explain it:

  1. The coefficient becomes more accurate — controlling for mediators removes confounding
  2. The coefficient estimates a different, narrower quantity — the direct pay gap within occupational categories
  3. The coefficient becomes less accurate because we have added too many controls

Your answer:

3c. Describe one variable that would be a genuine confounder in the gender–wage relationship (not occupation). What is the expected direction of the bias if it is omitted?

Your answer:

3d. Specify the gender wage gap DAG in dagitty and query the adjustment sets for two different questions:

Code
# gap_dag <- dagitty("dag { ... }")

# Q1: total effect of Gender on Wage
# adjustmentSets(gap_dag, exposure = "Gender", outcome = "Wage")

# Q2: causal effect of Occupation on Wage
# adjustmentSets(gap_dag, exposure = "Occupation", outcome = "Wage")

Interpret both results. Why does the adjustment set differ across the two questions?

Your answer:


5 Task 4: Write an Analytical Narrative

Write a coherent paragraph for each of the three models. For each, state: (i) what the coefficient on female estimates, (ii) the key assumption required to interpret it causally, and (iii) why that assumption may or may not hold.

Use a {.callout-important} block to flag the key caveat about Model 3.

Your narrative:


6 Bonus: Alternative Causal Setting

Consider a firm analysing whether advertising spend causes higher sales revenue.

B1. Sketch a DAG for this relationship. What variable(s) might confound it?

B2. Is product quality a confounder or a mediator in the advertising–sales relationship? Justify your answer.

B3. A manager proposes adding manager experience as a control because “experienced managers spend more on advertising and also run better firms.” Is this a good idea? Draw the corresponding DAG.

B4. What research design would be needed to establish that advertising causes sales? Why can observational regression alone not answer this question?

Your answers:

Citation

BibTeX citation:
@inreference{graebner2026-exercise-gender-wage-gap-dags,
  author = {Gräbner-Radkowitsch, Claudius},
  editor = {Gräbner-Radkowitsch, Claudius},
  title = {Exercise: {Causal} {Reasoning} and the {Gender} {Wage} {Gap}},
  booktitle = {Method and Inquiry},
  date = {2026-06-16},
  url = {https://euf-methodology-hub.netlify.app/resources/exercise-gender-wage-gap-dags},
  langid = {en}
}
For attribution, please cite this work as:
Gräbner-Radkowitsch, Claudius. 2026. “Exercise: Causal Reasoning and the Gender Wage Gap.” In Method and Inquiry, edited by Claudius Gräbner-Radkowitsch. June 16. https://euf-methodology-hub.netlify.app/resources/exercise-gender-wage-gap-dags.