Package {AIBias}


Title: Longitudinal Bias Auditing for Sequential Decision Systems
Version: 0.2.0
Description: Tools for auditing how group disparities evolve in repeated binary decision systems. Computes group-specific decision-rate trajectories, standardized disparities analogous to the standardized mean difference (Cohen, 1988, ISBN:0-8058-0283-5), cumulative bias burden, Markov-based recovery and retention gaps, and an index contrasting the two. Decomposes the change in a between-group gap from one occasion to the next into the prior gap carried forward, recovery and retention contributions, and terms for change in which units have recorded decisions, using symmetric rate decomposition (Kitagawa, 1955, <doi:10.1080/01621459.1955.10501299>). The decomposition is an exact accounting identity on the recorded data. Covariate-adjusted trajectories are estimated via logistic regression, generalized additive models (Wood, 2017, <doi:10.1201/9781315370279>), or generalized linear mixed models (Bates, 2015, <doi:10.18637/jss.v067.i01>). A cluster bootstrap (Cameron, 2008, <doi:10.1162/rest.90.3.414>) gives intervals for every reported component, and a simulator generates panels with known transition probabilities and selective observation.
License: MIT + file LICENSE
Encoding: UTF-8
Language: en-US
Imports: dplyr (≥ 1.1.0), tidyr (≥ 1.3.0), ggplot2 (≥ 3.4.0), rlang (≥ 1.1.0), cli (≥ 3.6.0), purrr (≥ 1.0.0), tibble (≥ 3.2.0)
Suggests: mgcv, lme4, boot, knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
LazyData: true
Depends: R (≥ 4.1.0)
URL: https://github.com/subirhait/AIBias
BugReports: https://github.com/subirhait/AIBias/issues
NeedsCompilation: no
Config/roxygen2/version: 8.1.1
Packaged: 2026-11-30 17:43:14 UTC; subir
Author: Subir Hait ORCID iD [aut, cre]
Maintainer: Subir Hait <haitsubi@msu.edu>
Repository: CRAN
Date/Publication: 2026-11-30 23:40:02 UTC

AIBias: Longitudinal Bias Auditing for Sequential Decision Systems

Description

AIBias treats algorithmic bias as a longitudinal process on repeated decisions, not a one-time snapshot. The package provides tools for:

- **Trajectory analysis**: How group-level decision disparities evolve over time - **Transition analysis**: Where compounding occurs in decision sequences - **Amplification detection**: Whether prior decisions worsen later inequality

## Core Workflow

“'r # Build the audit object obj <- aib_build(data, id = "unit_id", time = "wave", group = "group", decision = "approved")

# Run the full audit pipeline result <- aib_audit(obj, ref_group = "majority")

# Or step by step: desc <- aib_describe(obj) trans <- aib_transition(obj) amp <- aib_amplify(obj)

plot(obj, type = "trajectory") summary(obj) “'

Author(s)

Maintainer: Subir Hait haitsubi@msu.edu (ORCID)

Authors:

See Also

Useful links:


Covariate-adjusted bias trajectories

Description

Estimates covariate-adjusted bias trajectories by fitting a model for Pr(D_{it} = 1 \mid X_{it}, A_i, t) and computing marginal predicted disparities by group and time.

Usage

aib_adjust(
  object,
  formula,
  method = c("glm", "gam", "mixed"),
  ref_group = NULL,
  verbose = TRUE
)

Arguments

object

An 'aibias' object from [AIBias::aib_build()].

formula

A one-sided formula specifying covariates, e.g. '~ age + income + prior_score'. The group and time variables are added automatically.

method

One of '"glm"', '"gam"', or '"mixed"'. - '"glm"': logistic regression - '"gam"': generalized additive model (requires mgcv) - '"mixed"': GLMM with random intercept for id (requires lme4)

ref_group

Character. Reference group.

verbose

Logical.

Value

The 'aibias' object with '$adjusted' populated, containing: - 'trajectory': adjusted bias trajectory - 'marginal_rates': marginal predicted rates by group and time - 'model': the fitted model object - 'formula_used': the full formula passed to the model

Examples

data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved")
obj <- aib_adjust(obj, formula = ~ income + credit_score, method = "glm",
                  ref_group = "White")


Contrast the recovery and retention gaps (amplification index)

Description

