Contents/ Part XXX · Capstone Projects: Regression/ Chapter 186

Multiple Regression Done Properly: A Pay Equity Review

Capstone 25. The raw gap is 14.4 percent. Add every control and it is 2.3. Both numbers are correct, they answer different questions, and the control doing most of the work is the one that should never be added without an argument.

⏱️ ~21 min read
🎯 Multiple regression
📊 Chapter 186

Part XXIX was about designing your way to a causal answer. This part is about the craft of the model itself, and it starts with the decision that regression makes easiest to get wrong: which variables belong on the right-hand side.

The brief
Setting
A company's HR system: 3,600 employee records with gender, age, years of experience, education, department, job level, most recent performance rating and annual salary.
The question
Are women paid less than men at this company, and if so, by how much?
Why it matters
The answer goes into a regulatory filing and possibly into litigation. It will be read by people who want a single number, and quoted by people who want a small one.
What we do
Model log pay, add controls one at a time so every step is visible, measure the collinearity among the career variables and show exactly what it does, then stop before the most powerful control and ask whether the company assigns it equally before deciding whether it belongs in the model at all.
A control variable that is itself affected by the exposure is a mediator, not a confounder. Adjusting for a confounder removes bias. Adjusting for a mediator removes part of the effect you are trying to measure, and the regression output looks identical either way.
The finding, up front

Unadjusted, women earn 14.4 percent less. Experience, education and department take that to 8.1 percent. Job level alone takes it to 2.3 percent. But at equal experience, education, performance and department, women's odds of reaching level 4 or above are 43 percent lower, so job level is carrying the very thing the review is looking for.

1

Two Questions, Not One

The most common failure in a pay equity review is producing a single number. There are two, they mean different things, and either one on its own is an answer to a question somebody else asked.

 The unadjusted questionThe adjusted question
AsksWhat do women in this company earn, against what men earn?Among people doing similar work with similar backgrounds, what is the difference?
DescribesThe workforce as it actually isHow individuals are paid within a grade
Used forReporting, and asking why the distribution looks like thatPay-setting policy, and individual review
Fails whenQuoted as evidence about individual pay decisionsQuoted as the company's pay gap

Both get reported. Neither is "the" pay gap, and the analysis plan for this review said so in writing before the salary file was opened, alongside one further commitment: we will not control for a variable the company itself assigns unless we have checked whether it is assigned equally.

2

Cleaning, and One Decision Worth Defending

StepRecordsWhat happened
HRIS export3,648The extract ran twice
After deduplication3,600One row per employee
Salaries of zero voided3,591Nine payroll errors, not nine unpaid employees
Experience sentinels voided3,569Twenty-two records carried −1, which is not a tenure
Missing performance ratings69 keptFilled with the median and flagged with an indicator

That last row is the decision worth defending. Dropping the sixty-nine people with no review on file would have silently changed who the study is about, and people without a recent review are not a random sixty-nine. Filling the rating with the median and adding a perf_missing indicator keeps them in the analysis and keeps the fill visible to the model, so the coefficient on the indicator can tell you whether those employees differ.

3

The Specification Ladder

The outcome is the log of salary, so coefficients read as approximate percentage differences. Controls go in one at a time, because anyone can produce a small number by adding enough variables and the honest presentation is to show the number moving.

SpecificationEstimated gap95% interval
Unadjusted−14.36%
+ experience−10.25%[−11.92%, −8.55%]0.261
+ education−10.44%[−12.05%, −8.80%]0.309
+ department−8.10%[−9.64%, −6.54%]0.415
+ performance−8.10%[−9.58%, −6.61%]0.468
+ job level−2.31%[−3.08%, −1.53%]0.875

Read the last row against the one above it. Experience, education, department and performance between them take the gap from 14.4 percent to 8.1. Job level alone takes it from 8.1 to 2.3, and the R-squared leaps from 0.47 to 0.88. One variable is doing more work than all the others combined, and it happens to be the only variable on the list that the company assigns to people.

Notice also that performance changed nothing at all. Men and women in this workforce are rated the same, which is worth reporting: it removes one common explanation before anybody offers it.

Left: six bars showing the estimated pay gap under successive specifications, falling from minus 14.4 percent unadjusted to minus 10.2 with experience, minus 10.4 with education, minus 8.1 with department, minus 8.1 with performance, and minus 2.3 once job level is added. The last bar is highlighted and annotated one variable, most of the movement. Right: grouped bars of the share of each gender at each job level. Women are 31.7 percent at level 1 against men's 20.8, and 2.6 percent at level 6 against men's 6.2, annotated that the odds of reaching level 4 or above are 43 percent lower for women at equal experience and rating.
Left: the gap under each successive specification. The first four controls explain about six points between them; job level alone explains almost six more. Right: why that is.
4

