Manuscript Offprint
arXiv:2609.39025A Rank Graduation metric for Algorithmic fairness
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Fairness assessment in algorithmic decisions that affect individuals, such as credit scoring, often relies on parity measures calculated at the aggregate group level. Such measures may not reveal which individuals experience unfairness or which explanatory factors contribute to it. In this paper, we propose a rank-based framework that evaluates fairness through the distribution of model prediction errors, thereby linking fairness assessment with predictive accuracy and explainability. The framework combines Rank Graduation Fairness (RGF), its integrated measure AURGF, a centered Cramér–von Mises permutation test, and a feature removal procedure for fairness explainability.
We evaluate the methodology using logistic regression, random forest, gradient boosting, and a multilayer perceptron. The simulation study shows that protected-group imbalance can reverse descriptive fairness comparisons, whereas the proposed inferential procedure correctly distinguishes fair from unfair mechanisms. Its application to HMDA mortgage data produces model rankings that differ from those obtained with classical fairness criteria. Tree-based models, rather than logistic regression, provide the strongest combination of predictive accuracy and rank-based fairness, while the fairness null hypothesis is rejected for all four models. The persistence of disparity across statistical, bagging, boosting, and neural network specifications, together with the feature removal results, indicates that the observed unfairness is not specific to a single algorithm or predictor, but is associated with group differences embedded in the characteristics of the lending data. These findings support a broader approach to trustworthy artificial intelligence that combines predictive accuracy, fairness measurement, statistical inference, and explainability.
Keywords:
SAFE AI; Algorithmic fairness; Credit scoring; Rank Graduation Fairness; Fairness explainability; Trustworthy artificial intelligence
Explainable Artificial Intelligence (XAI) has been a major response to this governance challenge, especially in regulated fields such as credit lending, which we use as our reference. In credit lending, explainability is required not only because complex classifiers may be opaque, but because model outputs must be open to scrutiny by institutions and supervisory authorities. The mainstream XAI literature has primarily focused on explaining predictions. Methods based on Shapley (Lundberg and Lee, 2017), local surrogate models (Ribeiro et al., 2016), counterfactual explanations (Wachter et al., 2017), and feature removal procedures (Giudici and Kolesnikov, 2026) offer distinct approaches to identifying the variables that drive individual or aggregate model outputs. These tools have substantially improved black-box interpretability. However, they do not, by themselves, answer two central questions in regulated decision systems: which variables are associated with the emergence of unfairness? which individuals are most affected by unfairness?
This distinction is critical. A model may be explainable in the predictive sense while remaining opaque regarding its fairness properties. Conversely, a variable may have limited global predictive importance but still play a relevant role in generating unequal predictive reliability across protected groups. This concern is particularly relevant in credit lending, where recent studies emphasize both the need to identify variables that contribute to unfairness (Babaei et al., 2025a; Hurlin et al., 2026) and the importance of selecting fairness criteria appropriate for lending decisions (Kozodoi et al., 2022). In lending data, loan characteristics, income, collateral information, and neighborhood indicators may carry demographic or institutional information correlated with race or ethnicity. A model trained without protected attributes may therefore still generate disparities across protected groups through variables that operate as indirect channels of group differentiation.
The algorithmic fairness literature has provided a rich set of fairness metrics to evaluate disparities in automated decision systems. In credit scoring, these metrics are commonly organized around three major fairness criteria: independence, separation, and sufficiency (Kozodoi et al., 2022). Independence-based measures, such as demographic parity and disparate impact, compare the rates at which applicants from different protected groups receive favorable classifications. Separation-based measures, such as equal opportunity and equalized odds, compare classification error rates across groups conditional on the true outcome. Sufficiency-based measures, such as predictive parity, assess whether predicted positive classifications have comparable reliability across groups. These criteria remain essential because they are transparent, intuitive, and closely connected to regulatory discussions on discrimination in lending. However, these metrics generally rely on a classification cutoff (Garg et al., 2020). Probabilistic scores are first converted into binary decisions, and fairness is then evaluated on the resulting predicted classes. Consequently, the fairness diagnosis does not assess the machine learning model alone, but the model combined with a specific decision rule. This makes fairness metrics sensitive to operational policy choices, since the selected cutoff may reflect institutional risk appetite, product design, market conditions, or supervisory requirements. A model may therefore appear more or less fair when the threshold changes, even if the underlying probabilistic score function remains unchanged.
This limitation matters in credit scoring because predicted probabilities are operationally meaningful before any final decision. They function as risk assessments and may influence review procedures, ranking, pricing, and internal monitoring. At the same time, credit scoring models are often estimated on accepted applicants, since repayment outcomes for rejected applicants are typically unavailable in the labeled modeling sample, creating a gap between the labeled training population and the full applicant population to which the score is applied (Ehrhardt et al., 2021). By reducing probabilities to binary outcomes, threshold-based metrics further discard information about the severity of probabilistic misestimation. Two applicants may receive the same predicted class while being assigned substantially different denial probabilities. Similarly, two models may show comparable approval or denial disparities while concentrating severe probabilistic errors in different protected groups. A fairness audit based only on thresholded outcomes may therefore miss a relevant dimension of model behavior: the distribution and concentration of predictive unreliability across protected groups.
The SAFE AI literature provides a methodological basis for addressing this limitation. Its central insight is that AI governance should not rely on fragmented and incomparable indicators, but on metrics that are interpretable, auditable, and grounded in a common mathematical structure. Recent rank-graduation metrics operationalize this idea by evaluating accuracy, robustness, and explainability through ranked model outputs and controlled perturbations (Giudici and Raffinetti, 2023; Babaei et al., 2025b). Rank Graduation Accuracy measures the concordance between predictions and outcomes; Rank Graduation Robustness evaluates the stability of predictions under perturbation; Rank Graduation Explainability assesses how model behavior changes when variables are removed. This framework matters not only for its individual metrics but also for its ability to treat different governance dimensions through consistent, rank-based logic.
This paper is positioned at the intersection of SAFE AI metrics, XAI, and computational fairness. It shifts the focus from explaining predictions to explaining fairness, introducing rank graduation fairness, which assesses whether predictive unreliability is unevenly distributed across protected groups and how this distribution changes under feature removal. The proposal is observational: it evaluates disparities using observed outcomes, model scores, and protected-group membership, without making counterfactual claims about discrimination (Castelnovo et al., 2022). By linking rank-based fairness measurement to explanations based on feature removal, this paper contributes to a more operational account of fairness in credit scoring models.
The remainder of the paper is structured as follows. Section 2 reviews the related literature. Section 3 introduces the Rank Graduation Fairness proposal and its feature-removal extension. Section 4 discusses the empirical findings obtained with both simulated and real data. Section 5 concludes.
2 Literature Review
2.1 Fairness in Credit Scoring
Recent research on fairness in credit scoring has increasingly moved from generic fairness definitions toward audit frameworks tailored to lending decisions. This shift reflects the specific nature of credit scoring, where models differentiate applicants by credit risk. At the same time, regulatory constraints require that such differentiation not result in unjustified disparities among protected groups. Within this literature, Bono et al. (2021) examine whether the transition from logistic scorecards to ensemble machine learning models alters the distributional properties of lending predictions. Using a large UK credit dataset, they show that machine learning models improve predictive accuracy without systematically worsening fairness across protected and sensitive subgroups. Their findings suggest that subgroup disparities are not necessarily a direct consequence of model complexity, but may also reflect credit data structure and the mechanics of risk prediction. Kozodoi et al. (2022) offers a complementary perspective by evaluating fairness criteria and mitigation strategies in credit scoring models focused on profitability. Their analysis situates fairness interventions within the economic logic of lending, where measured group disparities, predictive performance, implementation constraints, and profitability interact. They identify separation as particularly relevant for credit scoring because it evaluates disparities in misclassification behavior under asymmetric costs of false approvals and false rejections. Fairness mitigation is therefore framed not as a purely statistical correction, but as a decision problem shaped by profitability and regulatory acceptability. Extending this literature toward formal diagnosis, Hurlin et al. (2026) extend the credit scoring fairness literature toward formal diagnosis and mitigation. They propose a statistical framework for testing fairness hypotheses and identifying variables associated with their rejection through Fairness Partial Dependence Plots. Their analysis is particularly relevant because it shows that simply removing a candidate variable and reestimating the model does not necessarily restore fairness and may induce substantial accuracy losses, partly because correlated variables can substitute for the removed feature. They therefore distinguish reestimation from feature neutralization, showing that muting selected variables can, in some cases, improve fairness with limited deterioration in predictive performance. Their contribution reflects a broader shift in the literature toward aligning fairness analysis with the specific statistical characteristics of lending decisions.
2.2 Fairness and Explainability
Recent studies use explainability as a diagnostic tool for fairness in credit scoring. Agarwal et al. (2023) examine whether algorithmic lending models rely on applicant race when predicting loan rejection. Using HMDA mortgage data, they compare several machine learning models through Global Shapley Values and Shapley-Lorenz explanations. Their central contribution is to show that XAI can support ethical model selection. Babaei et al. (2025a) extend this approach by showing that aggregate fairness diagnostics based on Shapley values may conceal conditional unfairness. Their analysis shows that race may appear to have limited influence in the full sample while becoming highly influential among applications for large loans, revealing a Simpson’s paradox effect. This result shows that fairness explanations should rely not only on global feature importance but also on whether protected-variable effects emerge within specific lending segments. Applying this to HMDA data yields somewhat contradictory findings. While Agarwal et al. (2023) obtain that Random Forest is more fair than logistic regression, Babaei et al. (2025a) show that they are both unfair for high loan amounts, with Random Forest becoming fair at the aggregate level. This indicates the need for further research to clarify for which individuals and features unfairness arises.
2.3 SAFE AI Metrics and Rank-Based Governance
The SAFE AI literature has established a quantitative framework for assessing the trustworthiness of artificial intelligence in finance. Giudici and Raffinetti (2023) argue that financial AI systems should be evaluated beyond predictive accuracy, using statistical measures that capture sustainability, accuracy, fairness, and explainability. This contribution frames trustworthiness as an auditable property that can be monitored through quantitative indicators rather than as a purely regulatory principle. Giudici and Raffinetti (2025) provides the statistical foundation for this approach by introducing Rank Graduation Accuracy as a unified measure of predictive accuracy. RGA extends AUROC beyond binary classification to ordinal and continuous response variables by evaluating concordance between predicted and observed ranks. Since RGA depends on prediction ranks, it is particularly well-suited to scoring systems and less sensitive to outlying observations than standard point-error measures. Building on this rank-based logic, Giudici and Kolesnikov (2026) extend it into an integrated compliance framework. They propose three area under the curve metrics: AURGA, which measures how predictive accuracy deteriorates when ranked data is progressively removed; AURGR, which evaluates robustness by comparing prediction ranks before and after data perturbations; and AURGE, which measures explainability by assessing how strongly the ranking of model predictions changes relative to the full model. These metrics are then aggregated into a compliance score, enabling evaluation of accuracy, robustness, and explainability within a common mathematical framework. The main value of this framework is replacing fragmented model evaluation with a comparable auditing system that monitors multiple dimensions of artificial intelligence risk.
The present paper extends the rank-graduation architecture by developing fairness as a dedicated SAFE AI metric for algorithmic decisions, such as credit scoring. While existing SAFE AI metrics provide operational measures of accuracy, robustness, and explainability, fairness remains less formalized within the rank-graduation framework.
We propose a Rank Graduation Fairness, which addresses this gap by evaluating where prediction errors concentrate across protected groups and whether the available features explain that concentration. In doing so, it moves fairness from a general compliance concern to an individual-level measurable dimension, aligned with the SAFE AI metric family.
3 Methodology
3.1 Research motivation and contributions
Fairness in machine learning can be understood both as a normative requirement and as a computational property of model behavior (Pessach and Shmueli, 2023). In the normative sense, fairness expresses the expectation that algorithmic systems should not generate unjustified disadvantages for individuals or groups defined by protected characteristics. In the computational sense, fairness is translated into measurable restrictions on model outputs or rankings. This computational formulation is central to AI governance because it translates broad ethical and legal principles into quantifiable metrics that can be audited and incorporated into model validation procedures.
In algorithmic decisions, such as credit scoring, fairness assessment is commonly based on group-parity criteria, including demographic parity, disparate impact, equal opportunity, equalized odds, and predictive parity (Hardt et al., 2016; Barocas and Selbst, 2016; Chouldechova, 2017; Kleinberg et al., 2016). These measures have advanced algorithmic fairness by providing transparent quantitative evidence of disparities across groups in both decisions and classification errors. They are especially useful when the policy concern is whether outcomes, such as loan approvals or denials, differ across protected groups. However, fairness metrics are not interchangeable. When protected groups have different base rates, satisfying one fairness criterion may render another mathematically unattainable or achievable only under restrictive conditions. Moreover, threshold choices and the practical observability of outcome statistics strongly affect which fairness metrics are meaningful in credit scoring applications (Garg et al., 2020).
The present paper addresses this issue by proposing a fairness framework that evaluates the distribution of prediction errors across protected groups. The central question is not only whether groups receive similar decisions, but also whether the burden of model error is distributed comparably across groups. This perspective is particularly relevant for policymakers because unfairness in algorithmic systems does not necessarily emerge only at the point of final decision. It may arise earlier through unequal reliability of risk scores, unequal exposure to severe prediction errors, or unequal concentration of predictive errors within particular populations.
The proposed framework is designed for models trained without using protected variables, such as gender, race, or ethnicity, as predictive inputs. The protected attribute is retained exclusively for fairness auditing. This design reflects a common regulatory setting in which protected characteristics should not be used as ordinary inputs to decision models (Zemel et al., 2013), while remaining necessary for evaluating disparate effects. In such settings, excluding race from the predictive model does not, by itself, guarantee racial fairness. Other variables may encode demographic, geographic, socioeconomic, or institutional information associated with protected-group membership. A rigorous audit must therefore examine not only whether disparity exists, but also which remaining variables drive it.
This paper contributes to this problem by introducing a rank-based fairness and fairness explainability framework. The approach is consistent with the rank graduation logic developed in recent SAFE-AI research (Giudici and Kolesnikov, 2026). We extend this logic to the fairness domain by examining how removing each explanatory variable changes fairness itself. The focus therefore shifts from explaining predictions alone to explaining the sources of unequal predictive reliability.
The paper’s first contribution is the definition of a Rank Graduation Fairness metric, denoted RGF. This metric evaluates whether prediction errors, measured as the distance between observed outcomes and predicted probabilities, are unevenly distributed across protected groups. Unlike classical parity measures that operate mainly on final binary decisions, RGF is computed directly from probabilistic model outputs. It therefore captures a distinct fairness dimension: the equality of predictive reliability across groups.
The second contribution concerns statistical testing. We use the Cramér–von Mises (CvM) statistic to assess differences in the distribution of prediction errors across protected groups, with significance evaluated by permuting the protected-group labels. This avoids imposing a parametric distribution on the errors and allows the test to handle unequal group sizes. When the protected attribute contains more than two groups, inference is conducted through pairwise comparisons. The test therefore provides statistical support for the disparities identified by the rank-based fairness measures.
The third contribution is the Area Under the Rank Graduation Fairness Curve (AURGF). While RGF measures fairness across the full sample, AURGF assesses whether it is maintained across progressively larger portions of the ranked distribution of prediction errors. This distinction matters because an aggregate fairness score may conceal disparities concentrated among observations with the most severe prediction errors. By examining fairness over top burden fractions, AURGF characterizes both the magnitude and the location of disparities along the error distribution. From a policy perspective, this indicates whether unequal predictive reliability is concentrated among observations for which model errors are most consequential.
The fourth contribution extends rank-based fairness assessment to feature explainability. The proposed framework attributes observed fairness disparities to the predictive information carried by individual covariates, while retaining formal inference on the residual disparity through the Cramér–von Mises statistic and protected-group permutation testing. This provides an auditable basis for distinguishing features associated with the amplification or attenuation of predictive inequality, without assigning a causal interpretation to these associations.
From a guideline perspective, the proposed framework provides a unified basis for quantifying, localizing, and explaining disparities in predictive reliability. RGF enables direct comparison of rank-based fairness across competing models, while AURGF reveals where these disparities concentrate among observations. The permutation-based Cramér–von Mises procedure complements these measures with formal statistical inference and is designed to remain applicable under balanced or imbalanced protected-group representation, as well as in settings involving multiple protected groups. Finally, the feature analysis identifies covariates associated with the amplification or attenuation of observed fairness disparities, thereby providing actionable evidence for model governance and regulatory scrutiny.
3.2 Rank Graduation Fairness
Building on the RGX principle of comparing Lorenz and concordance curves through normalized distances (Auricchio et al., 2026), we define fairness as the absence of systematic group distortions in the ranking of prediction errors. In credit scoring, RGF evaluates whether predictive unreliability is disproportionately concentrated among protected groups before converting model scores into approval or denial decisions. This makes fairness a rank-based governance metric consistent with the broader SAFE AI architecture. Consider an evaluation sample:
Where denotes the observed covariates, is the realized outcome, and identifies the protected group of observation . In the credit scoring application, denotes loan denial and denotes loan approval. The protected group variable is not included among the predictive covariates and is used only at the audit stage, after training the model. A probabilistic classifier is estimated using the admissible covariates and produces the score:
For each observation . The individual prediction error burden is denoted by:
Where is a non-negative loss function. This notation allows the framework to accommodate different specifications of predictive error, including the absolute error and the squared error . Larger values of correspond to more severe probabilistic misestimation.
RGF is constructed from each protected group’s cumulative contribution to the prediction error burden along the pooled error ranking. This common ranking underpins the specific group cumulative curves and their subsequent comparison. Let denote the ordering of observations from the smallest to the largest prediction error burden:
When error burdens are identical, treat the corresponding observations as a tie block. For each protected group, distribute the total burden within the block uniformly across its observations before constructing the cumulative group curves. This ensures that equal prediction-error burdens receive identical rank treatment and that the proposed fairness metrics are invariant to the ordering of tied observations. Using the pooled global ordering, the cumulative global error curve is defined at the empirical points as:
The corresponding dual curve is obtained by cumulating the same error values in the opposite direction:
For each protected group , define the group error contribution at rank position as:
Where if the observation at rank position belongs to group , and zero otherwise. The total error contribution of group , expressed relative to the total error of the full sample, is:
The raw cumulative error curve of group , evaluated along the pooled global ranking, is:
Unlike a normalized group curve, is divided by the total error of all individuals. It therefore preserves group ’s contribution to the global error burden. However, this curve ends at , not at one. Directly comparing such curves across groups would therefore mix two different effects: the location of group errors in the pooled ranking and the total share of error carried by each group. To place all protected groups on a common cumulative scale, the remaining mass is distributed uniformly over the pooled rank grid. The uniformly completed group curve is defined as:
Equivalently,
This uniform completion is a neutral benchmark. The part of the total error that is not attributed to group contains no group-specific rank information for that group. Allocating it uniformly over the rank grid avoids introducing an artificial concentration pattern. It also ensures that every group curve has the same boundary conditions:
The proposed metric is inspired by the RGX framework (Auricchio et al., 2026), which expresses rank-based performance as a normalized absolute distance between cumulative curves. In this setting, we adapt this logic to fairness by comparing the uniformly completed cumulative error curves of protected groups. For two groups and , the pairwise Rank Graduation Disparity is defined as:
Equivalently, the corresponding pairwise Rank Graduation Fairness score can be written as:
The numerator measures the absolute distance between the cumulative error profiles of groups and along the pooled error ranking. The denominator is the Gini-type benchmark associated with the global error distribution, obtained as the absolute distance between the cumulative error curve and its dual . The resulting ratio therefore expresses group disparity relative to the total rank dispersion of prediction errors. This normalization guarantees a bounded metric, with values interpreted on a common scale between zero and one, provided that the pairwise curve distance does not exceed the Gini-type global dispersion benchmark.
Higher values indicate that the two protected groups accumulate burden similarly along the pooled global ranking. Lower values indicate that the groups exhibit substantially different cumulative error-ranking patterns. For protected attributes with more than two categories, the metric is extended by averaging the pairwise Rank Graduation Disparities across all unordered group pairs:
This construction differs from standard group fairness measures in three respects. First, it is computed on absolute probabilistic prediction errors rather than on thresholded classifications. Second, it compares the complete cumulative distributions of error burdens across groups using a common global ranking, rather than relying solely on average errors or decision rates. Third, it aligns with the Rank Graduation family of metrics, defining fairness as one minus the normalized absolute distance between ranked cumulative curves.
3.2.1 Cramér–von Mises Permutation Test
Statistical inference is conducted using a Cramér–von Mises (CvM) criterion. The inferential procedure uses the same uniformly completed group curves but explicitly accounts for the expected separation induced by unequal protected-group representation. For two groups and , let:
denote their sample proportions. Under the null hypothesis of exchangeability of labels, and conditional on the ordered error burdens, group receives in expectation the proportion of the cumulative error burden. Hence,
From the definition of the completed group curve in Equation (10) and noting that:
The expected completed curve is
It follows that the expected difference between the completed curves of groups and is:
Equation (20) is relevant when protected groups are unequally represented. Uniform completion imposes common endpoints on the group curves, but it does not imply identical expected trajectories under exchangeability. The expected difference vanishes when , whereas under group imbalance it may be non-zero whenever . Accordingly, inference is based on the centered completed curve difference:
and the observed Cramér–von Mises statistic is defined as:
Thus, the test measures separation between the completed group curves beyond what exchangeability alone would predict from the observed group proportions. In the balanced case, and therefore , so that the centered statistic reduces to the squared distance between the two completed curves.
Statistical significance is assessed by permutation rather than from the standard Cramér–von Mises reference distribution. The two completed group curves are constructed from the same ranked prediction errors and are therefore dependent, making the usual independence-based CvM inference inappropriate in this setting (Curry et al., 2019). We retain the CvM squared distance criterion and obtain its null distribution by permuting the protected-group labels while preserving the observed group sizes. For each permutation , the completed curves are recomputed and the corresponding centered statistic is obtained. Following the finite-sample permutation -value correction of Phipson and Smyth (2016), the -value is defined as:
Where denotes the indicator function. A small -value provides evidence against exchangeability, indicating that the observed separation in error accumulation is greater than would be expected from random group assignment given the observed group proportions. The theoretical basis of the permutation -value is given in A.
For a protected attribute comprising more than two groups, the same principle extends to the average pairwise centered statistic:
For each permutation, labels are reassigned while preserving the observed sizes of all protected groups, and is recomputed. The corresponding multi-group permutation -value is:
The resulting inference is therefore applicable to both balanced and imbalanced protected-group configurations and extends naturally to multi-group protected attributes. Figure 1 provides a numerical illustration of the pooled error ranking, uniformly completed group curves, RGD, RGF, and the associated permutation test.