Computes A_{g,r}(t) = B_{g,r}(t|1) - B_{g,r}(t|0), where B_{g,r}(t|d) is the focal-minus-reference gap in the decision rate at t among units whose decision at t-1 was d. Under the default sign convention this is the recovery gap minus the retention gap. The index measures how far the conditional gap depends on the prior decision. It does not by itself say whether the overall gap grew or shrank, or why: use [AIBias::aib_decompose()] for that.

Usage

aib_amplify(
  object,
  ref_group = NULL,
  sign = c("mechanism", "legacy"),
  verbose = TRUE,
  lag = NULL
)

Arguments

object

An 'aibias' object from [AIBias::aib_build()]. Recommended to run [AIBias::aib_transition()] first.

ref_group

Character. Reference group.

sign

Character; "mechanism" (default) or "legacy". Under "mechanism" the reported index is (p_{11,r} - p_{11,g}) - (p_{01,r} - p_{01,g}): negative values mean the focal group's recovery shortfall exceeds its retention shortfall, positive values the reverse. Under "legacy" the sign is flipped, B_{g,r}(t|1) - B_{g,r}(t|0).

verbose

Logical.

lag

Character or NULL. Pairing rule, as in [AIBias::aib_transition()]. If NULL, uses the rule stored by 'aib_transition()' when present, otherwise '"scheduled"'.

Details

A zero index means the recovery and retention gaps are equal. It does not mean prior decisions are irrelevant: when both conditional gaps are negative and equal, the overall gap can still widen from one occasion to the next because the focal group enters each occasion with fewer favorable decisions. See the zero-index example in 'vignette("introduction", package = "AIBias")'. The index is descriptive; reading it as a causal effect of prior decisions needs assumptions the audit data cannot check.

Value

The 'aibias' object with '$amplification' populated. Contains: - 'lagged_disparity': B_{g,r}(t|d) for d equal to 0 or 1 - 'index': A_{g,r}(t) by group and occasion - 'cumulative': sum, mean and maximum of |A_{g,r}(t)| over occasions - 'matrix_norm': L_1 distance between pooled transition matrices - 'narratives', 'ref_group', 'sign', 'lag'

Examples

data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved")
obj <- aib_transition(obj, ref_group = "White")
obj <- aib_amplify(obj, ref_group = "White")
obj$amplification$index


Run the full AIBias audit pipeline

Description

A convenience wrapper that runs the complete audit pipeline: 'aib_describe()', 'aib_transition()', 'aib_amplify()' and 'aib_decompose()'. Optionally runs 'aib_bootstrap()' for uncertainty quantification of every component.

Usage

aib_audit(
  object,
  ref_group = NULL,
  bootstrap = FALSE,
  B = 500,
  seed = NULL,
  verbose = TRUE,
  ...,
  decompose = TRUE,
  lag = c("scheduled", "recorded"),
  min_cell = 10
)

Arguments

object

An 'aibias' object from [AIBias::aib_build()], OR a data frame (in which case '...' arguments are passed to [AIBias::aib_build()]).

ref_group

Character. Reference group.

bootstrap

Logical. Run bootstrap CIs? Default FALSE.

B

Integer. Bootstrap replicates if 'bootstrap = TRUE'.

seed

Integer. Random seed.

verbose

Logical.

...

If 'object' is a data frame, additional arguments passed to [AIBias::aib_build()].

decompose

Logical. Run [AIBias::aib_decompose()]? Default TRUE.

lag

Character. Pairing rule for transitions and the amplification index; see [AIBias::aib_transition()].

min_cell

Integer. Sparse-cell threshold passed to [AIBias::aib_decompose()].

Value

A fully-populated 'aibias' object.

Examples

data(lending_panel)
result <- aib_audit(lending_panel,
                    id        = "applicant_id",
                    time      = "year",
                    group     = "race",
                    decision  = "approved",
                    ref_group = "White")

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



Cluster-bootstrap intervals for the audit quantities

Description

Resamples whole unit histories with replacement and recomputes every audit component already present in the object: the gap trajectory and cumulative burden ([AIBias::aib_describe()]), the pooled recovery and retention gaps ([AIBias::aib_transition()]), the amplification index ([AIBias::aib_amplify()]) and the gap decomposition ([AIBias::aib_decompose()]). Each replicate reuses the reference group, weights, pairing rule, sign convention and sparse-cell threshold stored in the object.

Usage