Collinearity, and What It Actually Does

Age, experience and job level all measure roughly one underlying thing: how far into a career somebody is. Age and experience correlate at 0.829 here, which is unremarkable for a real workforce and enough to matter.

VIF, age
3.21
with all four in
VIF, experience
3.45
with all four in
VIF, experience
1.22
after dropping age
Threshold
None
5 and 10 are conventions

A VIF of 3.4 violates nothing. The thresholds people quote, 5 or 10, are conventions rather than rules, and the practical consequence is easier to see by looking directly at what happens when both variables go in.

ModelExperienceAgeThe gender coefficient
Experience only+0.01060 (SE 0.00043)−0.0234 (SE 0.0040)
Age only+0.00705 (SE 0.00036)−0.0273 (SE 0.0041)
Both+0.01013 (SE 0.00072)+0.00048, p = 0.41−0.0234 (SE 0.0040)

Two things happen, and only one of them is what people expect. Putting both in inflates the standard error on experience by about two thirds, and leaves age with nothing left to explain. What does not happen is any movement in the coefficient we care about: the gender gap sits at −0.0234 either way.

The rule that follows

Collinearity between two controls damages the estimates of those controls and leaves the rest of the model alone. If neither age nor experience is the quantity of interest, high VIFs among them are a reason to simplify for interpretability, not a threat to the finding. Panic about multicollinearity is usually misdirected: the question is never "is the VIF above 5", it is "is the variable whose standard error just doubled the one I am trying to measure".

We keep experience and drop age, because experience is what the company's pay policy claims to reward, and a coefficient the reader can map onto a policy is worth more than one they cannot.

5

The Control That Should Not Be Added Without an Argument

Job level took the gap from 8.1 percent to 2.3. Before accepting that as the adjusted answer, ask what job level is. It is not a fact about an employee, like their education. It is a decision the company made about them.

If women are promoted more slowly than their experience and performance warrant, then job level is partly a result of unequal treatment. Controlling for it asks whether people are paid fairly once they have arrived at a grade, and treats how they arrived as fixed. That is a legitimate question. It is not the same question, and the regression output looks identical whichever it is answering.

Gender Job level assigned by the company Pay THE PROMOTION PATH odds of level 4+ are 43% lower THE WITHIN-LEVEL PATH −2.3% at the same grade controlling for job level closes this path The unadjusted 14.4% contains both. The adjusted 2.3% contains only the lower one. Reporting only the adjusted figure deletes the larger finding.
Two paths, and adjustment closes one of them. A confounder sits before the exposure and adjusting for it removes bias. A mediator sits after it, and adjusting for it removes part of the effect. The arithmetic is identical; only the causal story tells you which you have.

So the plan required checking. At equal experience, education, performance rating and department, what are the odds of an employee sitting at level 4 or above?

Odds ratio, women
0.569
95% CI [0.482, 0.671]
In words
43% lower
odds of reaching senior grades
p-value
2 × 10⁻¹¹
not a marginal finding
Level 6
2.6% vs 6.2%
share of women vs men

This is the finding the adjusted model deletes. Women are 43 percent less likely to sit at senior grades than men who look identical on everything the company says it promotes on. A report giving only the 2.3 percent figure would be arithmetically correct and would leave the mechanism producing most of the gap entirely unmentioned.

6

An Average That Describes Nobody

The 2.3 percent is itself an average across the whole company, and the plan asked in advance whether the within-level gap is the same at every level. It is not.

Job levelsWithin-level gapAgainst the single average of −2.3%
1 to 2−1.39%The average overstates it by two thirds
3 to 4−4.45%Nearly twice the average
5 to 6−5.68%Two and a half times the average

The test that the gap is constant across levels returns p = 0.0012, so that pattern is not noise. Quoting 2.3 percent to a woman at level 5 would understate her position by more than half, and quoting it to a woman at level 1 would overstate hers. An average is a summary of a distribution, and it is only a good summary when the distribution has one mode.

Left: the within-level pay gap by group of job levels with 95 percent intervals. Levels 1 to 2 show minus 1.4 percent, levels 3 to 4 minus 4.5 percent, levels 5 to 6 minus 5.7 percent, against a dashed line marking the single averaged figure of minus 2.3 percent. Right: a scatter of annual salary against years of experience with separate fitted curves for men and women, the two curves diverging as experience increases.
Left: the gap by seniority, with intervals, against the single averaged figure as a dashed line. Right: the same story visible without any model, in the unadjusted relationship between pay and experience.
7

