Skip to contents

For every (city, period) cell the audit computes the four disparity metrics, then aggregates per city - reporting the mean of each metric, the count of periods with DIR > 1 (over-prediction periods), and the DIR temporal range (max - min) which quantifies how unstable the metric is across the audited window.

Usage

morie_fairness_predpol_temporal_audit(
  period,
  city,
  y_pred,
  group,
  privileged = NULL,
  favorable = 1
)

Arguments

period

Time-period label per record (e.g. "2019-03"). Sorted lexically for display, so ISO-style labels order correctly.

city

City label per record.

y_pred

Decision / assignment per record.

group

Protected attribute per record.

privileged

Reference group. If NULL, inferred globally from pooled data.

favorable

Value of y_pred counted as favourable (default 1).

Value

A morie_fairness_result; headline value is the largest per-city DIR temporal range - the worst temporal instability found in the audited window.

Details

The reference (privileged) group is inferred globally from the pooled data when not supplied, so every cell uses the same reference.

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_fairness_predpol_temporal_audit(
  period, city, pred, grp, privileged = "X"
)
res$payload$per_city$A$dir_range
#> [1] 0