Audit how disparity metrics move over time and across cities
Source:R/frns_temporal.R
morie_predpol_temporal_audit.RdFor every (city, period) cell the four disparity metrics are
computed; per city the audit then reports the mean of each metric,
the count of periods with DIR above 1, and the DIR temporal range
(max minus min) — the headline measure of instability.
Arguments
- period
Time-period label for each record (e.g.
"2019-03").- city
City label for each record.
- y_pred
The decision/assignment for each record.
- group
Protected attribute for each record.
- privileged
Reference group; inferred globally from the pooled data when
NULLso every cell uses the same reference.- favorable
Value of
y_predcounted as favourable (default1).
Value
A named list: value (worst per-city DIR range),
worst_dir_range, cross_city_dir_spread, per_city, cells,
privileged, warnings, interpretation.
Examples
period <- c(rep("p1", 10), rep("p2", 10))
city <- rep("A", 20)
pred <- rep(c(1, 1, 1, 1, 1, 1, 1, 1, 0, 0), 2)
grp <- rep(c(rep("X", 5), rep("Y", 5)), 2)
res <- morie_predpol_temporal_audit(period, city, pred, grp, privileged = "X")
res$per_city$A$dir_range # 0 — disparity is stable across periods
#> [1] 0