aib_bootstrap(
  object,
  B = 500,
  conf = 0.95,
  ref_group = NULL,
  seed = NULL,
  verbose = TRUE
)

Arguments

object

An 'aibias' object with at least one of '$bias', '$transitions', '$amplification' or '$decomposition' populated.

B

Integer. Number of bootstrap replicates. Default 500.

conf

Numeric. Confidence level. Default 0.95.

ref_group

Character or NULL. Reference group. If NULL (default), uses the reference group stored by the earlier steps. Supplying a different group than those steps used is an error.

seed

Integer. Random seed for reproducibility.

verbose

Logical.

Details

Units are resampled with replacement and all their occasions are kept, which preserves the dependence between a unit's decisions. Intervals are pointwise percentile intervals. A replicate can fail to produce a quantity, for example when a resample leaves a prior-state cell empty; such replicates are dropped for that quantity only, and 'n_valid' reports how many replicates remained. Treat intervals with 'n_valid' well below 'B' as unreliable.

Value

The 'aibias' object with '$bootstrap' populated, a list with - 'ci': gap trajectory intervals ('group', 'time', 'B_raw', 'B_lo', 'B_hi'), as in earlier versions - 'intervals': one row per reported quantity, with columns 'component', 'group', 'time', 'quantity', 'estimate', 'lo', 'hi', 'se', 'n_valid' - 'boot_draws': replicate values of the gap trajectory - 'B', 'conf', 'ref_group'

Examples


data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved",
                 verbose = FALSE)
obj <- aib_describe(obj, ref_group = "White", verbose = FALSE)
obj <- aib_decompose(obj, ref_group = "White", verbose = FALSE)
obj <- aib_bootstrap(obj, B = 100, seed = 42)
head(obj$bootstrap$intervals)



Build an AIBias audit object

Description

Constructs the core 'aibias' S3 object from a panel dataset. Validates the panel structure and prepares internal data for downstream analysis.

Usage

aib_build(
  data,
  id,
  time,
  group,
  decision,
  outcome = NULL,
  verbose = TRUE,
  schedule = NULL
)

Arguments

data

A data frame in long (panel) format.

id

Character. Name of the unit identifier column.

time

Character. Name of the time/wave column (integer or factor).

group

Character. Name of the protected group column.

decision

Character. Name of the binary decision column. Numeric 0/1, logical, or character/factor with values "0"/"1" or "TRUE"/"FALSE" (any case); 'NA' marks a present unit without a recorded decision. Any other value is an error.

outcome

Character or NULL. Optional downstream outcome column.

verbose

Logical. Print validation messages. Default TRUE.

schedule

Optional vector of all scheduled occasions, in order. Use it when an occasion may be absent from 'data' altogether, so that the occasions on either side are not treated as consecutive. If NULL, the levels of 'time' are used when it is a factor (including unused levels), otherwise its sorted unique values. Every value of 'time' must appear in the schedule.

Details

The function expects a balanced or unbalanced panel where: - 'id' indexes units observed over multiple periods - 'time' is an ordered index, mapped to its position in the schedule - 'group' is a categorical variable indicating protected group membership - 'decision' is a binary 0/1 variable (1 = favorable decision)

Each unit may have at most one row per occasion. A row whose decision is 'NA' marks a unit that was present (for example, eligible or enrolled) at that occasion but has no recorded decision. [AIBias::aib_decompose()] reports such units separately from units with no row at all.

Group membership is taken from ‘group' at each row. If a unit’s group changes over time, 'aib_build()' warns; trajectory and transition summaries can still be computed, but [AIBias::aib_decompose()] and [AIBias::aib_bootstrap()] stop, because both follow units over time and need one group per unit.

Value

An object of class '"aibias"'.

Examples

data(lending_panel)
obj <- aib_build(lending_panel,
                 id       = "applicant_id",
                 time     = "year",
                 group    = "race",
                 decision = "approved")


Decompose the change in a group gap between consecutive occasions

Description

For each pair of consecutive scheduled occasions (t-1, t) and each focal group g, splits the observed decision-rate gap \Delta_t = \pi_g(t) - \pi_r(t) into the prior gap carried forward, a recovery contribution, a retention contribution and two terms that link the units with decisions at both occasions to everyone with a decision at each occasion. The split is an accounting identity: the components add up to the observed change exactly.

Usage

