lipaud
Individual fairness: a Lipschitz audit
lipaud(h, d = NULL, pairs = NULL, lip = 1)Dwork et al. (2012) ask that similar individuals be treated similarly:
that the gap between two people’s scores be at most lip times the
distance between them, for a distance that says who is alike for the
task. lipaud() checks the given pairs against that rule and reports
the smallest constant the scores satisfy on them.
Parameters
Section titled “Parameters”hThe scores: finite numbers, one per person.
dThe distances: with
pairsNULL, astats::dist()object or a symmetric matrix between all the people (every pair is audited); withpairs,NULL(all 1) or one number from 0 per pair.pairsNULL, or the pairs to audit: a matrix of two columns of person numbers from 1.lipThe constant: one number from 0.
Returns
Section titled “Returns”A list: lreq (the smallest constant the scores satisfy on these
pairs), nviol and rate (the pairs breaking the rule at lip, and
their share), ok (TRUE when none does), maxgap (the largest
gap), worst (the first pair with the largest ratio), and pairs, a
data frame with one row per pair: i, j, d, gap, ratio and
viol.
A pair at distance 0 is two people the distance cannot tell apart: any
gap between their scores breaks the rule, and no constant repairs it
(its ratio is Inf). The audit is only as good as the distance: it says
whether the scores treat alike those the distance calls alike, not
whether the distance is the right one.
References
Section titled “References”Dwork, C., Hardt, M., Pitassi, T., Reingold, O. and Zemel, R. (2012). Fairness through awareness. Proceedings of the 3rd Innovations in Theoretical Computer Science Conference, 214-226. doi:10.1145/2090236.2090255
Examples
Section titled “Examples”x <- c(1, 2, 2.5, 6)h <- c(0.10, 0.20, 0.60, 0.65)# scores on a scale of 0 to 1 against distances in yearslipaud(h, dist(x), lip = 0.2)Also in the R reference, with the method and its source.