README.md

AIBias

Longitudinal Bias Auditing for Sequential Decision Systems

CRAN status License: MIT

Why AIBias?

Standard fairness tools ask: "Is there a disparity at this moment?"

AIBias asks: "How does a disparity evolve over repeated decisions, and why did it change from one decision to the next?"

In repeated decision systems (loan renewals, assessment grading, parole reviews, benefit recertification) the same units are decided on again and again. A gap between groups at one occasion can carry forward, be regenerated by unequal recovery and retention, or appear to move only because different units have a recorded decision. AIBias separates these.

| Question | Function | Key quantity | |---|---|---| | How does the gap evolve? | aib_describe() | $B_{g,r}(t)$, cumulative burden | | Do groups differ after a denial or an approval? | aib_transition() | recovery and retention gaps | | Do the two conditional gaps differ? | aib_amplify() | $A_{g,r}(t)$ | | Why did the gap change? | aib_decompose() | decay, recovery, retention, sample change | | How uncertain is each of these? | aib_bootstrap() | cluster-bootstrap intervals |

Installation

install.packages("AIBias")

# development version
remotes::install_github("subirhait/AIBias")

Quick Start

library(AIBias)
data(lending_panel)

result <- aib_audit(
  lending_panel,
  id        = "applicant_id",
  time      = "year",
  group     = "race",
  decision  = "approved",
  ref_group = "White",
  bootstrap = TRUE, B = 500, seed = 42
)

summary(result)
plot(result, type = "trajectory")
plot(result, type = "decomposition")

Why did the gap change?

For consecutive occasions $t-1$ and $t$, take the units with a recorded decision at both (paired units). Let $\bar q$ be the two groups' average share favorable at $t-1$, $\bar s$ their average retention-minus-recovery rate, and $\Delta$ mean focal minus reference. Then, exactly,

$$\Delta_t - \Delta_{t-1} = (\bar s - 1)\Delta^P_{t-1} + (1-\bar q)\Delta p_{01} + \bar q\,\Delta p_{11} + (S_t - S_{t-1}),$$

where $\Delta^P_{t-1}$ is the prior gap among paired units and $S_t$, $S_{t-1}$ are the differences between the full observed gap and the paired gap at each occasion. The terms are the decay of the prior gap, the recovery contribution, the retention contribution and the change in who has a recorded decision. The identity holds for any recorded data.

A zero amplification index does not mean a stable gap. With both groups at 50%, reference recovery/retention 0.2/0.8 and focal 0.1/0.7, the index is zero while the gap goes 0, −0.10, −0.16:

sim <- aib_simulate(n = 20000, n_times = 3, groups = c("ref", "focal"),
                    init = c(0.5, 0.5), p01 = c(0.2, 0.1), p11 = c(0.8, 0.7),
                    seed = 1)
obj <- aib_build(sim, "id", "time", "group", "decision")
obj <- aib_audit(obj, ref_group = "ref")
obj$amplification$index
obj$decomposition$steps

Missing decisions and sparse cells

Citation

citation("AIBias")

Author

Subir Hait, Michigan State University, haitsubi@msu.edu

License

MIT License. See LICENSE for details.



Try the AIBias package in your browser

Any scripts or data that you put into this service are public.

AIBias documentation built on Dec. 1, 2026, 1:06 a.m.