aib_decompose(object, ref_group = NULL, min_cell = 10, verbose = TRUE)

Arguments

object

An 'aibias' object from [AIBias::aib_build()].

ref_group

Character. Reference group. If NULL, uses the first level.

min_cell

Integer. A step is flagged as sparse when any of the four prior-state cells (focal/reference by prior decision 0/1) among paired units has fewer than 'min_cell' units. Default 10.

verbose

Logical. Print a short summary.

Details

Let the *paired* units at step t be those with a recorded decision at both t-1 and t. Within group h among paired units, let q_h be the share with a favorable decision at t-1, and let p_{01,h} (recovery) and p_{11,h} (retention) be the shares favorable at t given an unfavorable or favorable decision at t-1. Write \Delta for focal minus reference, a bar for the average of the two groups, and s_h = p_{11,h} - p_{01,h}. The current gap among paired units is exactly

\Delta^P_t = \bar s\,\Delta^P_{t-1} + (1-\bar q)\,\Delta p_{01} + \bar q\,\Delta p_{11},

where \Delta^P_{t-1} = \Delta q is the prior gap among the same units (Kitagawa, 1955, symmetric weights). Writing S_t = \Delta_t - \Delta^P_t and S_{t-1} = \Delta_{t-1} - \Delta^P_{t-1} for the differences between the full observed gap and the paired gap at each occasion gives

\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}).

The identity holds for any recorded data. It does not assume that the previous decision causes the current one, that the process is Markov, or that missing decisions are missing at random. Those assumptions matter only when the components are read as features of a population process.

Pairs always use consecutive scheduled occasions (integer time index). A unit that misses occasion t-1 contributes to the full gap at t but not to the paired quantities. A data row with a missing decision counts as present but unscored.

Each unit must belong to one group throughout; the function stops otherwise.

**Empty cells.** When a prior-state cell is empty, the step is marked 'supported = FALSE' and only the components that do not need the missing rate are returned: - always estimable (given both groups have recorded decisions): 'gap_prev', 'gap_curr', 'change', 'gap_pair_prev', 'gap_pair_curr', 'sample_prev', 'sample_curr', 'sample_change'; - 'recovery' needs paired units with an unfavorable prior decision in both groups ('n0_g', 'n0_ref' > 0); - 'retention' needs paired units with a favorable prior decision in both groups ('n1_g', 'n1_ref' > 0); - 'carry' and 'decay' need all four cells.

Components that cannot be estimated are 'NA', and so is 'recon_error', because the remaining components no longer add up to the change.

Value

The 'aibias' object with '$decomposition' populated, a list with - 'steps': one row per focal group and step, with counts, rates, gaps and components (see below) - 'totals': components summed over all steps, per focal group - 'ref_group', 'min_cell'

Key columns of 'steps': 'gap_prev', 'gap_curr' (full observed gaps), 'change' (their difference), 'gap_pair_prev', 'gap_pair_curr', 'carry' (\bar s\,\Delta^P_{t-1}), 'decay' ((\bar s-1)\Delta^P_{t-1}), 'recovery', 'retention', 'sample_prev' (S_{t-1}), 'sample_curr' (S_t), 'sample_change' (S_t - S_{t-1}), 'recon_error' (numerical check, zero up to rounding), the counts 'n_units_*' (units in the panel), 'n_present_*' (units with a data row), 'n_obs_*' (units with a recorded decision), 'n_pair_*' (paired units), 'n0_*' and 'n1_*' (paired units with an unfavorable or favorable prior decision), and the flags 'supported' and 'sparse'. Suffix '_g' is the focal group and '_ref' the reference group.

References

Kitagawa, E. M. (1955). Components of a difference between two rates. *Journal of the American Statistical Association*, 50(272), 1168–1194.

Examples

data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved",
                 verbose = FALSE)
obj <- aib_decompose(obj, ref_group = "White")
obj$decomposition$steps[, c("group", "time_from", "time_to", "change",
                            "decay", "recovery", "retention",
                            "sample_change")]


Describe longitudinal disparity trajectories

Description

Computes group decision rate trajectories, raw and standardized bias trajectories, and cumulative bias burden.

Usage

aib_describe(object, ref_group = NULL, weights = NULL, verbose = TRUE)

Arguments

object

An 'aibias' object from [AIBias::aib_build()].

ref_group

Character. Reference group label. If NULL, uses the first group level.

