library(dplyr)
library(ggplot2)
compas <- read.csv("https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv") |>
filter(race %in% c("African-American", "Caucasian")) |>
select(race, decile_score, two_year_recid)
rates_at <- function(cutoff) {
compas |>
mutate(flag = decile_score >= cutoff) |>
group_by(race) |>
summarize(FPR = mean(flag[two_year_recid == 0]),
FNR = # ...
PPV = # ...
selected = mean(flag),
.groups = "drop") |>
mutate(cutoff = cutoff)
}
rates_at(5)Fairness I: observational
Class
How this sheet works
Exercises rederive or apply the lecture’s results. Do them on your own time; they are not worked in class. The class works the discussions and the problem under “In class,” in that order, then what it can of “If there is time.” Discussions are in groups of three or four, then with the room. The problem, and the coding, are gone through as soon as the room has tried them.
Every item is about a rule that selects some people, or places: for detention, for a fraud check, for a treatment, for patrols. The same table of who was selected and what happened supports different numbers, and a disagreement about fairness is often a disagreement about which number a fair rule has to equalize. So each item ends by asking who the error falls on, who gains from the number that was reported, or who the choice of criterion could be justified to. The arithmetic narrows the answer; it does not give it.
Notation as in the lecture. \(Y = 1\) is the bad outcome; \(\hat Y = 1\) means flagged, or selected: picked out by the rule. Where a rule selects people for something good, an offer or a loan, the coding runs the other way, as in the book’s examples: \(Y = 1\) is success and \(\hat Y = 1\) is the offer. \(A\) is the group and \(p = P(Y = 1)\) the prevalence within a group. Within a group, \(\text{FPR} = P(\hat Y = 1 \mid Y = 0)\), \(\text{FNR} = P(\hat Y = 0 \mid Y = 1)\), \(\text{TPR} = 1 - \text{FNR}\), \(\text{PPV} = P(Y = 1 \mid \hat Y = 1)\) and \(\text{NPV} = P(Y = 0 \mid \hat Y = 0)\).
Exercises
Attempt each part before you open a hint.
Do not open a hint unless you have been stuck for at least a few minutes, and open them in order.
Exercise 1. Two groups, twenty people
Group a has ten people, and five of them reoffend. Group b has ten people, and two of them reoffend. A rule flags six people in group a (four who reoffend and two who do not) and three in group b (two who reoffend and one who does not).
For each group, write the two-by-two table of flag against outcome, and compute FPR, FNR, PPV, NPV and the share flagged.
Which of independence, separation and sufficiency does the rule satisfy, and which does it fail?
Check the identity \(\text{FPR} = \frac{p}{1-p} \cdot \frac{1-\text{PPV}}{\text{PPV}} \cdot (1-\text{FNR})\) in each group with your numbers.
In group a, stop flagging one of the two people who do not reoffend, and leave the rest as they are. Compute group a’s FPR and PPV again. Could any choice of who to flag in group a give it the same FPR as group b? Then flag only three people in group a, as many of them reoffenders as possible, so that both groups have the same share flagged. What happens to the two error rates?
Suppose instead the rule is perfect in both groups. Which criterion does it fail, and why does that depend on the base rates?
For each change in (d), say who gains, who loses, and who you would have to explain the change to.
Group b has eight people who do not reoffend. An FPR is a count out of the people who do not reoffend in that group.
For (b), sufficiency for a flag needs the same PPV and the same NPV.
Group a: 4 true positives, 2 false positives, 1 false negative, 3 true negatives; FPR \(2/5\), FNR \(1/5\), PPV \(2/3\), NPV \(3/4\), share flagged \(6/10\). Group b: 2, 1, 0, 7; FPR \(1/8\), FNR \(0\), PPV \(2/3\), NPV \(1\), share flagged \(3/10\).
The PPVs are equal (predictive parity), but the NPVs differ, so sufficiency fails. Both error rates differ, so separation fails. The shares flagged differ, so independence fails.
Group a: \(p = 1/2\), so \(1 \cdot \tfrac{1}{2} \cdot \tfrac{4}{5} = 0.4\). Group b: \(p = 1/5\), so \(\tfrac{1}{4} \cdot \tfrac{1}{2} \cdot 1 = 0.125\).
With 4 true positives and 1 false positive, group a’s FPR is \(1/5\) and its PPV \(4/5\), so predictive parity is lost. Group a has five people who do not reoffend, so its FPR is a multiple of \(1/5\) and cannot be \(1/8\). Flagging three reoffenders: FPR \(0\) against \(1/8\), FNR \(2/5\) against \(0\): the FPR gap reverses and the FNR gap widens, so separation still fails.
Independence. A perfect rule flags the people who reoffend and no one else, 50 percent of group a and 20 percent of group b, so the gap in shares flagged is the gap in base rates. Separation and sufficiency both hold.
First change: the person no longer flagged gains, nobody in group a loses, and the flag means more to whoever reads it. Second change: one more reoffender in group a goes unflagged; they gain, and whoever they go on to harm pays. The people owed an explanation are those whose flag changed although nothing about them did.
Exercise 2. Chouldechova’s identity
Starting from \(\text{PPV} = \frac{p\,(1-\text{FNR})}{p\,(1-\text{FNR}) + (1-p)\,\text{FPR}}\), derive \(\text{FPR} = \frac{p}{1-p} \cdot \frac{1-\text{PPV}}{\text{PPV}} \cdot (1-\text{FNR})\), then solve it for FNR.
Two groups, \(a\) and \(b\), have prevalences \(p_a \neq p_b\). A rule has the same PPV in both groups, strictly between 0 and 1, and the same FNR in both. Find \(\text{FPR}_a / \text{FPR}_b\) in terms of \(p_a\) and \(p_b\), and evaluate it with COMPAS’s prevalences, \(0.514\) and \(0.394\).
At the county’s cutoff COMPAS had PPV \(0.630\) and \(0.591\) and FNR \(0.280\) and \(0.477\), and the observed ratio of FPRs was \(1.91\). Write that ratio as a product of three factors, one for each term of the identity, and compute each. Which factor takes the ratio above your answer to (b)?
A vendor reports equal predictive values and a journalist reports unequal false positive rates for the same rule. Which of them has made an arithmetic mistake? Who is each number useful to?
For (a), take the odds against a flag being right: \((1 - \text{PPV}) / \text{PPV}\).
For (b), write the identity for each group and divide.
\(\frac{1-\text{PPV}}{\text{PPV}} = \frac{(1-p)\,\text{FPR}}{p\,(1-\text{FNR})}\); multiply by \(\frac{p}{1-p}\,(1-\text{FNR})\). Then \(\text{FNR} = 1 - \text{FPR} \cdot \frac{1-p}{p} \cdot \frac{\text{PPV}}{1-\text{PPV}}\).
With \(0 < \text{PPV} < 1\) both FPRs are positive, and the PPV and FNR terms cancel: \(\text{FPR}_a / \text{FPR}_b = \frac{p_a/(1-p_a)}{p_b/(1-p_b)}\), the ratio of the groups’ odds of the outcome. With \(0.514/0.486 = 1.058\) and \(0.394/0.606 = 0.650\), it is \(1.63\).
\(1.91 = 1.63 \times 0.85 \times 1.38\): the odds ratio; the ratio of \((1-\text{PPV})/\text{PPV}\), \((0.370/0.630)/(0.409/0.591) = 0.85\); the ratio of TPRs, \(0.720/0.523 = 1.38\). The TPR factor takes it above 1.63, and the PPV factor pulls the other way.
Neither. The two reports can both be true: the identity ties the FPR to the base rate, the PPV and the FNR, so fixing the PPV leaves the FPR free to move with the FNR. With different base rates, equal PPVs and equal FNRs force unequal FPRs, as in (b). The PPV is the number a judge reading the flag lives with; the FPR is the number a defendant who will not reoffend lives with.
Exercise 3. Separation and sufficiency together
A rule has the same FPR, FNR, PPV and NPV in two groups, with \(0 < \text{FPR} < 1\). Show that the two groups have the same prevalence.
The reversed rule \(\hat Y = 1 - Y\) flags the people who do not reoffend and no one else. Compute its four rates in any group. Which criteria does it satisfy, whatever the base rates? Which condition in (a) rules it out?
An auditor finds a rule that satisfies separation and sufficiency in two groups. What should they check before calling it fair, and who would be misled if they did not?
For (a), if \(\text{TPR} > 0\), solve the identity for \(p/(1-p)\). If \(\text{TPR} = 0\), look at NPV instead.
With \(\text{TPR} = 0\), the people not flagged are all of the reoffenders and a share \(1 - \text{FPR}\) of the others, so \(\text{NPV} = \frac{(1-p)(1-\text{FPR})}{(1-p)(1-\text{FPR}) + p}\).
If \(\text{TPR} > 0\) then, since \(\text{FPR} > 0\), the PPV is strictly between 0 and 1, and \(\frac{p}{1-p} = \frac{\text{FPR}}{1-\text{FNR}} \cdot \frac{\text{PPV}}{1-\text{PPV}}\). The right side is the same in both groups, so the odds, and so the prevalences, are equal. If \(\text{TPR} = 0\), the NPV in hint 2 is strictly decreasing in \(p\) when \(\text{FPR} < 1\), so equal NPVs give equal prevalences. This is the book’s Proposition 5 (page 67), with the condition \(\text{FPR} < 1\), which its proof passes over.
\(\text{FPR} = 1\), \(\text{FNR} = 1\), \(\text{PPV} = 0\), \(\text{NPV} = 0\) in every group: it satisfies separation and sufficiency for any base rates. The condition \(\text{FPR} < 1\) rules it out.
Whether the base rates really are equal, and whether the rule is degenerate, with an FPR of 0 or 1. A rule that is wrong about everyone passes both tests. The people misled are those who read “fair by two criteria” as “good”: the people it decides about and whoever relies on it.
Exercise 4. Two calibrated scores
Take the two groups of exercise 1, with prevalences \(0.5\) and \(0.2\).
Score 1 gives everyone the overall base rate, \(0.35\). Show that it is calibrated in the whole population. Is it calibrated by group?
Score 2 gives each person in group a their true outcome, 0 or 1, and each person in group b the value \(0.2\). Show that it is calibrated within each group.
Select everyone whose score 2 is at least \(0.5\). Compute the share selected, FPR, FNR and NPV by group. Which of the three criteria, if any, does the selection satisfy?
Score 2 is calibrated by group, which the replies to ProPublica treated as the test of fairness. Who does score 2 serve, and who would you have to explain it to?
Calibrated means: among the people given score \(r\), a share \(r\) have \(Y = 1\). Check it for each value the score takes.
Seven of the twenty people reoffend, so among everyone scored \(0.35\) the share is \(0.35\): calibrated. By group it is not: among group a’s people scored \(0.35\) the share is \(0.5\).
In group a the score is the outcome; in group b everyone is scored \(0.2\) and two in ten reoffend.
Group a: everyone who reoffends is selected and nobody else, so 50 percent selected, FPR 0, FNR 0, NPV 1. Group b: nobody is selected, so 0 percent selected, FPR 0, FNR 1, NPV \(0.8\). None of the three holds. Independence fails (50 percent against 0); separation fails as badly as it can (FNR 0 against 1), although the FPRs agree; and the NPVs differ, so the selection is not sufficient either, although the score is calibrated by group: thresholding loses calibration.
It serves whoever wants group a sorted and group b left alone. The people in group b who reoffend are never selected, and those who do not are never told apart from those who do. The book’s example is on page 94.
In class
Discussion 1: the rule you brought
Use the rule or score you brought, which selects some people and has two ways of being wrong. If you did not bring one, choose: a spam filter; a university’s offer rule; a bank’s credit decision; a hospital’s triage score; an airport security check.
- Name the two errors and who pays for each. Of FPR, FNR, PPV and NPV, which would each of those people want equal across groups, and which would the decision maker want equal?
- ProPublica wrote that Black defendants who did not reoffend were nearly twice as likely as white defendants to be labeled higher risk. Which criterion is that sentence about? The replies said that the score was equally accurate for both groups. Which criterion is that about?
- For your rule, suppose the base rates differ between two groups. Which of the two criteria in question 2 would you give up, and who would you explain it to?
A spam filter’s false positive falls on the sender and on the reader who misses a message; its false negative on the reader’s time. The reader wants a low FNR, the sender a low FPR, and the provider a high PPV so that the spam folder is trusted. An offer rule selects for the good outcome, so its coding runs the other way (\(Y = 1\) is passing): its false positive is an admitted student who fails; its false negative is a rejected student who would have passed. The applicant wants equal FNR, the admissions office equal PPV. ProPublica’s sentence is about the FPR, part of separation; the replies are about the PPV (predictive parity, a relaxation of sufficiency) and calibration.
Problem 1. The fraud checks
The Department for Work and Pensions scores requests for a universal credit advance, and refers those it scores high risk to a caseworker, who approves or declines them. For non-UK against UK nationals, its fairness assessment reports two ratios: requests referred \(2.27\) times as often, and referrals declined, which it counts as correct, \(0.97\) times as often, not significantly different from 1. It reports no error rate. Take a decline as \(Y = 1\) and a referral as \(\hat Y = 1\), and write \(f\) for the share of a group’s requests that are referred.
Show that correct referrals are a share \(f \cdot \text{PPV} = p \cdot \text{TPR}\) of all of a group’s requests, and incorrect referrals a share \(f\,(1 - \text{PPV}) = (1 - p)\,\text{FPR}\).
Non-UK against UK, what is the ratio of correct referrals per request? Show that the ratio of incorrect referrals per request is above \(2.27\).
Suppose both groups had the same TPR and the same FPR. Write the two ratios in (b) in terms of the prevalences \(p_{\text{non-UK}}\) and \(p_{\text{UK}}\). Can both be above 1? What do you conclude?
Show that \(\text{FPR} = f\,(1 - \text{PPV}) / (1 - p)\). Taking the two PPVs as equal, show that the ratio of non-UK to UK FPRs is at least \(2.27\,(1 - p_{\text{UK}})\). If fewer than one UK request in ten would be declined on review, how much more often are non-UK requests that a caseworker would approve referred?
The \(0.97\) is not significantly different from 1. Does your conclusion in (c) depend on it?
The department judged the model “reasonable and proportionate” to keep using. Which number would a claimant who did nothing wrong want to see, and who could have published it?
For (a): the referred share times the share of referrals that are correct is the share of all requests that are both referred and declined.
For (b): the non-UK PPV is \(0.97\) times the UK PPV, so \(1 - \text{PPV}\) is larger for non-UK nationals.
\(f \cdot \text{PPV} = P(\hat Y = 1)\,P(Y = 1 \mid \hat Y = 1) = P(\hat Y = 1, Y = 1) = P(Y = 1)\,P(\hat Y = 1 \mid Y = 1) = p \cdot \text{TPR}\), and in the same way \(f\,(1 - \text{PPV}) = P(\hat Y = 1, Y = 0) = (1 - p)\,\text{FPR}\).
Correct referrals: \(2.27 \times 0.97 = 2.20\). Incorrect referrals: \(2.27 \times \frac{1 - \text{PPV}_{\text{non-UK}}}{1 - \text{PPV}_{\text{UK}}}\), and the fraction is above 1 because the non-UK PPV is the smaller, so the ratio is above \(2.27\).
\(p_{\text{non-UK}} / p_{\text{UK}}\) and \((1 - p_{\text{non-UK}}) / (1 - p_{\text{UK}})\). If the first is above 1 the second is below it, so they cannot both be above 1. Both observed ratios are, so the groups do not have the same TPR and FPR: the error rates differ. This describes the reported year’s referrals; it is not an inference about the rates behind them.
Divide the incorrect referrals by the share who would not be declined, \(1 - p\). The ratio of FPRs is \(2.27 \times \frac{1 - \text{PPV}_{\text{non-UK}}}{1 - \text{PPV}_{\text{UK}}} \times \frac{1 - p_{\text{UK}}}{1 - p_{\text{non-UK}}}\). With equal PPVs the middle factor is 1, and the last is at least \(1 - p_{\text{UK}}\) because \(1 - p_{\text{non-UK}} \leq 1\). With \(p_{\text{UK}} < 0.1\) the ratio is above \(2.27 \times 0.9 = 2.04\): more than twice as often.
No. With the PPV ratio at 1, both ratios are \(2.27\), still above 1, and the conclusion stands. It needs both ratios above 1, which holds for PPV ratios in a range around 1 but not for every ratio: with a UK PPV of \(0.5\), for a non-UK PPV between about \(0.22\) and \(0.78\).
The FPR: the chance that a request which should be approved is referred anyway. The department could estimate it. It already reviews a random sample of requests the model scores as low risk, to monitor false negatives (annex, paragraph 31). With the reviews of referred requests, that is what an estimate of each group’s prevalence needs, and (d) needs the prevalence.
Discussion 2: three views
- The middle view says to treat seemingly dissimilar people similarly when the dissimilarity is the result of something that should be discounted. Give one setting where that seems reasonable and one where it seems less defensible, and say what differs between them. Who decides what should be discounted?
- For two of the three criteria, say which view of equality of opportunity it fits, and where the fit fails.
- In one sentence: what do you take away from the impossibility results?
Calibration by group fits the narrow view. Demographic parity resembles the broad view, but at a single decision rather than over a life. Error rate parity has no single principle behind it; the book ties it both to the middle view (an unequal burden of mistakes perpetuates disadvantage) and to the narrow view (collect more data and assess people more accurately as they are), page 101. For the last question: the trade-off is a fact about base rates, so a choice has to be made and defended; it is not a reason to stop asking.
From this lecture:
- ProPublica’s error rates, a middle-view complaint; the predictive values, a narrow-view defense.
- LSE’s contextual offers, a cutoff per group defined by background: which view, and does it act at the decision or before it?
- A cutoff per group on COMPAS: which view could accept it?
- Restored waiting time: the narrow view with a better measurement, or the middle view?
- Job ads: the broad view; who hears of the opportunity at all.
- Every observational criterion ignores who applied in the first place.
From earlier in the course:
- Measurement: if \(Y = Y^* + \beta_A A\), the narrow view treats the offset as the person’s; the middle view discounts it.
- Proxies: re-arrest for offending, cost for need; which view takes the proxy at face value?
- Who is in the data: the narrow view needs outcomes, seen only for people selected before (selective labels, complete cases).
- Conditioning: comparing qualifications among people already admitted conditions on admission, a collider.
- Feedback, performative prediction: the narrow view applied year after year can entrench a gap; the broad view looks across a life.
- Goodhart: a qualification used as a target also measures access to preparation.
- Groups and individuals: the narrow view judges individuals, the broad view groups’ chances; the ecological fallacy between them.
- Consequences: accuracy now against welfare later; whose welfare.
- Duties: desert; what may be held against a person; treated as an individual.
- Character: what a fair institution is disposed to do.
- Pragmatism: different views for hiring, lending, medicine, bail.
- Respect for persons: responsibility for choices, not circumstances.
- Justice (Belmont): burdens and benefits shared fairly; fair selection.
- Lens D: under each view, who bears the cost: the applicant, the institution, the next cohort?
- Lens E: the views conflict; choose one for a setting and defend it.
- Standing question: who benefits from the narrow view being the default?
Discussion 3: predictive policing
Lum and Isaac, “To predict and serve?” (Significance, 2016), ran PredPol’s published predictive policing algorithm on Oakland police records of drug crimes. Drug arrests in 2010 were concentrated in two areas of the city. Estimates of drug use, from a national survey applied to a synthetic population of the city, were spread across it, and roughly equal by race. Run on the police records, the algorithm would have targeted Black residents at roughly twice the rate of white residents, although it uses no demographic data. In a simulation in which 20 percent more crimes are recorded wherever police are sent, the model grew more confident that crime was where it had already sent them.
- Suppose the model is checked against records of the same kind as those it was trained on. Could it look accurate, even calibrated? What would a difference in base rates between neighborhoods, or between racial groups, be measuring?
- List as many reasons as you can why two groups’ recorded rates of an outcome could differ when their actual rates do not. Which of them could apply to re-arrest for COMPAS, and to declined requests in the fraud checks?
- Have you met a loop like this before in the course? What is the same here, and what is new?
- A defense of risk scores goes: the score only reflects real differences in base rates, and ignoring them would be unfair. What would you say back? If base rates are partly the product of earlier decisions, who should bear the cost of correcting them?
- Where it can end: a difference in base rates can record an earlier unfairness; on its own it is not a reason to keep acting on it.
- Proxy (lens A): arrests measure drug use and policing together; in the earlier notation, \(Y = Y^* + \beta_A A\), with \(\beta_A\) set by where patrols go.
- Who is in the data (lens B): a crime enters the records only where police look; missing not at random.
- Conditioning: being recorded is a common effect of use and of patrols, and the records condition on it.
- Selective labels: an outcome is recorded only where someone acted.
- Calibration against the proxy: sufficiency compares predictions with recorded outcomes, so a model can pass it and inherit their bias.
- Feedback: predictions send patrols, patrols make records, records train the next prediction; “selection bias meets confirmation bias,” in the authors’ words.
- Performative prediction: the deployed model changes the data it is judged on; retraining can settle at a point that is stable, not one that is right.
- Goodhart: once arrests decide where to patrol, they measure crime less well.
- Amplification: a small first difference grows, as the selection filters earlier in the course amplified extremes.
- Leaving race out: no demographic data, and location encodes group.
- Two worlds, one table: more offending or more policing; the table cannot tell them apart.
- COMPAS: the outcome, re-arrest, and the criminal history among the inputs both pass through policing.
- Fraud checks: a decline is recorded only for a request someone reviewed; more reviews find more.
- Lens C: the survey estimate is a model too (self-reported use, a synthetic population); how far should it be trusted?
- Remedies: measure the outcome independently; the book’s introduction suggests updating only on surprising observations.
- Consequences: crime prevented against the harms of concentrated policing; who counts which.
- Duties: suspicion by address; equal treatment under the law.
- Justice (Belmont): the burdens of policing concentrated on some neighborhoods.
- Consistency and trust: policed by a loop no one there can see.
- Standing question: who benefits from the loop staying invisible? Would a more competent analyst have checked against an independent measure, as Lum and Isaac did?
- The causal question to come: what would the records show if patrols were equal?
Discussion 4: two open questions
Take one of the two.
- A county that uses a risk score like COMPAS before trial is deciding whether to keep it. Make the strongest case you can for keeping it and the strongest case for dropping it. Which is stronger, and what would change your mind? Who would the county have to justify its decision to?
- In each of today’s examples, a decision about one person rested on what is true of people like them: which job ads they see, whether their request for an advance is referred for checks, whether they are held before trial, how well their kidneys are judged to work. Is that ever unfair to the person decided about, and does your answer differ among the four?
- Compared with what: judges without a score; a simpler, public rule; releasing more people.
- Consequences: detentions, re-arrests, days held before a verdict, cost; whose welfare counts; how sure the estimates are.
- Duties: held for what one might do; presumption of innocence; judged as an individual.
- Character: deference to the tool; responsibility handed to a vendor; judgment no longer practiced.
- Pragmatism: a decision, not a conclusion; a trial period, an audit, a date to review.
- Respect for persons: no say; the calculation is not public, and defendants rarely have a chance to challenge it (ProPublica).
- Beneficence: harms and benefits assessed systematically, before and after.
- Justice: who bears the false positives.
- Law and the public interest: due process; transparent methods; who is accountable for a vendor’s product.
- Consent and clarity: does the defendant know a score was used, and what it means?
- Consistency and trust: can judges, defendants and the public predict what it will do?
- Control and transparency: can a defendant see or correct the inputs?
- Consequences of the data existing: reuse beyond pretrial, as at sentencing.
- Lens A: re-arrest stands in for reoffending, and arrests follow where police look.
- Lens C: ProPublica’s comparison or the vendor’s.
- Lens D: who bears each error.
- Lens E: keeping the status quo is also a choice.
- Selective labels: no outcome for the people held.
- Feedback: detention can change what it predicts.
- Standing question: who benefits from the choice staying invisible?
- Every prediction uses people like you; which people count as like you is the choice.
- Consequences: group information can make the estimate more accurate, for the person too; accurate on average over which people?
- Duties: treated as an individual; judged by what one did or by what one is.
- Responsibility: traits one chose against traits one did not; the middle view of equality of opportunity.
- Character: what a careful decision-maker owes the person in front of them.
- Pragmatism: depends on the purpose and the setting; revisable.
- Respect for persons: the person’s own information or the group’s.
- Beneficence and justice: selected for help (a listing, a job ad) or for a burden (a check, detention); how burdens and benefits are shared.
- Law: what discrimination law allows, setting by setting.
- Consent and clarity: did the person know a group attribute was used?
- Control: can the person replace the group’s number with their own (cystatin C)?
- Aggregation: spread within groups against the gap between them.
- History: base rates produced by past policing, access to care, past decisions.
- Proxies: what the group label stands in for, and whether that could be measured instead.
- Repair: group information used to correct, as in restored waiting time or a cutoff per group.
- Lens D: who bears the error when the group’s rate is wrong for them.
- Standing question: who gains from deciding by group averages, which are cheaper and faster than looking closer?
If there is time
Coding: COMPAS from ProPublica’s file
You need dplyr and ggplot2. ProPublica published the data behind its analysis: one row per defendant, with names and dates of birth as well as scores and outcomes. Keep only the three columns the analysis needs. decile_score is the COMPAS decile, 1 to 10, and two_year_recid is 1 if the person was arrested again within two years.
- Complete
FNRandPPV. Each is a mean over the right people, like theFPRline. Checkrates_at(5)against the lecture: FPR 45 and 23 percent, PPV 63 and 59 percent. - Compute the rates at every cutoff from 2 to 10, with
bind_rows(lapply(2:10, rates_at)), and plot FPR, then FNR, against the cutoff with one line per group. Is there a cutoff at which the two groups have the same FPR? The same FNR? - A defendant whose decile is exactly 5 has been flagged and asks what the flag means for someone like them. Compute the share re-arrested among defendants at decile 5, by group, and compare it with the PPV. What does the flag tell them, and what does it leave out?
cutoff <- c("African-American" = # ...
"Caucasian" = # ...
compas |>
mutate(flag = decile_score >= cutoff[race]) |>
group_by(race) |>
summarize(FPR = mean(flag[two_year_recid == 0]),
FNR = # ...
PPV = # ...
selected = mean(flag))- The code above gives each group its own cutoff. Find a pair of cutoffs at which the two groups’ FPRs and FNRs are both within two percentage points. What has happened to the PPVs? To the shares selected?
- At your pair of cutoffs, describe a Black defendant and a white defendant with the same decile who are treated differently. Which criterion did you satisfy, which did you give up, and who do you owe the explanation to: the defendant who is now flagged, the one who is not, or the judge who reads the same score two ways? Is the prediction now fairer?
FNR is a mean of !flag among two_year_recid == 1; PPV is a mean of two_year_recid == 1 among flag.
For step 4, try a higher cutoff for the group with the higher FPR.
compas <- read.csv("https://raw.githubusercontent.com/propublica/compas-analysis/master/compas-scores-two-years.csv") |>
filter(race %in% c("African-American", "Caucasian")) |>
select(race, decile_score, two_year_recid)
rates_at <- function(cutoff) {
compas |>
mutate(flag = decile_score >= cutoff) |>
group_by(race) |>
summarize(FPR = mean(flag[two_year_recid == 0]),
FNR = mean(!flag[two_year_recid == 1]),
PPV = mean(two_year_recid[flag] == 1),
selected = mean(flag),
.groups = "drop") |>
mutate(cutoff = cutoff)
}
rates_at(5)# A tibble: 2 x 6
race FPR FNR PPV selected cutoff
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 African-American 0.448 0.280 0.630 0.588 5
2 Caucasian 0.235 0.477 0.591 0.348 5
sweep <- bind_rows(lapply(2:10, rates_at))
sweep |>
tidyr::pivot_longer(c(FPR, FNR), names_to = "rate") |>
ggplot(aes(cutoff, value, color = race)) +
geom_line() + geom_point() +
facet_wrap(~ rate) +
scale_x_continuous(breaks = 2:10)compas |>
filter(decile_score == 5) |>
group_by(race) |>
summarize(people = n(), rearrested = mean(two_year_recid))# A tibble: 2 x 3
race people rearrested
<chr> <int> <dbl>
1 African-American 365 0.482
2 Caucasian 241 0.461
cutoff <- c("African-American" = 6, "Caucasian" = 4)
compas |>
mutate(flag = decile_score >= cutoff[race]) |>
group_by(race) |>
summarize(FPR = mean(flag[two_year_recid == 0]),
FNR = mean(!flag[two_year_recid == 1]),
PPV = mean(two_year_recid[flag] == 1),
selected = mean(flag))# A tibble: 2 x 5
race FPR FNR PPV selected
<chr> <dbl> <dbl> <dbl> <dbl>
1 African-American 0.343 0.372 0.659 0.489
2 Caucasian 0.350 0.360 0.543 0.464
Step 1: FPR 0.448 and 0.235, FNR 0.280 and 0.477, PPV 0.630 and 0.591, selected 0.588 and 0.348, for Black and white defendants.
Step 2: no. FPR is higher for Black defendants at every cutoff from 2 to 10, and FNR higher for white defendants at every one. (A cutoff of 1 selects everyone and equalizes both trivially.)
Step 3: at decile 5, 48 percent of Black defendants and 46 percent of white defendants were re-arrested, below either PPV. The PPV averages over deciles 5 to 10, so the flag tells a decile-5 defendant less than it seems to: their own rate is closer to even.
Step 4: cutoffs 6 for Black defendants and 4 for white: FPR 0.343 and 0.350, FNR 0.372 and 0.360, PPV 0.659 and 0.543, selected 0.489 and 0.464. Separation nearly holds; predictive parity is lost by twelve points, as the identity requires; the shares selected come close as a by-product. The pairs (7, 5), (8, 6) and (10, 9) also bring both rates within two points, and each splits the PPVs further.
Step 5: with 6 and 4, a Black defendant at decile 4 or 5 is not flagged, and a white defendant at the same decile is. The score means different things for different people, and the judge has to know which. Whether that is fairer depends on which error you think the county owes equally, the question under “Which criterion” below.
Which criterion
- Of independence, separation and sufficiency, which is the better fairness measure for COMPAS, and why? On that measure, is COMPAS fair? Is your answer the same for the fraud checks?
- Equal predictive values and equal error rates cannot both hold when base rates differ, except for a perfect rule or one that is wrong about everyone. How should a county, or a department, decide which to require and which to give up? Possible grounds: who bears the cost; which error is worse here; the history that produced the base rates; the purpose the rule serves. Which would you put first, and which would you refuse to use?
- Whichever you chose, name the people who lose by it and write the sentence you would say to them.
Separation, because the people the rule errs on did nothing to earn the error, and in pretrial decisions the error can be detention. Sufficiency, because a judge or caseworker who cannot trust what a flag means will discount it. Independence rarely, since it ignores the outcome, though for the fraud checks the referral itself is a burden on everyone referred. Previous years’ answers to question 2: a normative judgment; who bears the cost; which error rate; case by case; historical injustice. The point to press: the table does not settle what is fair, and the choice has owners.
The kidney equation
Kidney function is estimated from blood creatinine, age and sex. In 2021 the US equation also multiplied the estimate by 1.159 for Black patients, who in the data it was fitted to had higher creatinine at the same measured function. In a validation set it overestimated Black participants’ measured function by a median of 3.7 (ml/min per 1.73 m²). Refitted without race, it underestimated Black participants’ by 3.6 and overestimated others’ by 3.9.
- Neither equation is right on average for Black patients. Which error is worse here, an estimate too high or one too low, and who is it worse for?
- US transplant programs restored waiting time to Black candidates whose disease the old equation made look milder. Who pays for that correction, and is it owed?
- A second blood marker, cystatin C, narrows the gap without race. Suppose some hospitals can measure it and others cannot. Should the equation without the second marker use race in the hospitals that cannot? Who decides, and who is it explained to?
An estimate too high makes disease look milder, so diagnosis, referral and listing come later; an estimate too low brings them sooner, and can mean treating some people as sicker than they are. The transplant network’s view was that the first error had fallen on many Black patients. Restoring waiting time moves those candidates up the list, so others move down: the correction has a cost, and whether it is owed is the question. On the third question, using race where the second marker is not available keeps the old error’s direction for some patients and not others, depending on the hospital; dropping it everywhere accepts the new error everywhere. Neither is neutral.
For next time
Bring one decision in which an attribute is used, or deliberately not used, with one route by which it could affect the outcome, and whether that route is fair. One sentence each.
References
- Angwin, Julia, Jeff Larson, Surya Mattu and Lauren Kirchner, “Machine Bias,” ProPublica, 23 May 2016, https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing; data: ProPublica,
compas-scores-two-years.csv, https://github.com/propublica/compas-analysis. - Barocas, Solon, Moritz Hardt and Arvind Narayanan, Fairness and Machine Learning: Limitations and Opportunities (MIT Press, 2023), https://fairmlbook.org, chapter 1, pages 14 and 15; chapter 3, Proposition 5, page 67; chapter 4, pages 94 and 101.
- Chouldechova, Alexandra, “Fair Prediction with Disparate Impact: A Study of Bias in Recidivism Prediction Instruments,” Big Data 5(2), 2017, 153–163, https://doi.org/10.1089/big.2016.0047.
- Department for Work and Pensions, “UC Advances Model: Fairness Assessment,” with its Statistical Annex (1 April 2024 to 31 March 2025), published 17 July 2025, https://www.gov.uk/government/publications/fairness-assessment-including-statistical-analysis-of-the-universal-credit-advances-machine-learning-model-1-april-2024-to-31-march-2025, Tables 3 and 4 and annex paragraph 31.
- Inker, Lesley A., Nwamaka D. Eneanya, Josef Coresh and colleagues, “New Creatinine- and Cystatin C–Based Equations to Estimate GFR without Race,” New England Journal of Medicine 385(19), 2021, 1737–1749, https://doi.org/10.1056/NEJMoa2102953, abstract and Table 2.
- Lum, Kristian and William Isaac, “To Predict and Serve?,” Significance 13(5), 2016, 14–19, https://doi.org/10.1111/j.1740-9713.2016.00960.x, Figures 1 to 3.
- Organ Procurement and Transplantation Network, via the Health Resources and Services Administration, “Early Monitoring Report Shows Black Kidney Candidates Are Receiving Waiting Time Modifications After Implementation of New Policies,” 4 December 2023, https://www.hrsa.gov/optn/news-events/news/early-monitoring-report-shows-black-kidney-candidates-are-receiving-waiting-time-modifications-after-implementation-of-new-policies/.