← Module 13 overview
Module 13 · Project 7 · Due the date on Canvas · Ethics, Privacy & Dashboard Detective · adaptive competency DV21

Fairness & base-rate mathematics

A dashboard can reverse its story when you switch from subgroup rates to a single pooled number. This step shows why, and how a single threshold on a risk score can treat groups differently when base rates differ.

Module 13 · Step 1 of 9 · Watch8–10 min
Worked example first

Program vs Comparison on two course levels. Compare the four rates, then the two pooled rates.

Program
Standard: 18/20 = 90%
Advanced: 48/80 = 60%
Pooled: 66/100 = 66%
Comparison
Standard: 72/90 = 80%
Advanced: 4/10 = 40%
Pooled: 76/100 = 76%
Program is higher inside both course levels (90% > 80% and 60% > 40%), yet lower overall (66% vs 76%). The ranking reverses because Program has far more students in the lower-rate Advanced group.

Key takeaway: Always show the subgroup rates with their denominators before any pooled claim. The mix of groups can reverse the ranking.

Core definitions (subgroup rate, pooled rate, DIR)
Subgroup rate\(P(\text{favorable} \mid G_i) = x_i / n_i\)
Pooled rate\(P(\text{favorable}) = \sum_i x_i / \sum_i n_i\)
Disparate impact ratio\(\mathrm{DIR} = \frac{P(\text{favorable} \mid G_1)}{P(\text{favorable} \mid G_2)}\)

A ratio below 0.8 is the conventional threshold for adverse impact (Feldman et al., 2015).

Before the lab · reading a pooled rate
  1. Why a pooled comparison can reverse. A group's pooled rate is a weighted average of its subgroup rates, with weights equal to the share of that group's students in each subgroup. The Program has 20 Standard students (18 pass, 90%) and 80 Advanced students (48 pass, 60%): pooled, \( 66/100 = 66\% \). Comparison has 90 Standard students (72 pass, 80%) and 10 Advanced students (4 pass, 40%): pooled, \( 76/100 = 76\% \). The Program has a higher observed rate inside both courses and a lower pooled rate, because its students are concentrated in the lower-rate Advanced subgroup; course difficulty is not measured here. That is Simpson's paradox (Simpson, 1951; Wagner, 1982); report the subgroup rates with their denominators before any pooled claim.
  2. Every rate names its numerator and denominator. Publish the count and who counts in the denominator, such as which students were eligible, the time window and any exclusions. A tile reading “91% completion” without them cannot be checked.
  3. Association is not cause. When students chose whether to take part, an observational comparison cannot show cause: the students who opted in may differ in preparation, motivation or time. Caption the difference as an association, and name selection and prior preparation as reasons it may not be causal (Holland, 1986).

The fixed synthetic fixture in m13.js and the R starter contains four disjoint fictional path/course-level groups in a common fictional reporting window, with no exclusions. No external collection or retrieval date applies. These descriptive rates do not establish program effects.

Extend this (optional): comparing the paths at a common course mix

Direct standardization removes the composition difference by applying each path's subgroup rates to the same set of subgroup shares. With standard shares \(s_j\) that sum to one, path \(k\) has the standardized rate \(\sum_j s_j\,P(\text{favorable} \mid G_k, j)\), so the two paths are compared as if they enrolled the same mix of Standard and Advanced students (Keiding & Clayton, 2014). The step 6 R lab uses the combined enrollment of both paths as the standard. The comparison changes with the chosen standard, and it adjusts only for course level, the one subgroup variable recorded; it is still a descriptive comparison, not an estimate of a program effect.

Fairness & base-rate lab loading…

Classifier threshold, error trade-offs & subgroup fairness

A risk score becomes a decision once a threshold is applied to it. Move the threshold and observe the confusion matrix, the ROC operating point and, when the matrix is split by group, how the same threshold treats the two student groups differently, which the aggregate matrix conceals.

Formal fairness identity and references

The ROC curve plots the true positive rate against the false positive rate across all thresholds (Fawcett, 2006). When base rates differ between groups, as they do here, a score cannot in general satisfy calibration within each group and equal error rates across groups at the same time (Chouldechova, 2017; Kleinberg et al., 2017).

The classifier uses fixed synthetic score-bin counts in m13.js: 200 fictional cases per group, with 80 positives in A and 50 in B. Scores are bin midpoints 0.05 to 0.95; slider values are cutoffs 0 to 1. They are not calibrated probabilities. \( \mathrm{TPR} = \mathrm{TP}/(\mathrm{TP}+\mathrm{FN}) \), \( \mathrm{FPR} = \mathrm{FP}/(\mathrm{FP}+\mathrm{TN}) \), and precision \( = \mathrm{TP}/(\mathrm{TP}+\mathrm{FP}) \); precision is undefined when no positive predictions are made. The ROC diagonal denotes equal TPR and FPR, not a fairness certificate.

The conflict follows from an identity among the error rates of one group. Write \(p\) for the group's base rate, the proportion of its cases that are positive. Then \(\mathrm{FPR} = \frac{p}{1-p}\cdot\frac{1-\text{precision}}{\text{precision}}\cdot\mathrm{TPR}\) (Chouldechova, 2017). If two groups have the same precision and the same TPR but different base rates, their false positive rates must differ, and the group with the higher base rate has the higher FPR. Here group A has \(p = 80/200 = 0.40\) and group B has \(p = 50/200 = 0.25\), so equal precision and equal TPR would require the FPR for A to be \(\frac{0.40/0.60}{0.25/0.75} = 2\) times the FPR for B.

The classifier threshold explorer needs JavaScript.