weights

Numeric vector of time weights for cumulative burden. Length must equal the number of time points. If NULL, equal weights.

verbose

Logical. Print summary output.

Value

The 'aibias' object with '$bias' populated. The bias element is a list with components: - 'trajectory': raw bias trajectory B_{g,r}(t) - 'trajectory_smd': standardized bias trajectory B^*_{g,r}(t) - 'cumulative': cumulative bias burden CB_{g,r}(T) - 'slope': first differences \Delta B_{g,r}(t) - 'curvature': second differences \Delta^2 B_{g,r}(t) - 'ref_group': reference group used

Examples

data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved")
obj <- aib_describe(obj, ref_group = "White")
obj$bias$cumulative


Copy and run the paper figures script

Description

Copies the paper figures script to your working directory and optionally runs it. The script produces five figures (bias trajectory, disparity heatmap, transition probabilities, amplification index and gap decomposition) from a toy simulation (N=20, T=3).

Usage

aib_figures(run = TRUE, dest = file.path(tempdir(), "paper_figures.R"))

Arguments

run

Logical. If TRUE (default), runs the script immediately. If FALSE, just copies the file for you to inspect and edit first.

dest

Character. Destination filename. Default file.path(tempdir(), "paper_figures.R").

Value

The path to the copied script, invisibly.

Examples


# Copy and run immediately
aib_figures()

# Just copy to inspect first
aib_figures(run = FALSE, dest = file.path(tempdir(), "paper_figures.R"))



Check panel balance

Description

Check panel balance

Usage

aib_panel_info(object)

Arguments

object

An 'aibias' object.

Value

A tibble summarizing observation counts per unit.


Compute bias persistence above a threshold

Description

Compute bias persistence above a threshold

Usage

aib_persistence(object, threshold = 0.05)

Arguments

object

An 'aibias' object with '$bias' populated.

threshold

Numeric. Minimum absolute disparity to count. Default 0.05.

Value

A tibble with group-level persistence counts.


Simulate repeated binary decisions with selective observation

Description

Generates a panel of repeated 0/1 decisions that follow a two-state Markov chain within each group, and optionally hides decisions with a probability that depends on the group and on the unit's previous (true) decision. Useful for checking an audit against known components and for teaching.

Usage

aib_simulate(
  n = 500,
  n_times = 4,
  groups = c("reference", "focal"),
  init = c(0.5, 0.5),
  p01 = c(0.2, 0.1),
  p11 = c(0.8, 0.7),
  observe = NULL,
  unobserved = c("na", "drop"),
  seed = NULL
)

Arguments

n

Integer. Units per group (scalar, or one value per group).

n_times

Integer. Number of occasions (at least 2).

groups

Character. Group labels; the first is used as the reference group in the examples.

init

Numeric. Probability of a favorable first decision, one per group.

p01

Numeric. Recovery probability Pr(D_t = 1 | D_{t-1} = 0), one per group.

p11

Numeric. Retention probability Pr(D_t = 1 | D_{t-1} = 1), one per group.

observe

NULL for complete observation, or a 2-row matrix of observation probabilities with one column per group: row 1 after an unfavorable previous decision, row 2 after a favorable one. The first occasion is always observed.

unobserved

Character. '"na"' (default) keeps unobserved occasions as rows with a missing decision; '"drop"' removes them.

seed

Integer or NULL. Random seed.

Value

A data frame with columns 'id', 'time', 'group', 'decision' and 'decision_true' (the decision before any hiding).

Examples