Figure 1: Illustration of the RGF construction: pooled error ranking and numerical construction (A–B), raw and uniformly completed group curves (C–D), pairwise disparity and normalized fairness measures (E–G), and Cramér–von Mises permutation inference (H).
3.3 Area Under the Rank Graduation Fairness Curve
The metric summarizes fairness across the full sample. However, a single value may conceal disparities concentrated among the largest errors. To assess whether fairness holds across different severity levels, we introduce the Area Under the Rank Graduation Fairness Curve.
Inspired by AURGA (Giudici and Kolesnikov, 2026), we evaluate fairness across progressively retained fractions of the ranked error distribution. For a retained fraction , let denote the subset containing the largest fraction of error burdens. The Rank Graduation Fairness metric is recomputed within using the same uniformly completed group cumulative curves defined above. Let denote the pairwise Rank Graduation Disparity between groups and within :
Here, and are the uniformly completed cumulative error curves of groups and computed inside . The denominator represents the Gini-type benchmark for rank dispersion computed over the retained subset. For protected groups, the partial disparity is obtained by averaging all pairwise disparities:
The corresponding partial fairness score is:
The function defines the Rank Graduation Fairness Curve. As illustrated in Figure 2, the curve shows how fairness evolves as the audit moves from the most severe errors to the full evaluation sample. The Area Under the Rank Graduation Fairness Curve is defined as:
In the empirical implementation, denotes the smallest retained fraction for which the protected-group comparison is well defined, meaning that each group included in the audit is represented in the retained subset and satisfies the minimum group-size requirement. For a grid , with and , the integral is approximated by:
A high indicates that predictive reliability remains comparable across protected groups over the ranked error distribution. A lower value indicates that fairness deteriorates in some regions of the distribution, especially among the largest prediction errors.
Figure 2: Conceptual representation of the Rank Graduation Fairness curve. The area under the curve summarizes fairness persistence across the ranked distribution of error burdens.
3.4 Fairness Explainability Through Feature Removal
The preceding metrics assess whether prediction error burdens vary across protected groups. A comprehensive fairness audit should also identify the admissible covariates that contribute to these disparities. This is particularly important when protected attributes are excluded from model training, as other variables may still capture demographic, geographic, socioeconomic, or institutional characteristics associated with group membership (Cornacchia et al., 2023). Let the admissible feature set be:
The full model, denoted by , is estimated using all variables in . It produces predicted probabilities , error burdens , and the full-model fairness score . The associated Cramér–von Mises permutation test gives the observed statistic and the permutation -value . For each variable , the reduced feature set is:
A reduced model is then estimated using . It produces predicted probabilities:
and error burdens
Using the reduced model errors , the fairness score is recomputed and denoted by . The Cramér–von Mises permutation test is also repeated, yielding the observed statistic and the corresponding permutation -value . Here, measures the curve separation after removing feature , while assesses whether the remaining group disparity is statistically significant. For each permutation , protected-group labels are reassigned while preserving group sizes, and the statistic is recomputed. The permutation -value is:
The fairness effect of removing is:
A positive value of indicates that removing improves fairness. A negative value indicates that its removal worsens fairness. To compare effects across models, the normalized fairness contribution is defined as follows:
lies between and . Positive values suggest that is associated with amplifying protected-group disparity. Negative values suggest that the variable may mitigate disparity. Values close to zero indicate limited influence on the fairness profile. The permutation test complements this descriptive measure. If removing increases fairness and makes non-significant, the reduced model provides weaker evidence of group error concentration. If fairness decreases, or if remains significant, removing the feature does not eliminate the observed disparity.
This procedure extends feature-removal explainability to fairness auditing. The objective is not to infer a causal effect of , but to assess whether its predictive use is associated with a meaningful change in Rank Graduation Fairness and in the statistical evidence of group error concentration.
4 Empirical findings
In this Section, we apply the proposed methodology to two distinct applications: a controlled simulated experiment and the well-known mortgage lending HMDA data.
4.1 Simulated data
We simulate a binary classification setting with observations and a deliberately imbalanced binary protected attribute. Let denote minority group membership. Group status is generated as:
This implies that the expected proportions of majority and minority observations are and , respectively. The protected attribute is generated independently of the covariates and does not enter either the outcome equation or the prediction models. This construction isolates the effect of unequal group representation from structural differences in observed characteristics or baseline risk.
Let denote the restriction of a random variable to the interval . Five continuous covariates are generated as follows:
We also generate three categorical covariates as:
The education levels correspond, in order, to secondary, bachelor, and postgraduate education. The employment status corresponds to employed, self-employed, and unemployed individuals. All covariates are mutually independent in the generating process and share the same distributions across protected groups.
The binary response, indicating whether a loan request is accepted, is drawn from:
Where
In the specification above, Secondary education and employed status are the reference categories. Note also that, as is absent from this specification, majority and minority observations follow the same conditional outcome process.
We split the data into training and test observations using joint stratification by protected-group membership and outcome status. This preserves both the protected-group imbalance and the class composition within each group. We standardize continuous variables, one-hot encode categorical variables, and estimate four machine learning classifiers: logistic regression, random forest, gradient boosting, and a multilayer perceptron. We retain the protected attribute exclusively for the subsequent fairness audit.
For each fitted classifier, we construct two evaluation settings from the same test sample. In the fair benchmark, the original predicted probabilities are retained:
Here, fairness refers to the absence of a group intervention rather than to exact equality of the realized group errors. This is because, under severe group imbalance, some finite-sample divergence remains possible even when the same generating mechanism governs both groups.
The unfair setting introduces a controlled deterioration in the reliability of minority predictions. Let
denotes the original predicted log-odds. We independently generate:
and define
Equation (52) leaves majority predictions unchanged, since , while adding substantial logit-scale noise to minority predictions. This zero-mean disturbance increases the variability of minority predictions without imposing a directional shift on the logit scale. The construction holds the fitted model, covariates, outcomes, test observations, and majority predictions fixed across the two scenarios. The resulting difference can therefore be attributed specifically to a deterioration in minority group predictive reliability. We measure prediction burden using absolute probabilistic error.
For each classifier and experimental scenario, we report RGD, RGF, and AURGF. Sampling uncertainty surrounding RGF is quantified through (2,000) group-stratified bootstrap replications, while statistical significance is evaluated using (2,000) protected-label permutations. Resampling is performed independently within each protected group, ensuring that the original (90:10) group composition is retained by construction. Table 1 reports the complete simulation results. Complementing these aggregate estimates, Figure 3 traces the partial RGF curves underlying AURGF in the unfair scenario and reports the corresponding permutation (p)-values at selected burden fractions.
Table 1: Fairness diagnostics under protected-group imbalance
Model Scenario Group-level prediction error Rank-based fairness Statistical inference Majority MAE Minority MAE RGD RGF [95% CI] AURGF CvM- -value Logistic regression Fair 0.5862 [0.5321, 0.6514] Unfair 0.7175 [0.6493, 0.7976] 0.0009 Random forest Fair 0.5849 [0.5389, 0.6409] Unfair 0.6977 [0.6373, 0.7684] 0.0005 Gradient boosting Fair 0.5788 [0.5280, 0.6427] Unfair 0.6846 [0.6227, 0.7595] 0.0070 Multilayer perceptron Fair 0.6049 [0.5412, 0.6719] Unfair 0.7996 [0.7681, 0.8212] 0.0005
Notes: MAE denotes the mean absolute probabilistic prediction error, while CvM– denotes the centered observed Cramér–von Mises statistic. Values in brackets are 95% confidence intervals for RGF, obtained from group-stratified bootstrap replications. Permutation -values are based on protected-label permutations; values significant at the 5% level are shown in bold. Shaded rows identify the unfair scenario.
(a) Logistic regression
(b) Random forest
(c) Gradient boosting
(d) MLP
Figure 3: AURGF curves and associated permutation p-values for the four classifiers under the simulated unfair scenario. The horizontal axis represents the retained fraction of observations with the largest error burdens. The shaded area corresponds to the Area Under the Rank Group Fairness curve (AURGF), while the annotations report permutation -values at selected burden fractions. Smaller values of correspond to the most severe prediction errors, with indicating the full sample.
Table 1 reveals an important consequence of severe protected-group imbalance. Across all four classifiers, RGF is higher in the unfair scenario than in the fair benchmark, contrary to the direction implied by the simulation design. This reversal reflects the descriptive RGF measure’s sensitivity to the highly unequal group representation in this experiment. It should therefore not be interpreted as evidence that the induced deterioration in minority predictions improves fairness.
The inferential results lead to the opposite, and intended, conclusion. The centered Cramér–von Mises statistic explicitly removes the completed curve separation expected under exchangeability at the observed group proportions. Accordingly, the permutation tests do not reject the null in the fair scenario, whereas they reject it for every classifier after perturbing minority group predictions. The simulation thus separates two issues: the finite-sample behavior of the descriptive RGF score under severe group imbalance and the detection of systematic distributional disparity once statistical inference accounts for the induced imbalanced component. This behavior is not unique to the proposed framework: established group fairness measures have also been shown to be sensitive to protected-group proportions (Brzezinski et al., 2024), reinforcing the distinction between a descriptive fairness estimate and the statistical evidence supporting a disparity.
Figure 3 traces the evolution of RGF over progressively larger fractions of the highest error burdens and reports the corresponding AURGF values. As with the full-sample RGF results, AURGF reverses under severe protected-group imbalance, yielding comparatively high values despite the deliberate deterioration imposed on minority group predictions. The permutation results nevertheless recover the distinction introduced by the simulation through the centered CvM statistic.
The point at which the null hypothesis is rejected differs across classifiers. For gradient boosting, significance emerges only after retaining a larger fraction of the ranked observations. This result is consistent with its error profile in the unfair scenario: gradient boosting records the lowest minority MAE among the four classifiers (), indicating that the imposed perturbation translates into a comparatively smaller overall error burden for this model. The group separation is consequently less pronounced among the most extreme errors and becomes detectable only as the retained fraction expands. This should not be interpreted as an intrinsic requirement of gradient boosting for a larger sample, but as a feature of the model’s error distribution. The MLP provides a useful contrast. Its substantially larger prediction errors under the unfair scenario produce a detectable group departure at smaller retained fractions, despite relatively high RGF values at the upper end of the error ranking.
The random forest curve is additionally affected by the occurrence of tie blocks. Repeated predicted probabilities generate identical absolute error burdens for multiple observations, so a requested retained fraction that intersects a tie cannot be implemented by arbitrarily splitting the tied observations. The entire block is retained instead, causing the realized fraction to move to the end of the block. The resulting jumps in the random forest curve therefore reflect the tie-preserving construction of the partial RGF rather than changes in the underlying definition of the metric. This treatment ensures that RGF and AURGF are invariant to the arbitrary ordering of observations with identical error burdens.
4.2 HMDA data
To illustrate the proposed methodology, we use data collected under the Home Mortgage Disclosure Act (HMDA), the most comprehensive publicly available source of information on the U.S. mortgage market. Enacted in 1975 and implemented through Regulation C, HMDA requires covered financial institutions to report detailed information on individual mortgage applications. These data help assess whether lenders are adequately serving their communities’ credit needs, inform the development of equitable housing policies, and help identify potential patterns of discriminatory lending. To protect applicants’ privacy, the publicly released records are anonymized. Our empirical analysis focuses on 446,902 mortgage applications filed in New York State in 2017. Following Giudici and Kolesnikov (2026), we prepare the data by excluding irrelevant or non-informative variables and consolidating infrequent categories where appropriate.
We preserve the existing imbalance in the protected variable, applicant_race_1. The dataset comprises two racial groups, with 90.63% in the majority group and 9.37% in the minority group. The binary target variable indicates whether a loan application is declined. It is named action_taken and is imbalanced, with approximately 18.37% of loans declined.
The analysis includes five categorical and eight continuous covariates. The categorical covariates are loan_type, applicant_sex, co_applicant_sex, loan_purpose, and lien_status. The continuous covariates are loan_amount_000s, applicant_income_000s, population, minority_population, hud_median_family_income, tract_to_msamd_income, number_of_owner_occupied_units, and number_of_1_to_4_family_units.
The data reflects the default and the protected-group imbalances commonly encountered in lending portfolios. It thus provides a realistic benchmark for assessing fairness under realistic representation. The dataset is partitioned into training and test subsets using a 70%–30% split with joint stratification on action_taken and applicant_race_1. This strategy simultaneously preserves the outcome distribution and the protected-group proportions in both subsets. We standardize continuous predictors and one-hot encode categorical predictors. We exclude the protected variable from model estimation and use it only during the post hoc fairness audit.
We have applied four different machine learning models to the data. Logistic regression was tuned with , a convergence tolerance of , the saga solver, and no class weighting. A random forest was then fit, with 700 trees and bootstrap sampling, a log-loss splitting criterion, a maximum depth of 12, a maximum-feature proportion of , a minimum leaf size of 8, a minimum split size of 5, and balanced class weighting. Gradient boosting was then specified with 256 trees, a learning rate of , a maximum depth of 5, a maximum-feature proportion of , a subsampling rate of , a minimum leaf size of 14, and a minimum split size of 10. Finally, we fitted an MLP with a single hidden layer containing neurons with ReLU activation, a batch size of 512, an regularization parameter of , an initial learning rate of , and early stopping based on a no-improvement window of 10 iterations.
The models were compared on a held-out test partition which preserves the original protected-group imbalance. Throughout the fairness audit, we measure prediction burden using the absolute probabilistic error, , consistent with the proposed RGF framework. The resulting predictive performance and fairness estimates are reported in Table 2, whereas the corresponding AURGF curves together with permutation -values are presented in Figure 4.
We quantify the statistical uncertainty associated with the proposed fairness measures using 2,000 group-stratified bootstrap replications to construct 95% confidence intervals for RGF. We assess statistical significance using 2,000 protected-group label permutations, and report the centered Cramér–von Mises statistic to assess differences in the distribution of prediction errors across protected groups.
Table 2: Predictive performance and rank-based fairness results on the original dataset with imbalanced protected groups
Predictive performance Rank-based fairness Statistical inference Model ROC–AUC PR–AUC RGD RGF RGF 95% CI AURGF CvM– Permutation -value Logistic regression 0.6794 0.3198 0.3370 0.6630 [0.6580, 0.6684] 0.5223 78.5705 0.0005 0.0200 Random forest 0.7348 0.4213 0.3295 0.6705 [0.6637, 0.6787] 0.7216 19.4222 0.0005 0.0100 Gradient boosting 0.7364 0.4232 0.3427 0.6573 [0.6523, 0.6628] 0.5454 72.7159 0.0005 0.0100 MLP 0.7303 0.4108 0.3441 0.6559 [0.6510, 0.6615] 0.5488 70.2581 0.0005 0.0100
Notes: Results are computed on the original dataset, preserving the natural imbalance between the protected groups. Values in brackets are 95% group-stratified bootstrap confidence intervals for RGF. CvM– denotes the centered observed Cramér–von Mises statistic, with the bold value indicating the smallest statistic. Permutation -values are based on protected-label permutations. Bold entries in the predictive-performance and AURGF columns indicate the best result, whereas the bold RGD and RGF values correspond to the smallest disparity and highest fairness, respectively. Bold -values denote statistical significance at the 5% level. The quantity denotes the smallest top-burden fraction used to construct the partial RGF curve.
(a) Logistic regression
(b) Random forest
(c) Gradient boosting
(d) MLP
Figure 4: AURGF curves for the four classifiers. The horizontal axis represents the retained fraction of the observations with the largest error burdens. The shaded area corresponds to the Area Under the Rank Group Fairness curve (AURGF). Labels indicate permutation -values computed at selected retained fractions. Smaller values focus on the highest-error observations, whereas corresponds to the full test sample.
Table 2 shows that Gradient Boosting and Random Forest achieve the strongest predictive performance, with Gradient Boosting attaining the highest ROC–AUC and PR–AUC. From a fairness perspective, Random Forest records the highest AURGF and the lowest centered Cramér–von Mises statistic. The latter indicates that Random Forest exhibits the smallest departure between the prediction error distributions of the two protected groups among the models considered; it should not, however, be interpreted as evidence of fairness. Indeed, the permutation test rejects the null hypothesis for Random Forest (), as it does for all other classifiers.
This distinction matters given the pronounced imbalance in protected-group representation. The simulation results show that severe imbalance can affect the ordering of the descriptive RGF and AURGF measures, and these quantities should therefore be interpreted cautiously in this setting. The permutation inference, based on the centered Cramér–von Mises statistic, accounts for the separation expected from the observed group proportions. Although Random Forest presents the smallest distributional discrepancy in relative terms, the evidence remains sufficient to reject fairness. More generally, the empirical results distinguish relative fairness across models from statistical evidence of fairness: a model may compare favorably with competing specifications while still exhibit a significant disparity across protected groups.
Figure 4 further examines these results by tracing RGF over progressively larger fractions of the highest prediction error burdens and summarizing this trajectory through AURGF. Across all four models, RGF is lowest among the most severe prediction errors and increases as less extreme observations are included. This supports the intuition that unfairness tends to be concentrated where model predictions are least accurate. Given the pronounced protected-group imbalance, however, interpret RGF and AURGF cautiously and consider them jointly with the inferential evidence.
From a credit lending perspective, Table 2 provides consistent evidence of unfairness across all four models considered for the HMDA data. This finding is in line with Babaei et al. (2025a), but differs from the conclusions reported by Agarwal et al. (2023). An important distinction is that the evidence reported here is supported by formal permutation inference, rather than by descriptive fairness measures alone. Rejecting the fairness null across all model specifications therefore indicates that the observed disparities cannot be attributed solely to the magnitude or ordering of the descriptive fairness scores.
4.2.1 HMDA data, fairness explainability
We now consider the empirical implementation of the fairness explainability framework developed in Section 3.4. The analysis examines each predictor’s contribution to each classifier’s rank-based fairness under the original imbalanced protected-group representation. Specifically, each predictor is removed in turn, the corresponding model is re-estimated, and the resulting change in RGF is used to quantify its normalized fairness contribution, . This procedure identifies whether a given predictor contributes to or mitigates disparities in the distribution of error burdens across protected groups.
The results of the feature removal analysis are reported in Table 3, with the corresponding normalized fairness contributions shown in Figure 5. For each reduced model, the permutation test indicates whether the disparity across protected groups remains statistically significant after removing the feature.
Both Table 3 and Figure 5 indicate that Loan purpose is the control variable that mostly affects fairness, consistently for all four models: its removal considerably improves it. However, unfairness remains significant at the level. The other variables have much smaller impacts, and their relevance depends on the considered model.
As shown above, improving fairness may come at the cost of predictive performance. For this reason, it is important to consider the fairness–performance trade-off induced by feature removal. Table 4 reports the changes in RGF and the normalized fairness contribution, along with the changes in ROC–AUC and PR–AUC, corresponding to each feature removal.
Table 3: Feature-removal fairness explainability results under imbalanced protected-group representation
Model Removed feature CvM– Logistic regression loan_purpose 0.6630 0.6898 0.0268 0.0796 137.3899 0.0005 minority_population 0.6630 0.6601 -0.0029 -0.0044 64.4720 0.0005 co_applicant_sex 0.6630 0.6642 0.0012 0.0036 79.9383 0.0005 loan_type 0.6630 0.6618 -0.0012 -0.0018 75.1155 0.0005 number_of_owner_occupied_units 0.6630 0.6635 0.0005 0.0015 80.2181 0.0005 Random forest loan_purpose 0.6705 0.7538 0.0834 0.2530 40.8801 0.0005 minority_population 0.6705 0.6552 -0.0153 -0.0227 12.5181 0.0005 hud_median_family_income 0.6705 0.6736 0.0032 0.0096 19.2568 0.0005 loan_amount_000s 0.6705 0.6663 -0.0041 -0.0062 16.4233 0.0005 number_of_owner_occupied_units 0.6705 0.6713 0.0009 0.0026 19.7936 0.0005 Gradient boosting loan_purpose 0.6573 0.6700 0.0127 0.0371 93.5549 0.0005 applicant_sex 0.6573 0.6561 -0.0012 -0.0018 69.6440 0.0005 tract_to_msamd_income 0.6573 0.6563 -0.0010 -0.0016 69.7053 0.0005 minority_population 0.6573 0.6563 -0.0010 -0.0015 67.6854 0.0005 loan_amount_000s 0.6573 0.6564 -0.0009 -0.0014 67.6046 0.0005 MLP loan_purpose 0.6559 0.6731 0.0172 0.0499 89.9525 0.0005 number_of_1_to_4_family_units 0.6559 0.6584 0.0024 0.0071 72.4208 0.0005 lien_status 0.6559 0.6584 0.0024 0.0070 72.7879 0.0005 applicant_sex 0.6559 0.6581 0.0022 0.0064 65.6799 0.0005 minority_population 0.6559 0.6580 0.0021 0.0061 71.7725 0.0005
Notes: For each classifier, the Table reports the five features with the largest absolute normalized fairness contribution, . denotes the RGF of the full model and the RGF obtained after removing feature and re-estimating the model. The change in fairness is ; hence, positive values indicate that removal of feature improves fairness, whereas negative values indicate that removal worsens fairness. denotes the normalized fairness contribution of feature . CvM– and refer to the centered Cramér–von Mises statistic and protected-group permutation test for the reduced model, respectively. Bold -values denote statistical significance at the 5% level.
(a) Logistic regression
(b) Random forest
(c) Gradient boosting
(d) MLP
Figure 5: Fairness explainability across features under imbalanced protected-group representation. The figures report the normalized fairness contribution () obtained by removing each predictor and re-estimating the corresponding classifier. Positive contributions are shown in green and indicate that removing the corresponding feature increases RGF and therefore improves fairness. Negative contributions are shown in red and indicate that removing the feature decreases RGF and therefore worsens fairness.
Table 4: Main fairness contributions of individual features and associated changes in predictive performance under imbalanced protected-group representation
Model Removed feature ROC–AUC PR–AUC Logistic regression loan_purpose 0.0796 minority_population -0.0044 co_applicant_sex 0.0036 loan_type -0.0018 number_of_owner_occupied_units 0.0015 Random forest loan_purpose 0.2530 minority_population -0.0227 hud_median_family_income 0.0096 loan_amount_000s -0.0062 number_of_owner_occupied_units 0.0026 Gradient boosting loan_purpose 0.0371 applicant_sex -0.0018 tract_to_msamd_income -0.0016 minority_population -0.0015 loan_amount_000s -0.0014 MLP loan_purpose 0.0499 number_of_1_to_4_family_units 0.0071 lien_status 0.0070 applicant_sex 0.0064 minority_population 0.0061
Notes: For each classifier, the five predictors with the largest absolute normalized fairness contributions, , are reported. measures the change in fairness after removing predictor and re-estimating the classifier. For , indicates improved fairness, indicates worsened fairness, and indicates no change at the reported precision. denotes the normalized fairness contribution. ROC–AUC and PR–AUC measure changes in predictive performance relative to the full model; denotes an improvement, a deterioration, and no change at the reported precision.
Table 4 could distinguish features whose removal yields a fairness gain at limited predictive cost, from those for which improved fairness is obtained at the expense of a substantial loss in classification performance. The evidence in the Table shows that the variable whose removal yields the largest fairness gain, loan_purpose, also has a high removal cost. Other variables, less important from a fairness gain, also have a negligible elimination cost: this is the case, for example, for the co_applicant_sex variable.
From a credit lending perspective, our analysis complements the findings of Giudici and Kolesnikov (2026). Using the same HMDA data to assess accuracy, explainability, and robustness, the authors identify logistic regression as the model with the strongest integrated performance. The fairness analysis adds a further dimension to this comparison. In particular, the results show that descriptive fairness measures should be considered alongside formal inference, especially under pronounced imbalance in protected group representation. Random Forest provides a clear example: it records the highest AURGF and the lowest centered Cramér–von Mises statistic among the four models, indicating the smallest distributional disparity. Nevertheless, the permutation test remains significant, so the model cannot be regarded as fair. This distinction illustrates the value of complementing descriptive fairness measures with statistical inference when comparing models for credit lending applications.
4.3 HMDA data, balanced
For robustness, we now balance the HMDA data and repeat the analysis. To construct a group-balanced setting for the fairness assessment, the majority group was randomly undersampled, without replacement, to match the size of the minority group, using a fixed seed. The resulting dataset is equally divided between the two protected groups. Following undersampling, the target distribution comprised 75.83% negative outcomes and 24.17% positive outcomes. Because sampling was conditioned exclusively on protected-group membership, the change in outcome prevalence arose from the association between group membership and the target in the original data; the outcome itself was not directly resampled. The protected attribute was excluded from the predictor matrix and retained solely for the subsequent fairness audit.
We tuned hyperparameters separately under the two sampling designs. We first tuned on the original imbalanced dataset for the full-sample analysis. After protected-group undersampling, we repeated the full tuning procedure on the balanced dataset. The configurations described below therefore apply exclusively to the balanced-group experiment and were not transferred from the full-sample models.
Logistic regression was selected with , a convergence tolerance of , and no class weighting. The random forest comprised 700 trees and employed bootstrap sampling, the log-loss splitting criterion, a maximum depth of 8, a maximum-feature proportion of , a minimum leaf size of 3, and a minimum split size of 13. Gradient boosting was specified with 314 estimators, a learning rate of , a maximum depth of 5, square-root feature sampling, a subsampling rate of , a minimum leaf size of 17, and a minimum split size of 9. The MLP comprised three hidden layers containing , , and neurons, respectively, with hyperbolic-tangent activation, a batch size of 512, an regularization parameter of , an initial learning rate of , and a no-improvement stopping window of 10 iterations. We evaluated the final models on a held-out test partition. The resulting predictive performance and fairness estimates are reported in Table 5.
Table 5: Predictive performance and rank-based fairness results after protected-group undersampling
Predictive performance Rank-based fairness Statistical inference Model ROC–AUC PR–AUC RGD RGF RGF 95% CI AURGF CvM– Permutation -value Logistic regression 0.7028 0.4252 0.1906 0.8094 [0.7930, 0.8234] 0.6023 70.6250 0.0005 0.0101 Random forest 0.7296 0.4817 0.2123 0.7877 [0.7607, 0.8152] 0.5492 28.0435 0.0005 0.0101 Gradient boosting 0.7327 0.4903 0.1744 0.8256 [0.8077, 0.8409] 0.6790 65.3432 0.0005 0.0101 MLP 0.7122 0.4541 0.1892 0.8108 [0.7918, 0.8259] 0.6417 67.8869 0.0005 0.0101
Notes: Results are computed after random undersampling of the majority protected group, yielding two equally sized groups. Values in brackets are 95% group-stratified bootstrap confidence intervals for RGF. CvM– denotes the centered observed Cramér–von Mises statistic. Permutation -values are based on protected-label permutations. Bold entries indicate the best predictive performance, the lowest RGD and CvM–, and the highest RGF and AURGF, whereas bold -values denote statistical significance at the 5% level. The quantity denotes the smallest top-burden fraction used to construct the partial RGF curve.
Table 5 shows a different model ranking after undersampling the majority protected group. On the original imbalanced sample, Random Forest records the highest RGF and AURGF, whereas Gradient Boosting achieves the best classification performance. After undersampling, Gradient Boosting ranks first in both predictive performance and descriptive fairness, with the highest ROC–AUC, PR–AUC, RGF, and AURGF.
This change is closely related to the composition of the outcome variable. Approved loans are more strongly represented in the privileged group (majority), so undersampling this group reduces the share of approvals and increases the proportion of declined applications from 18.37% to 24.17%. The resulting target is therefore less imbalanced, which provides more favorable conditions for classification and, importantly, a more balanced setting for interpreting RGF and AURGF. This is consistent with the simulation results, which showed that severe protected-group imbalance can distort descriptive fairness measures. Gradient Boosting also produced the lowest prediction errors in the unfair simulation scenario, where the permutation test remained non-significant over the initial retained fractions. Because the proposed fairness measures are constructed from prediction error burdens, this result coherently explains the joint improvement in predictive performance and descriptive fairness observed after undersampling. Nevertheless, the permutation -value remains significant in the balanced HMDA sample, showing that the statistical evidence of disparity persists despite the more favorable RGF and AURGF values.
4.4 Comparison with classical fairness metrics
Table 6 highlights the distinction between the conventional fairness criteria and the perspective developed in this paper. Logistic regression records the smallest SPD, EOD, FPR difference, and PPD, although it also has the lowest PR–AUC (). Random Forest, by contrast, records the lowest DI (), while performing less favorably on the other classical criteria. These conflicting signals align with the documented sensitivity of classical fairness measures to class and protected-group imbalance (Brzezinski et al., 2024). They do not allow a conclusive fairness evaluation for the HMDA data.
The proposed framework addresses fairness at a different level. Rather than assessing parity from classification outcomes alone, RGF and AURGF evaluate how error burdens are distributed across protected groups, thereby linking fairness to predictive reliability. This perspective explains why Random Forest, despite its less favorable classical metrics, attains the highest RGF and AURGF. However, the simulated data application shows that severe group imbalance can affect descriptive rank-based measures. Our proposed permutation test provides the necessary correction, leading to the lowest centered Cramér–von Mises statistic for the Random Forest model. The test rejects the fairness null hypotheses for all four classifiers, providing conclusive evidence that unfairness in the HMDA application is native to the data and does not depend on the machine learning model considered. We also note that classical metrics do not identify which explanatory variables, if any, explain unfairness. Our framework instead, as shown in 4.2.1, identifies loan_purpose as the most important feature.
Taken together, the results from comparing our proposal with classical fairness metrics show that trustworthy AI assessment requires moving beyond parity measures toward a joint evaluation of predictive accuracy, fairness, and statistical evidence at the individual level.
Table 6: Classical fairness metrics on the original dataset with imbalanced protected groups
Model SPD DI EOD FPR difference PPD Logistic regression 0.0150 11.4081 0.0203 0.0118 0.0093 Random forest 0.2071 1.6852 0.1566 0.1627 0.1284 Gradient boosting 0.0706 2.7861 0.0766 0.0419 0.0149 MLP 0.0388 2.4498 0.0391 0.0195 0.0298
Notes: SPD denotes statistical parity difference, DI disparate impact, EOD equal opportunity difference, FPR difference, the difference in false positive rates, and PPD predictive parity difference.
5 Conclusions
This paper contributes to the literature on fairness in algorithmic decisions, specifically in credit lending, by proposing a framework that quantifies, localizes, and explains disparities in machine learning models.
It does so by means of four related methodologies: i) the definition of a SAFE-AI Rank Graduation Fairness metric (RGF), able to quantify disparities in prediction error burdens; ii) the development of a permutation test, based on a centered Cramér–von Mises (CvM) statistic, to assess their statistical significance; iii) the construction of the Area Under the Rank Graduation Fairness Curve (AURGF), to determine where disparities are concentrated along the prediction error distribution; and iv) a fairness explainability procedure based on feature removal, to identify the variables associated with improvements or deteriorations in fairness.
The simulation study establishes an important distinction between descriptive and inferential fairness assessment. Under severe protected group imbalance, RGF and AURGF can be affected by group composition and may even reverse the descriptive fairness ranking. The proposed centered CvM permutation test addresses this issue by correctly distinguishing fair and unfair generating mechanisms. The simulation therefore shows that RGF and AURGF should be accompanied by statistical inference when protected groups are substantially imbalanced.
The application to the HMDA data provides further evidence. Unlike classical parity criteria, which produce model rankings at the group level, the proposed framework evaluates fairness through the distribution of prediction errors. This establishes a direct link between fairness and predictive accuracy, an important consideration in algorithmic decisions and credit scoring, where it is important to identify for which individuals unfairness arises, and for which reasons. The ensemble tree models perform particularly well in this respect. Random Forest provides the strongest descriptive fairness results on the original imbalanced sample, whereas, after protected group undersampling, Gradient Boosting achieves both the highest predictive performance and the highest RGF and AURGF.
The proposed statistical tests better qualify these descriptive rankings. The fairness null is rejected for all four classifiers, irrespective of whether the model is a logistic regression, an ensemble tree, or a neural network. The persistence of the result across learning architectures suggests the observed disparity is not specific to any one classifier. Rather, it is consistent with systematic group differences embedded in the lending data. This interpretation aligns with Bhutta et al. (2025), who show that racial differences in mortgage decisions can persist in race-blind automated decision systems, regardless of the model used.
The fairness explainability analysis reinforces this conclusion. Loan purpose is consistently the most influential variable, and removing it yields the largest fairness improvements, though at a non-negligible cost in predictive performance. In addition, disparity stays statistically significant after its exclusion. Unfairness in the HMDA application therefore cannot be removed by eliminating predictors. The findings illustrate the value of combining fairness explainability with inference rather than interpreting improvements in descriptive fairness as evidence that disparity has been eliminated.
We finally remark that the proposed methodology is quite general. By defining fairness in terms of the distribution of prediction errors, it establishes a direct connection between fairness, predictive accuracy, and explainability. Although in this paper we have considered the credit lending data, the most analyzed algorithmic decision setting, likely because of its highly regulated environment, the methodology can be equally applied to similar algorithmic decisions: for example, in student admission, job candidate ranking, medical diagnosis, cyber attack detection, and judicial decisions. Future work could extend the application to these domains.
Data and reproducibility
The empirical analysis uses 2017 Home Mortgage Disclosure Act (HMDA) data for New York State, obtained from the Consumer Financial Protection Bureau (CFPB). The data are publicly available through the CFPB HMDA historic data repository.
The Python code employed for the empirical analysis in this paper is available from the authors upon request.
References
S. Agarwal, C. B. Muckley, and P. Neelakantan Countering racial discrimination in algorithmic lending: a case for model-agnostic interpretation methods. Economics letters 226, pp. 111117. Cited by: §2.2, §4.2.
G. Auricchio, A. E. Bernardelli, P. Giudici, and G. Toscani On rank graduation metrics for high–dimensional ordinal data. Mathematical Models and Methods in Applied Sciences 36 (08), pp. 1679–1713. Cited by: §3.2, §3.2.
G. Babaei, P. Giudici, and P. Neelakantan Explainability, fairness and the simpson’s paradox in credit lending. Physica A: Statistical Mechanics and its Applications, pp. 131030. Cited by: §1, §2.2, §4.2.
G. Babaei, P. Giudici, and E. Raffinetti A rank graduation box for safe ai. Expert systems with applications 259, pp. 125239. Cited by: §1.
S. Barocas and A. D. Selbst Big data’s disparate impact. California law review, pp. 671–732. Cited by: §3.1.
N. Bhutta, A. Hizmo, and D. Ringo How much does racial bias affect mortgage lending? evidence from human and algorithmic credit decisions. The Journal of Finance 80 (3), pp. 1463–1496. Cited by: §5.
T. Bono, K. Croxson, and A. Giles Algorithmic fairness in credit scoring. Oxford Review of Economic Policy 37 (3), pp. 585–617. Cited by: §2.1.
D. Brzezinski, J. Stachowiak, J. Stefanowski, I. Szczech, R. Susmaga, S. Aksenyuk, U. Ivashka, and O. Yasinskyi Properties of fairness measures in the context of varying class imbalance and protected group ratios. ACM Transactions on Knowledge Discovery from Data 18 (7), pp. 1–18. Cited by: §4.1, §4.4.
A. Castelnovo, R. Crupi, G. Greco, D. Regoli, I. G. Penco, and A. C. Cosentini A clarification of the nuances in the fairness metrics landscape. Scientific reports 12 (1), pp. 4209. Cited by: §1.
A. Chouldechova Fair prediction with disparate impact: a study of bias in recidivism prediction instruments. Big data 5 (2), pp. 153–163. Cited by: §3.1.
G. Cornacchia, V. W. Anelli, G. M. Biancofiore, F. Narducci, C. Pomo, A. Ragone, and E. Di Sciascio Auditing fairness under unawareness through counterfactual reasoning. Information Processing & Management 60 (2), pp. 103224. Cited by: §3.4.
J. Curry, X. Dang, and H. Sang A rank-based cramér–von-mises-type test for two samples. Brazilian Journal of Probability and Statistics 33 (3), pp. 425–454. Cited by: §3.2.1.
A. Ehrhardt, C. Biernacki, V. Vandewalle, P. Heinrich, and S. Beben Reject inference methods in credit scoring. Journal of Applied Statistics 48 (13-15), pp. 2734–2754. Cited by: §1.
P. Garg, J. Villasenor, and V. Foggo Fairness metrics: a comparative analysis. In 2020 IEEE international conference on big data (Big Data), pp. 3662–3666. Cited by: §1, §3.1.
P. Giudici and V. Kolesnikov SAFE ai metrics: an integrated approach. Machine Learning with Applications, pp. 100821. Cited by: §1, §2.3, §3.1, §3.3, §4.2.1, §4.2.
P. Giudici and E. Raffinetti SAFE artificial intelligence in finance. Finance Research Letters 56, pp. 104088. Cited by: §1, §2.3.
P. Giudici and E. Raffinetti RGA: a unified measure of predictive accuracy: p. giudici, e. raffinetti. Advances in Data Analysis and Classification 19 (1), pp. 67–93. Cited by: §2.3.
M. Hardt, E. Price, and N. Srebro Equality of opportunity in supervised learning. Advances in neural information processing systems 29. Cited by: §3.1.
C. Hurlin, C. Pérignon, and S. Saurin The fairness of credit scoring models. Management Science 72 (1), pp. 406–425. Cited by: §1, §2.1.
J. Kleinberg, S. Mullainathan, and M. Raghavan Inherent trade-offs in the fair determination of risk scores. arXiv preprint arXiv:1609.05807. Cited by: §3.1.
N. Kozodoi, J. Jacob, and S. Lessmann Fairness in credit scoring: assessment, implementation and profit implications. European Journal of Operational Research 297 (3), pp. 1083–1094. Cited by: §1, §1, §2.1.
S. M. Lundberg and S. Lee A unified approach to interpreting model predictions. Advances in neural information processing systems 30. Cited by: §1.
D. Pessach and E. Shmueli Algorithmic fairness. In Machine Learning for Data Science Handbook: Data Mining and Knowledge Discovery Handbook, pp. 867–886. Cited by: §3.1.
B. Phipson and G. K. Smyth Permutation p-values should never be zero: calculating exact p-values when permutations are randomly drawn. arXiv preprint arXiv:1603.05766. Cited by: §3.2.1.
M. T. Ribeiro, S. Singh, and C. Guestrin " Why should i trust you?" explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD international conference on knowledge discovery and data mining, pp. 1135–1144. Cited by: §1.
S. Wachter, B. Mittelstadt, and C. Russell Counterfactual explanations without opening the black box: automated decisions and the gdpr. arXiv preprint arXiv:1711.00399. Cited by: §1.
R. Zemel, Y. Wu, K. Swersky, T. Pitassi, and C. Dwork Learning fair representations. In International conference on machine learning, pp. 325–333. Cited by: §3.1.
Appendix A Theoretical Foundation of the Permutation -Value
A.1 Null Hypothesis and Test Statistic
Let
denote the observed error burdens, and let
denote the corresponding protected-group labels. The permutation test considers the null hypothesis:
Under , protected-group membership carries no systematic information about the distribution of error burdens. The error values and their ordering are therefore held fixed, while the group labels are reassigned subject to the observed group sizes. For groups and , the observed Cramér–von Mises statistic is:
Larger values indicate greater separation between the completed group curves and hence provide stronger evidence against . For notational simplicity, the pairwise subscripts are omitted below.
A.2 Exact Randomization Distribution
Let denote the set of all admissible assignments of the group labels that preserve the observed group sizes. For each assignment , the completed group curves are recomputed, and the corresponding statistic is obtained as:
When all admissible assignments can be enumerated, the exact permutation -value is:
For two groups of sizes and , the number of admissible assignments is:
Thus, is the proportion of admissible label assignments producing a curve separation at least as large as the observed separation.
A.3 Monte Carlo Permutation -Value
Exhaustive enumeration may be computationally infeasible when the number of admissible assignments is large. In that case, admissible permutations are sampled, and
denotes the observed number of permutation statistics at least as large as . The corrected Monte Carlo permutation -value is:
The correction is based on the number of exceedances expected under when only permutations are performed. Let denote the random number of exceedances among Monte Carlo permutations, with its observed realization, and let denote the underlying probability that a statistic generated under is at least as large as the observed statistic. Conditional on :
Under , the observed statistic can occupy any position in the continuous null distribution. Therefore, is uniformly distributed over . Consequently, for :
The integral equals for every possible value of . Therefore, under , each possible exceedance count from to has the same probability. After observing exceedances, the probability of obtaining or fewer exceedances under is:
The denominator reflects the possible exceedance counts, , whereas the numerator reflects the outcomes contained in the event , namely . When ties occur, the non-strict comparison counts permutation statistics equal to the observed statistic as equally extreme. This convention may increase the resulting -value and therefore yields a conservative test. Accordingly:
This establishes finite-sample control of the type I error rate. Because , the attainable -values are:
and the minimum attainable value is:
Consequently, a finite Monte Carlo permutation procedure cannot produce a zero -value. If none of the sampled permutation statistics is at least as large as , then and .