Fairness Metrics: Demographic Parity, Equalized Odds, and Trade-offs › Worked Example: Calculating Group Fairness Metrics

Michael BrenndoerferMarch 16, 20263 min read
Language AI HandbookAll chapters
Part 58 of 67Bias and Fairness
Chapter 444Fairness Metrics: Demographic Parity, Equalized Odds, and Trade-offs › Worked Example: Calculating Group Fairness Metrics
Reading section 3 of 13 · Worked Example: Calculating Group Fairness Metrics · 3 minSection 3 of 13 · 3 min

Book contents

Section 3 of 13 · 3 min read

Fairness Metrics: Demographic Parity, Equalized Odds, and Trade-offs › Worked Example: Calculating Group Fairness MetricsOne section · Sections in this chapter3 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Let's build intuition with a concrete example. Imagine a simplified hiring classifier that predicts whether a candidate will be hired (Y^=1\hat{Y} = 1) for two demographic groups. We will compute each fairness metric by hand to make the relationships concrete.

Suppose we have the following data, recorded as a confusion matrix split by group:

Confusion matrix split by group for a hiring classifier.
GroupTrue labelPredictedCount
A=0Y=1Ŷ=140
A=0Y=1Ŷ=010
A=0Y=0Ŷ=120
A=0Y=0Ŷ=030
A=1Y=1Ŷ=115
A=1Y=1Ŷ=025
A=1Y=0Ŷ=15
A=1Y=0Ŷ=055

From this table we can compute all the rates:

  • Group 0 (100 total, 50 truly positive): positive prediction rate = (40+20)/100 = 60%, TPR = 40/50 = 80%, FPR = 20/50 = 40%, Precision = 40/60 = 67%
  • Group 1 (100 total, 40 truly positive): positive prediction rate = (15+5)/100 = 20%, TPR = 15/40 = 37.5%, FPR = 5/60 = 8.3%, Precision = 15/20 = 75%

Computing the fairness metrics:

  • DPD = 0.20 - 0.60 = -0.40. Group 1 is selected at a rate 40 percentage points lower than group 0.
  • DPR = 0.20 / 0.60 = 0.33. Well below the EEOC four-fifths threshold of 0.80; this would constitute adverse impact.
  • Equal opportunity difference = |0.375 - 0.80| = 0.425. Among truly qualified candidates, group 1 is identified at a rate 42.5 percentage points lower. Qualified group 1 candidates are being passed over at a dramatically higher rate.
  • Equalized odds difference = max(|0.083 - 0.40|, |0.375 - 0.80|) = max(0.317, 0.425) = 0.425. The larger disparity drives the equalized odds metric, coming from the TPR gap.
  • Predictive parity difference = |0.75 - 0.67| = 0.08. Precision is close but not identical; a positive prediction for group 1 is slightly more reliable.

This example illustrates a pattern common in practice: the model simultaneously fails to find true positives in group 1 (low TPR) while producing too many false positives for group 0 (high FPR). These failures have different downstream harms. Group 1 candidates miss real opportunities they have earned. Group 0 candidates who do not deserve the positive outcome receive it, which may dilute program quality or create unfairness toward group 0 members who are displaced by less-qualified peers.

Notice that this model comes relatively close to predictive parity (0.08 difference in precision) even though it badly violates demographic parity and equalized odds. This is not a coincidence, and the mathematical reason for it will become clear when we examine the impossibility theorem.