Diagnostics, and How to Read a Screening Rule

Residual SD
0.1161
on the log scale
Skewness
+0.050
symmetric
Breusch-Pagan
p = 0.445
constant variance
Largest Cook's D
0.0070
concern starts near 0.5

All three pass, and the influence line needs reading carefully rather than quoting. One hundred and seventy observations exceed the familiar 4/n cutoff, which sounds alarming and is not. 4/n is a screening rule, not a threshold for concern: in a sample of 3,569 it flags roughly the top few percent by construction, whatever the data look like. The number that matters is the magnitude, and the largest Cook's distance here is 0.007 against conventional cause for concern at 0.5. No single employee is moving this model.

Chapter 187 is about what to do when these checks fail, which they do more often than published papers suggest. Here they pass, and verifying that is worth the four lines it costs.

8

What to Actually Report

Three numbers, each with a sentence saying what it means. Not one number, and not three numbers offered as alternatives for the reader to choose between.

ReportFigureThe sentence that has to go with it
The workforce gap−14.4%What women at this company earn against what men earn. It reflects who holds which jobs, not what any individual is paid for the same work.
The promotion gapOdds 0.569At equal experience, education, performance and department, women are 43 percent less likely to hold a senior grade. This is where most of the workforce gap comes from.
The within-grade gap−1.4% to −5.7%At the same grade, women are paid slightly less, and the difference grows with seniority.

Presented that way, the company has a clear picture and a clear place to look. Presented as "our adjusted pay gap is 2.3 percent", it has a defensible-sounding number and no idea where its problem is.

9

What to Watch

10

Specification Choices in Data Science & AI

Where it appearsThe same decision, in a different costume
Feature selection for modelsAdding a feature that the model's own past decisions produced, so the model learns to reproduce them
Fairness auditingDeciding which attributes to condition on, where conditioning on a proxy for the protected attribute hides the disparity
Credit and hiring modelsJob title, seniority or prior salary as features, each of which can carry historic discrimination forward
Uplift and marketing modelsControlling for engagement that the campaign itself produced
Any regression with an ML pipelineAutomated feature selection makes the mediator decision silently and at scale, with no analyst to argue with
Where the research went

The mediator problem has a precise name in the causal literature: conditioning on a post-treatment variable, treated formally by Rosenbaum in 1984 and now standard in Pearl's graphical framework, where the rule is simply that you do not condition on a descendant of the exposure. The decomposition into direct and indirect effects is the subject of causal mediation analysis, which gives estimators for exactly the two paths this chapter separates by hand. On the applied side, the Oaxaca-Blinder decomposition is the economist's standard tool for splitting a gap into an explained and an unexplained part, and it inherits the same difficulty: what counts as explained depends entirely on which variables you were willing to put in.

🐍

The full project, step by step

The companion notebook reads the plan before the salary file, cleans the export and keeps the employees with no review on file, builds the specification ladder with an interval at every rung, shows what collinearity does to the standard errors and what it leaves alone, fits the promotion model that job level was concealing, tests the interaction across levels, and closes with the diagnostics and how to read a screening rule.

📓 View Notebook (code & outputs) ▶ Open in Colab ⬇ View / Download on GitHub
Read the reports & get the data

The dataset (capstone-pay-equity-review.xlsx) holds 3,648 HR records with their duplicate export, payroll zeros, experience sentinels and missing reviews intact, the analysis plan agreed before the salary file was opened, and the parameters that generated the data so every estimate can be checked. Two written reports accompany it: a plain-language brief for the HR director who has to act on it, and a technical report written to survive an opposing expert.

🎓 Key Takeaways

  • A pay gap has two honest answers. The workforce gap is 14.4 percent and the within-grade gap is 2.3, and each is the wrong answer to the other's question.
  • Adjusting for a mediator deletes the effect. Job level took the gap from 8.1 to 2.3 because women are 43 percent less likely to hold senior grades at equal experience and rating.
  • Collinearity hurts the collinear variables. Age and experience together inflated experience's SE by two thirds and left the gender coefficient at −0.0234 exactly.
  • Test the interaction before averaging. The within-level gap runs from −1.4 percent at junior grades to −5.7 at senior ones, p = 0.0012.
  • 4/n is a screening rule, not a verdict. A hundred and seventy points cleared it and the largest Cook's distance was 0.007.

Quiz: Test Yourself