Case study 07 · Regression · people analytics

Where thegap went

Is there a gender pay gap, and if so, where does it come from? I built the answer up one control at a time, so you can watch a +6.2% raw gap shrink to nothing once you compare like with like, and then checked where a gap could still be hiding.

Analysis projectPython · statsmodels · OLS · Oaxaca

DataIBM's HR dataset: 1,470 fictional employees. The method is the point, not the company.

1,470Employees
+6.2%Raw gap, women higher
−0.3%Gap with full controls
p = 0.77Not distinguishable from zero
Data flow · how a record moves

Employee records to a review list

Each stage narrows the question: from a raw gap, to a controlled gap, to the individuals worth a second look. Click a stage to read what happens there.

01 · Staged models

Add one control, watch the gap move

Each row is a regression of log pay on gender plus a growing set of controls. The dot is the gap (women vs men, %) and the line is its 95% interval. Job level does nearly all of the work: it takes R² from 0 to 0.87.

ErrorsBreusch–Pagan p < 1e-18, so the variance isn't constant. Intervals use HC3 robust errors.

02 · Decomposition

Explained versus unexplained

An Oaxaca–Blinder decomposition splits the raw difference (+5.99 log points) into the part explained by differences in job level, role and experience, and the part left over. Explained: +6.34. Unexplained: −0.35. Women here are paid more on average because they sit in slightly higher levels, not because of how pay is set within a level.

Read carefully"Unexplained" is not the same as "discrimination", and "explained" is not the same as "fair". It only says where the difference sits.

03 · Where a gap could hide

If level explains pay, who gets the levels?

Controlling for level is only fair if promotion is fair. At the top level, 24 of 69 people are women: 35%, against 40% in the whole company. The difference isn't significant (p = 0.11), and an ordered logit on level gives an odds ratio of 1.03 (0.84–1.28). Worth watching, not proven.

Women at level 5 · 24Men · 45
−0.5%R&D · 961 people
−0.4%Sales · 446
+3.0%HR · 63

Department gaps · all Holm-adjusted p = 1.00

Without levelDrop level from the model and the adjusted gap is −0.9% (−3.8 to +2.0). Still no significant gap either way.

04 · Robustness & action

Six specifications, one story

Across six reasonable model choices the adjusted gap stays between −1.0% and +0.2%. Then the useful output for HR: 200 individuals paid at least 20% below what the model predicts for their profile, a review list rather than a headline.

Women flagged12%
Men flagged15%

Difference p = 0.19 · 184 of the 200 sit in levels 1–2

PythonstatsmodelsOLS · HC3Oaxaca–BlinderOrdered logitHolmVIF

CollinearityMax VIF 3.1, but level and pay correlate at 0.95, which is why the level control dominates.