# Equal recovery and retention gaps (zero amplification index),
# yet the approval gap widens.
sim <- aib_simulate(n = 2000, n_times = 4, 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", verbose = FALSE)
obj <- aib_decompose(obj, ref_group = "ref")


Compute group-specific decision transition matrices and disparities

Description

Estimates group-specific Markov transition probabilities p_g^{ab}(t) = Pr(D_{it} = b \mid D_{i,t-1} = a, A_i = g) and derives transition disparities, advantage retention, and recovery gaps.

Usage

aib_transition(
  object,
  ref_group = NULL,
  verbose = TRUE,
  lag = c("scheduled", "recorded")
)

Arguments

object

An 'aibias' object from [AIBias::aib_build()].

ref_group

Character. Reference group. If NULL, uses first level.

verbose

Logical. Print summary.

lag

Character. How a decision is linked to the previous one. '"scheduled"' (default) uses the decision at the immediately preceding scheduled occasion and drops the transition when that occasion has no recorded decision. ‘"recorded"' uses the unit’s previous data row, whatever its occasion; this was the only behavior in AIBias 0.1.1. The two agree on balanced panels without missing decisions.

Value

The 'aibias' object with '$transitions' populated. Contains: - 'probs': Transition probabilities by group and time - 'pooled': Pooled transition probabilities (time-averaged) - 'disparity': Transition disparity \Delta^{ab}_{g,r}(t) - 'recovery_gap': Disparity in 0->1 transitions (recovery) - 'retention_gap': Disparity in 1->1 transitions (retention) - 'matrices': Named list of 2x2 transition matrices per group - 'counts': transition counts by group, occasion and prior state - 'lag': the pairing rule used

When no unit in a group has a given prior state, the corresponding recovery or retention rate and gap are 'NA'.

Examples

data(lending_panel)
obj <- aib_build(lending_panel, "applicant_id", "year", "race", "approved")
obj <- aib_transition(obj, ref_group = "White")
obj$transitions$pooled


Synthetic Lending Panel Dataset

Description

A synthetic panel dataset simulating loan application decisions over six years for applicants from three racial groups. Designed to illustrate longitudinal bias analysis with AIBias.

The data are generated so that Black and Hispanic applicants face lower approval rates, lower recovery probabilities after denial, and lower retention probabilities after approval — producing compounding disparities over time.

Usage

lending_panel

Format

A data frame with 3,600 rows and 6 columns:

applicant_id

Character. Unique applicant identifier.

year

Integer. Year of application (2015–2020).

race

Factor. Racial group: White, Black, Hispanic.

income

Numeric. Annual income (thousands USD).

credit_score

Numeric. Credit score (300–850).

approved

Integer. Loan approval decision (1 = approved, 0 = denied).

Details

Transition parameters used in data generation:

| Group | P(approve | prev approved) | P(approve | prev denied) | |———-|————————|———————| | White | 0.82 | 0.65 | | Black | 0.62 | 0.38 | | Hispanic | 0.68 | 0.44 |

Source

Synthetic data generated via 'data-raw/lending_panel.R'.

Examples

data(lending_panel)
head(lending_panel)
table(lending_panel$race, lending_panel$year)

Plot an aibias object

Description

Visualizes audit results. Supports five plot types: - '"trajectory"': Bias trajectory B_{g,r}(t) over time - '"heatmap"': Group-time disparity surface - '"transition"': Group-specific transition probabilities - '"amplification"': Amplification index A_{g,r}(t) over time - '"decomposition"': Components of the change in the gap at each step (stacked bars) with the observed change (points), from [AIBias::aib_decompose()]. Bootstrap intervals for the observed change are drawn when available and 'show_ci = TRUE'.

Usage

## S3 method for class 'aibias'
plot(
  x,
  type = c("trajectory", "heatmap", "transition", "amplification", "decomposition"),
  show_ci = TRUE,
  color_palette = NULL,
  ...
)

Arguments

x

An 'aibias' object.

type

Character. Plot type. One of '"trajectory"', '"heatmap"', '"transition"', '"amplification"', '"decomposition"'.

show_ci

Logical. Show bootstrap CIs if available. Default TRUE.

color_palette

Character vector of colors for groups. If NULL, uses a sensible default.

...

Ignored.

Value

A 'ggplot2' object.

Examples


data(lending_panel)
obj <- aib_audit(lending_panel,
                 id = "applicant_id", time = "year",
                 group = "race",     decision = "approved",
                 ref_group = "White", verbose = FALSE)
plot(obj, type = "trajectory")
plot(obj, type = "heatmap")



Print an aibias object

Description

Print an aibias object

Usage

## S3 method for class 'aibias'
print(x, ...)

Arguments

x

An 'aibias' object.

...

Ignored.

Value

Invisibly returns x, called for its side effect of printing a concise summary of the audit object to the console.


Summarize an aibias object

Description

Produces a comprehensive audit summary including trajectory statistics, transition gaps, amplification indices, and narrative interpretation.

Usage

## S3 method for class 'aibias'
summary(object, ...)

Arguments

object

An 'aibias' object.

...

Ignored.

Value

Invisibly returns object, called for its side effect of printing a comprehensive audit summary to the console.