## fairadapt : Causal Reasoning for Fair Data Pre-processing
Drago Plečko ETH Zürich
Nicolas Bennett ETH Zürich
## Abstract
Machine learning algorithms are useful for various predictions tasks, but they can also learn how to discriminate, based on gender, race or other sensitive attributes. This realization gave rise to the field of fair machine learning, which aims to measure and mitigate such algorithmic bias. This manuscript describes the R -package fairadapt , which implements a causal inference pre-processing method. By making use of a causal graphical model and the observed data, the method can be used to address hypothetical questions of the form 'What would my salary have been, had I been of a different gender/race?'. Such individual level counterfactual reasoning can help eliminate discrimination and help justify fair decisions. We also discuss appropriate relaxations which assume certain causal pathways from the sensitive attribute to the outcome are not discriminatory.
Keywords : algorithmic fairness, causal inference, machine learning.
## 1. Introduction
Machine learning algorithms have become prevalent tools for decision-making in socially sensitive situations, such as determining credit-score ratings or predicting recidivism during parole. It has been recognized that algorithms are capable of learning societal biases, for example with respect to race (Larson, Mattu, Kirchner, and Angwin 2016) or gender (Lambrecht and Tucker 2019; Blau and Kahn 2003), and this realization seeded an important debate in the machine learning community about fairness of algorithms and their impact on decision-making.
In order to define and measure discrimination, existing intuitive notions have been statistically formalized, thereby providing fairness metrics. For example, demographic parity (Darlington 1971) requires the protected attribute A (gender/race/religion etc.) to be independent of a constructed classifier or regressor ̂ Y , written as ̂ Y ⊥ ⊥ A . Another notion, termed equality of odds (Hardt, Price, Srebro et al. 2016), requires equal false positive and false negative rates of classifier ̂ Y between different groups (females and males for example), written as ̂ Y ⊥ ⊥ A | Y . To this day, various different notions of fairness exist, which are sometimes incompatible (Corbett-Davies and Goel 2018), meaning not of all of them can be achieved for a predictor ̂ Y simultaneously. There is still no consensus on which notion of fairness is the correct one.
The discussion on algorithmic fairness is, however, not restricted to the machine learning domain. There are many legal and philosophical aspects that have arisen. For example, the legal distinction between disparate impact and disparate treatment (McGinley 2011) is important for assessing fairness from a judicial point of view. This in turn emphasizes the
Nicolai Meinshausen ETH Zürich
importance of the interpretation behind the decision-making process, which is often not the case with black-box machine learning algorithms. For this reason, research in fairness through a causal inference lens has gained attention.
A possible approach to fairness is the use of counterfactual reasoning (Galles and Pearl 1998), which allows for arguing what might have happened under different circumstances that never actually materialized, thereby providing a tool for understanding and quantifying discrimination. For example, one might ask how a change in sex would affect the probability of a specific candidate being accepted for a given job opening. This approach has motivated another notion of fairness, termed counterfactual fairness (Kusner, Loftus, Russell, and Silva 2017), which states that the decision made, should remain fixed, even if, hypothetically, some parameters such as race or gender were to be changed (this can be written succinctly as ̂ Y ( a ) = ̂ Y ( a ′ ) in the potential outcomes notation). Causal inference can also be used for decomposition of the parity gap measure (Zhang and Bareinboim 2018), /a80 ( ̂ Y = 1 | A = a ) -/a80 ( ̂ Y = 1 | A = a ′ ), into the direct, indirect and spurious components (yielding further insights into the demographic parity as a criterion), as well as the introduction of so-called resolving variables Kilbertus, Carulla, Parascandolo, Hardt, Janzing, and Schölkopf (2017), in order to relax the possibly prohibitively strong notion of demographic parity.
The following sections describe an implementation of the fair data adaptation method outlined in Plecko and Meinshausen (2020), which combines the notions of counterfactual fairness and resolving variables, and explicitly computes counterfactual values for individuals. The implementation is available as R -package fairadapt from CRAN. Currently there are only few packages distributed via CRAN that relate to fair machine learning. These include fairml (Scutari 2021), which implements the non-convex method of Komiyama, Takeda, Honda, and Shimao (2018), as well as packages fairness (Kozodoi and V. Varga 2021) and fairmodels (Wiśniewski and Biecek 2021), which serve as diagnostic tools for measuring algorithmic bias and provide several pre- and post-processing methods for bias mitigation. The only causal method, however, is presented by fairadapt . Even though theory in fair machine learning is being expanded at an accelerating pace, good quality implementations of the developed methods are often not available.
The rest of the manuscript is organized as follows: In Section 2 we describe the methodology behind fairadapt , together with quickly reviewing some important concepts of causal inference. In Section 3 we discuss implementation details and provide some general user guidance, followed by Section 4, which illustrates the usage of fairadapt through a large, real-world dataset and a hypothetical fairness application. Finally, in Section 5 we elaborate on some extensions, such as Semi-Markovian models and resolving variables.
## 2. Methodology
First, the intuition behind fairadapt is described using an example, followed by a more rigorous mathematical formulation, using Markovian structural causal models (SCMs). Some relevant extensions, such as the Semi-Markovian case and the introduction of so called resolving variables , are discussed in Section 5.
## 2.1. University Admission Example
Consider the example of university admission based on previous educational achievement and
Figure 1: University admission based on previous educational achievement E combined with and an admissions test score T . The protected attribute A , encoding gender, has an unwanted causal effect on E , T , as well as Y , which represents the final score used for the admission decision.
<details>
<summary>Image 1 Details</summary>

### Visual Description
## Flowchart Diagram: Process Flow with Feedback Loops
### Overview
The image depicts a directed flowchart with four nodes labeled **A**, **E**, **T**, and **Y**. Arrows indicate directional relationships between nodes, including feedback loops and a direct bypass connection. The diagram suggests a sequential process with potential for iterative or cyclical operations.
### Components/Axes
- **Nodes**:
- **A** (starting point)
- **E** (intermediate node with feedback to A)
- **T** (intermediate node with feedback from Y)
- **Y** (terminal node with feedback to T)
- **Edges**:
- **A → E**: Primary forward path
- **E → T**: Primary forward path
- **T → Y**: Primary forward path
- **E → A**: Feedback loop (backward connection)
- **Y → T**: Feedback loop (backward connection)
- **A → T**: Direct bypass connection (shortcut)
### Detailed Analysis
1. **Primary Path**:
- The main sequence progresses as **A → E → T → Y**.
- This represents a linear workflow from initiation (A) to termination (Y).
2. **Feedback Loops**:
- **E → A**: Allows re-initiation or revision of the process at node A after reaching E.
- **Y → T**: Enables re-evaluation or correction at node T after completing the process at Y.
3. **Bypass Connection**:
- **A → T**: Provides an alternative route to skip node E, suggesting conditional or optional steps in the workflow.
### Key Observations
- The diagram emphasizes **non-linear progression** due to feedback loops, indicating potential for iterative refinement.
- The **direct A → T** edge introduces ambiguity about process efficiency or decision points.
- No explicit termination condition is defined for the feedback loops, implying possible infinite cycles.
### Interpretation
This flowchart likely models a **decision-making process** or **system workflow** with:
- **Error correction**: Feedback loops (E→A, Y→T) allow revisiting prior stages for adjustments.
- **Optimization**: The A→T bypass may represent a "fast track" for experienced users or critical paths.
- **Cyclical risk**: Without termination conditions, the system could enter infinite loops (e.g., E→A→E→A...).
The absence of quantitative data or probabilistic weights on edges suggests the diagram focuses on **structural relationships** rather than performance metrics. The design prioritizes flexibility and adaptability over rigid sequencing.
</details>
an admissions test. Variable A is the protected attribute, describing candidate gender, with A = a corresponding to females and A = a ′ to males. Furthermore, let E be educational achievement (measured for example by grades achieved in school) and T the result of an admissions test for further education. Finally, let Y be the outcome of interest (final score) upon which admission to further education is decided. Edges in the graph in Figure 1 indicate how variables affect one another.
Attribute A , gender, has a causal effect on variables E , T , as well as Y , and we wish to eliminate this effect. For each individual with observed values ( a, e, t, y ) we want to find a mapping
<!-- formula-not-decoded -->
which represents the value the person would have obtained in an alternative world where everyone was female. Explicitly, to a male person with education value e , we assign the transformed value e ( fp ) chosen such that
<!-- formula-not-decoded -->
The key idea is that the relative educational achievement within the subgroup remains constant if the protected attribute gender is modified. If, for example, a male has a higher educational achievement value than 70% of males in the dataset, we assume that he would also be better than 70% of females had he been female 1 . After computing transformed educational achievement values corresponding to the female world ( E ( fp ) ), the transformed test score values T ( fp ) can be calculated in a similar fashion, but conditioned on educational achievement. That is, a male with values ( E,T ) = ( e, t ) is assigned a test score t ( fp ) such that
<!-- formula-not-decoded -->
where the value e ( fp ) was obtained in the previous step. This step can be visualized as shown in Figure 2.
As a final step, the outcome variable Y remains to be adjusted. The adaptation is based on the same principle as above, using transformed values of both education and the test score. The resulting value y ( fp ) of Y = y satisfies
<!-- formula-not-decoded -->
1 This assumption of course is not empirically testable, as it is impossible to observe both a female and a male version of the same individual.
fairadapt : Fair Data Adaptation
<details>
<summary>Image 2 Details</summary>

### Visual Description
## Line Graph: Quantile Distributions by Gender
### Overview
The image depicts a line graph comparing the probability distributions of quantiles for males and females across a variable `t`. Two curves (green for males, blue for females) illustrate the 10% and 70% quantiles, with annotations and equations indicating conditional thresholds.
### Components/Axes
- **Vertical Axis (Y-axis)**: Labeled `P(t)`, representing probability.
- **Horizontal Axis (X-axis)**: Labeled `t`, likely a time or ordinal variable.
- **Legend**: Located on the right, associating:
- **Green**: Male (10%-quantile and 70%-quantile).
- **Blue**: Female (10%-quantile and 70%-quantile).
- **Equations**:
- `T | E = e, A = a'` (Green curve condition).
- `T | E = e^(fp), A = a` (Blue curve condition).
### Detailed Analysis
1. **Green Curve (Male)**:
- **10%-quantile**: Peaks at `t ≈ 3`, with `P(t)` reaching ~0.1.
- **70%-quantile**: Peaks at `t ≈ 5`, with `P(t)` reaching ~0.7.
- Shape: Unimodal, symmetric, with a gradual rise and fall.
2. **Blue Curve (Female)**:
- **10%-quantile**: Peaks at `t ≈ 4`, with `P(t)` reaching ~0.1.
- **70%-quantile**: Peaks at `t ≈ 6`, with `P(t)` reaching ~0.7.
- Shape: Unimodal, slightly skewed right, with a sharper rise and delayed decline.
3. **Key Annotations**:
- Arrows link quantile labels to their respective peaks on each curve.
- Equations suggest conditional probabilities (`T` given `E` and `A`), with `e^(fp)` implying an exponential relationship for females.
### Key Observations
- **Gender Differences**: Female quantiles occur at higher `t` values than male quantiles (e.g., 70%-quantile at `t=6` vs. `t=5` for males).
- **Overlap**: The 10%-quantile for females (`t=4`) overlaps with the male 70%-quantile (`t=5`), suggesting potential inverse relationships in the measured variable.
- **Equations**: The presence of `e^(fp)` for females implies a multiplicative or exponential factor not present in the male condition.
### Interpretation
The graph highlights distinct distributions between genders, with females exhibiting delayed and higher peaks in quantiles. This could indicate:
- **Temporal Delay**: Females achieve higher quantiles later in `t` (e.g., 70%-quantile at `t=6` vs. `t=5` for males).
- **Conditional Factors**: The equations suggest differing thresholds (`E = e` vs. `E = e^(fp)`), possibly reflecting biological, social, or environmental variables.
- **Probability Dynamics**: The sharper rise in the female curve may imply a steeper increase in the probability of exceeding thresholds compared to males.
The data underscores the importance of gender-specific analysis in probabilistic modeling, with equations hinting at underlying mechanisms driving these differences.
</details>
t
Figure 2: A graphical visualization of the quantile matching procedure. Given a male with a test score corresponding to the 70% quantile, we would hypothesize, that if the gender was changed, the individual would have achieved a test score corresponding to the 70% quantile of the female distribution.
This form of counterfactual correction is known as recursive substitution (Pearl 2009, Chapter 7) and is described more formally in the following sections. The reader who is satisfied with the intuitive notion provided by the above example is encouraged to go straight to Section 3.
## 2.2. Structural Causal Models
In order to describe the causal mechanisms of a system, a structural causal model (SCM) can be hypothesized, which fully encodes the assumed data-generating process. An SCM is represented by a 4-tuple 〈 V, U, F , /a80 ( u ) 〉 , where
- V = { V 1 , . . . , V n } is the set of observed (endogenous) variables.
- F = { f 1 , . . . , f n } is the set of functions determining V , v i ← f i (pa( v i ) , u i ), where pa( V i ) ⊂ V, U i ⊂ U are the functional arguments of f i and pa( V i ) denotes the parent vertices of V i .
- U = { U 1 , . . . , U n } are latent (exogenous) variables.
- /a80 ( u ) is a distribution over the exogenous variables U .
Any particular SCM is accompanied by a graphical model G (a directed acyclic graph), which summarizes which functional arguments are necessary for computing the values of each V i and therefore, how variables affect one another. We assume throughout, without loss of generality, that
- (i) f i (pa( v i ) , u i ) is increasing in u i for every fixed pa( v i ).
- (ii) Exogenous variables U i are uniformly distributed on [0 , 1].
In the following section, we discuss the Markovian case in which all exogenous variables U i are mutually independent. The Semi-Markovian case, where variables U i are allowed to have a mutual dependency structure, alongside the extension introducing resolving variables , are discussed in Section 5.
## 2.3. Markovian SCM Formulation
Let Y take values in ❘ and represent an outcome of interest and A be the protected attribute taking two values a, a ′ . The goal is to describe a pre-processing method which transforms the entire data V into its fair version V ( fp ) . This can be achieved by computing the counterfactual values V ( A = a ), which would have been observed if the protected attribute was fixed to a baseline value A = a for the entire sample.
More formally, going back to the university admission example above, we want to align the distributions
<!-- formula-not-decoded -->
meaning that the distribution of V i should be indistinguishable for both female and male applicants, for every variable V i . Since each function f i of the original SCM is reparametrized so that f i (pa( v i ) , u i ) is increasing in u i for every fixed pa( v i ), and also due to variables U i being uniformly distributed on [0 , 1], variables U i can be seen as the latent quantiles .
The algorithm proposed for data adaption proceeds by fixing A = a , followed by iterating over descendants of the protected attribute A , sorted in topological order. For each V i , the assignment function f i and the corresponding quantiles U i are inferred. Finally, transformed values V i ( fp ) are obtained by evaluating f i , using quantiles U i and the transformed parents pa( V i ) ( fp ) (see Algorithm 1).
```
```
The assignment functions f i of the SCM are of course unknown, but are non-parametrically inferred at each step. Algorithm 1 obtains the counterfactual values V ( A = a ) under the do ( A = a ) intervention for each individual, while keeping the latent quantiles U fixed. In the case of continuous variables, the latent quantiles U can be determined exactly, while for the discrete case, this is more subtle and described in Plecko and Meinshausen (2020, Section 5).
## 3. Implementation
In order to perform fair data adaption using the fairadapt package, the function fairadapt() is exported, which returns an object of class fairadapt . Implementations of the base R S3 generics print() , plot() and predict() , as well as the generic autoplot() , exported from ggplot2 (Wickham 2016), are provided for fairadapt objects, alongside fairadapt -specific implementations of S3 generics visualizeGraph() , adaptedData() and fairTwins() . Finally, an extension mechanism is available via the S3 generic function computeQuants() , which is used for performing the quantile learning step.
The following sections show how the listed methods relate to one another alongside their intended use, beginning with constructing a call to fairadapt() . The most important arguments of fairadapt() include:
- formula : Argument of type formula , specifying the dependent and explanatory variables.
- train.data and test.data : Both of type data.frame , representing the respective datasets.
- adj.mat : Argument of type matrix , encoding the adjacency matrix.
- prot.attr : Scalar-valued argument of type character identifying the protected attribute.
As a quick demonstration of fair data adaption using, we load the uni\_admission dataset provided by fairadapt , consisting of synthetic university admission data of 1000 students. We subset this data, using the first n\_samp rows as training data ( uni\_trn ) and the following n\_samp rows as testing data ( uni\_tst ). Furthermore, we construct an adjacency matrix uni\_adj with edges gender → edu , gender → test , edu → test , edu → score , and test → score . As the protected attribute, we choose gender .
```
```
```
```
The implicitly called print() method in the previous code block displays some information about how fairadapt() was called, such as number of variables, the protected attribute and also the total variation before and after adaptation, defined as
<!-- formula-not-decoded -->
respectively, where Y denotes the outcome variable. Total variation in the case of a binary outcome Y , corresponds to the parity gap.
## 3.1. Specifying the Graphical Model
As the algorithm used for fair data adaption in fairadapt() requires access to the underlying graphical causal model G (see Algorithm 1), a corresponding adjacency matrix can be passed as adj.mat argument. The convenience function graphModel() turns a graph specified as an adjacency matrix into an annotated graph using the igraph package (Csardi and Nepusz 2006). While exported for the user to invoke manually, this function is called as part of the fairadapt() routine and the resulting igraph object can be visualized by calling the S3 generic visualizeGraph() , exported from fairadapt on an object of class fairadapt .
```
```
A visualization of the igraph object returned by graphModel() is available from Figure 3. The graph shown is equivalent to that of Figure 1 as they both represent the same causal model.
## 3.2. Quantile Learning Step
The training step in fairadapt() can be carried out in two slightly distinct ways: Either by specifying training and testing data simultaneously, or by only passing training data (and
Figure 3: The underlying graphical model corresponding to the university admission example (also shown in Figure 1).
<details>
<summary>Image 3 Details</summary>

### Visual Description
## Directed Graph Diagram: Educational and Demographic Relationships
### Overview
The image depicts a directed graph with four nodes representing variables: "edu" (education), "gender", "score", and "test". Arrows indicate directional relationships between these variables, suggesting a model of influence or dependency.
### Components/Axes
- **Nodes**:
- `edu` (top-left)
- `gender` (top-center)
- `score` (bottom-center)
- `test` (bottom-right)
- **Edges** (directed arrows):
- `edu` → `gender`
- `edu` → `score`
- `edu` → `test`
- `gender` → `test`
- `score` → `test`
### Detailed Analysis
- **Node Connections**:
- `edu` has three outgoing edges, indicating it influences all other variables.
- `gender` and `score` each have one outgoing edge to `test`, suggesting they act as intermediaries.
- `test` has no outgoing edges, positioning it as a terminal outcome variable.
- **Pathways**:
- Two indirect pathways from `edu` to `test`: `edu` → `gender` → `test` and `edu` → `score` → `test`.
- One direct pathway: `edu` → `test`.
### Key Observations
1. **Central Role of `edu`**: Education is the primary driver, directly and indirectly affecting all other variables.
2. **Mediating Variables**: `gender` and `score` partially mediate the relationship between `edu` and `test`.
3. **Direct Effect**: The direct link from `edu` to `test` implies a residual effect of education on test performance independent of gender and score.
### Interpretation
This diagram likely represents a structural model in educational research, where:
- **Education (`edu`)** is hypothesized to impact test performance (`test`) through both direct and indirect mechanisms.
- **Gender** and **score** act as mediators, suggesting that education's effect on test outcomes may be filtered through demographic factors and prior academic performance.
- The direct edge from `edu` to `test` highlights that even after accounting for gender and score, education retains a significant influence on test results. This could imply that factors like teaching quality, curriculum, or institutional resources (captured by `edu`) have an intrinsic impact on test performance beyond demographic or intermediate variables.
The model emphasizes the complexity of educational outcomes, where multiple pathways interact to shape results. Further analysis (e.g., regression coefficients) would quantify the strength of these relationships.
</details>
at a later stage calling predict() on the returned fairadapt object in order to perform data adaption on new test data). The advantage of the former option is that the quantile regression step is performed on a larger sample size, which can lead to more precise inference in practice.
The two data frames passed as train.data and test.data are required to have column names which also appear in the row and column names of the adjacency matrix, alongside the protected attribute A , passed as scalar-valued character vector prot.attr .
The quantile learning step of Algorithm 1 can in principle be carried out by several methods, three of which are implemented in fairadapt :
- Quantile Regression Forests (Meinshausen 2006; Wright and Ziegler 2015).
- Linear Quantile Regression (Koenker and Hallock 2001; Koenker, Portnoy, Ng, Zeileis, Grosjean, and Ripley 2018).
- Non-crossing quantile neural networks (Cannon 2018, 2015).
Using linear quantile regression is the most efficient option in terms of runtime, while for non-parametric models and mixed data, the random forest approach is well-suited, at the expense of a slight increase in runtime. The neural network approach is, substantially slower when compared to linear and random forest estimators and consequently does not scale well to large sample sizes. As default, the random forest based approach is implemented, due to its non-parametric nature and computational speed. However, for smaller sample sizes, the neural network approach can also demonstrate competitive performance. A quick summary outlining some differences between the three natively supported methods is available from Table 1.
The above set of methods is not exhaustive. Further options are conceivable and therefore fairadapt provides an extension mechanism to account for this. The fairadapt() argument quant.method expects a function to be passed, a call to which will be constructed with three unnamed arguments:
1. A data.frame containing data to be used for quantile regression. This will either be the data.frame passed as train.data , or depending on whether test.data was specified, a row-bound version of train and test datasets.
Table 1: Summary table of different quantile regression methods. n is the number of samples, p number of covariates, n epochs number of training epochs for the neural network. T ( n, 4) denotes the runtime of different methods on the university admission dataset, with n training and testing samples.
| | Random Forests | Neural Networks | Linear Regression |
|--------------------|-------------------------|----------------------------------------------|-------------------------------------------------------|
| R -package | ranger | qrnn | quantreg |
| quant.method | rangerQuants | mcqrnnQuants | linearQuants |
| complexity | O ( np log n ) | O ( npn epochs ) | O ( p 2 n ) |
| default parameters | ntrees = 500 mtry = √ p | 2-layer fully connected feed-forward network | "br" method of Barrodale and Roberts used for fitting |
| T (200 , 4) | 0 . 4 sec | 89 sec | 0 . 3 sec |
| T (500 , 4) | 0 . 9 sec | 202 sec | 0 . 5 sec |
2. A logical flag, indicating whether the protected attribute is the root node of the causal graph. If the attribute A is a root node, we know that /a80 ( X | do( A = a )) = /a80 ( X | A = a ). Therefore, the interventional and conditional distributions are in this case the same, and we can leverage this knowledge in the quantile learning procedure, by splitting the data into A = 0 and A = 1 groups.
3. A logical vector of length nrow(data) , indicating which rows in the data.frame passed as data correspond to samples with baseline values of the protected attribute.
Arguments passed as ... to fairadapt() will be forwarded to the function specified as quant.method and passed after the first three fixed arguments listed above. The return value of the function passed as quant.method is expected to be an S3-classed object. This object should represent the conditional distribution V i | pa( V i ) (see function rangerQuants() for an example). Additionally, the object should have an implementation of the S3 generic function computeQuants() available. For each row ( v i , pa( v i )) of the data argument, the computeQuants() function uses the S3 object to (i) infer the quantile of v i | pa( v i ); (ii) compute the counterfactual value v ( fp ) i under the change of protected attribute, using the counterfactual values of parents pa( v ( fp ) i ) computed in previous steps (values pa( v ( fp ) i ) are contained in the newdata argument). For an example, see computeQuants.ranger() method.
## 3.3. Fair-Twin Inspection
The university admission example presented in Section 2 demonstrates how to compute counterfactual values for an individual while preserving their relative educational achievement. Setting candidate gender as the protected attribute and gender level female as baseline value, for a male student with values ( a, e, t, y ), his fair-twin values ( a ( fp ) , e ( fp ) , t ( fp ) , y ( fp ) ), i.e., the values the student would have obtained, had he been female , are computed. These values can be retrieved from a fairadapt object by calling the S3-generic function fairTwins() as:
```
```
```
```
```
```
In this example, we compute the values in a female world. Therefore, for female applicants, the values remain fixed, while for male applicants the values are adapted, as can be seen from the output.
## 4. Illustration
As a hypothetical real-world use of fairadapt , suppose that after a legislative change the US government has decided to adjust the salary of all of its female employees in order to remove both disparate treatment and disparate impact effects. To this end, the government wants to compute the counterfactual salary values of all female employees, that is the salaries that female employees would obtain, had they been male.
To do this, the government is using data from the 2018 American Community Survey by the US Census Bureau, available in pre-processed form as a package dataset from fairadapt . Columns are grouped into demographic ( dem ), familial ( fam ), educational ( edu ) and occupational ( occ ) categories and finally, salary is selected as response ( res ) and sex as the protected attribute ( prt ):
```
```
<details>
<summary>Image 4 Details</summary>

### Visual Description
## Flowchart: Node-Based System Architecture
### Overview
The image depicts a directed graph (flowchart) with six nodes labeled A, D, F, E, W, and Y. Arrows indicate directional relationships between nodes, with one dashed arrow (A→D) and multiple solid arrows. The structure suggests a network of interconnected processes or entities.
### Components/Axes
- **Nodes**:
- A (top-left)
- D (top-right)
- F (bottom-left)
- E (center-left)
- W (center-right)
- Y (bottom-right)
- **Arrows**:
- Solid arrows represent standard directional relationships.
- Dashed arrow (A→D) indicates a distinct or weaker connection.
- **Self-loop**: Node Y has a circular arrow, suggesting a feedback or recursive process.
### Detailed Analysis
1. **Node A**:
- Connects to F, E, W, Y (solid arrows).
- Has a dashed arrow to D, implying a non-standard or optional relationship.
2. **Node D**:
- Receives input from A (dashed) and connects to W and Y (solid).
3. **Node F**:
- Connects to E and W (solid arrows).
4. **Node E**:
- Receives input from F and A, connects to W.
5. **Node W**:
- Central hub: Receives input from A, F, E, and D; connects to Y.
6. **Node Y**:
- Receives input from A, D, W.
- Self-loop (Y→Y) indicates a recursive or cyclical process.
### Key Observations
- **Central Hub**: Node W acts as a convergence point for multiple inputs (A, F, E, D) and outputs to Y.
- **Dashed Connection**: The A→D relationship is visually distinct, possibly denoting a weaker, optional, or indirect link.
- **Feedback Loop**: Y’s self-loop suggests a process that reinforces itself or requires iterative evaluation.
- **Asymmetry**: Node A has the most outgoing connections, while Y has the most incoming (including its self-loop).
### Interpretation
This flowchart likely represents a system where:
- **A** is a primary initiator or source, distributing influence to multiple nodes (F, E, W, Y) and weakly to D.
- **W** serves as a critical intermediary, aggregating inputs and directing output to Y.
- **Y**’s self-loop implies a process requiring continuous feedback (e.g., validation, iteration, or stabilization).
- The dashed A→D arrow may represent an exception, contingency, or secondary pathway in the system.
The structure emphasizes redundancy (multiple paths to W/Y) and resilience, with potential vulnerabilities at the central hub (W). The dashed arrow introduces ambiguity, suggesting the need for further clarification on its role (e.g., error handling, alternative routing).
</details>
Figure 4: The causal graph for the government-census dataset. D are demographic features, A is gender, F represents marital and family information, E education, W work-related information and Y the salary, which is also the outcome of interest.
| 6: | 3 hours_worked | 1 weeks_worked | 18 occupation | industry | 0 28000 economic_region |
|------|------------------|------------------|-----------------|------------|---------------------------|
| 1: | 56 | 49 | 13-1081 | 928P | Southeast |
| 2: | 42 | 49 | 29-2061 | 6231 | Southeast |
| 3: | 50 | 49 | 25-1000 | 611M1 | Southeast |
| 4: | 50 | 49 | 25-1000 | 611M1 | Southeast |
| 5: | 40 | 49 | 27-1010 | 611M1 | Southeast |
| 6: | 40 | 49 | 43-6014 | 6111 | Southeast |
```
```
The hypothesized causal graph for the dataset is given in Figure 4. According to this, the causal graph can be specified as an adjacency matrix gov\_adj and as confounding matrix gov\_cfd :
```
```
```
```
Before applying fairadapt() , we first log-transform the salaries and look at respective densities by sex group. We subset the data by using n\_samp samples for training and n\_pred samples for predicting and plot the data before performing the adaption.
```
```
There is a clear shift between the two sexes, indicating that male employees are currently better compensated when compared to female employees. However, this differences in salary could, in principle, be attributed to factors apart form gender inequality, such as the economic region in which an employee works. This needs to be accounted for as well, i.e., we do not wish to remove differences in salary between economic regions.
```
```
After performing the adaptation, we can investigate whether the salary gap has shrunk. The densities after adaptation can be visualized using the ggplot2 -exported S3 generic function autoplot() :
```
```
- gender")
If we are provided with additional testing data, and wish to adapt this as well, we can use the base R S3 generic function predict() :
```
```
Figure 5: Full causal graph for the government census dataset, expanding the grouped view presented in Figure 4. Demographic features include age ( ag ), race ( ra ), whether an employee is of Hispanic origin ( hi ), is US citizen ( ci ), whether the citizenship is native ( na ), alongside the corresponding economic region ( ec ). Familial features are marital status ( ma ), family size ( fa ) and number of children ( ch ), educational features include education ( ed ) and English language levels ( en ), and occupational features, weekly working hours ( ho ), yearly working weeks ( we ), job ( oc ) and industry identifiers ( in ). Finally, the yearly salary ( sa ) is used as the response variable and employee sex ( se ) as the protected attribute variable.
<details>
<summary>Image 5 Details</summary>

### Visual Description
## Network Diagram: Relationships Between Categorized Entities
### Overview
The image depicts a network diagram illustrating connections between 16 labeled nodes, each representing a distinct entity. Nodes are color-coded according to six categories (demographic, familial, protected, occupational, educational, response), with directional edges (arrows) indicating relationships. The diagram emphasizes interconnectedness, with dense clustering in certain regions and sparse connections in others.
### Components/Axes
- **Legend**: Located at the bottom center, mapping colors to categories:
- Red: Demographic
- Green: Familial
- Blue: Protected
- Teal: Occupational
- Yellow: Educational
- Purple: Response
- **Nodes**: 16 labeled entities (e.g., "ra," "ec," "ag") positioned across the diagram. Colors align with the legend.
- **Edges**: Black lines with arrows (directional) and some dashed lines (uncertain significance).
### Detailed Analysis
#### Node Labels and Colors
1. **Demographic (Red)**:
- `ra`, `ec`, `ag`, `ci`, `hi`, `na` (6 nodes).
- Positioned at the top (`ra`, `ec`), right (`ag`), left (`ci`, `hi`), and bottom (`na`).
2. **Familial (Green)**:
- `ch`, `fa`, `ma` (3 nodes).
- Central (`ch`, `fa`), middle (`ma`).
3. **Protected (Blue)**:
- `se` (1 node).
- Central-left.
4. **Occupational (Teal)**:
- `oc`, `in`, `ho`, `we` (4 nodes).
- Top-left (`oc`, `in`), bottom-right (`ho`, `we`).
5. **Educational (Yellow)**:
- `en`, `ed` (2 nodes).
- Lower-center (`en`, `ed`).
6. **Response (Purple)**:
- `sa` (1 node).
- Central.
#### Edge Characteristics
- **Directional Arrows**: Most edges have solid black arrows indicating flow (e.g., `ra` → `ec`, `ch` → `sa`).
- **Dashed Lines**: A few edges (e.g., `se` → `ed`) use dashed lines, possibly denoting weaker or indirect relationships (uncertain without explicit legend clarification).
### Key Observations
1. **Central Hub**: The "response" node (`sa`, purple) acts as a central connector, linking to 8+ nodes (e.g., `ra`, `ec`, `ch`, `fa`, `en`, `ed`).
2. **Demographic Cluster**: Red nodes (`ra`, `ec`, `ag`, `ci`, `hi`, `na`) form a dense subnetwork, suggesting strong interconnections within this category.
3. **Educational-Occupational Links**: Yellow (`en`, `ed`) and teal (`oc`, `in`, `ho`, `we`) nodes are interconnected, implying relationships between education and occupational sectors.
4. **Protected Node Isolation**: The blue node (`se`) has fewer connections, primarily linking to educational (`ed`) and familial (`ch`) nodes.
5. **Dashed Edges**: Uncertainty exists around the meaning of dashed lines (e.g., `se` → `ed`), which may represent indirect or secondary relationships.
### Interpretation
The diagram likely models a system where entities (nodes) interact across categories (e.g., demographic, familial). The central "response" node (`sa`) may represent a mediator or hub for cross-category communication. The dense demographic cluster (`ra`, `ec`, `ag`, etc.) suggests these entities are highly interdependent, possibly reflecting societal or structural relationships. Educational (`en`, `ed`) and occupational (`oc`, `in`, `ho`, `we`) nodes show moderate connectivity, indicating potential pathways for resource or information flow between these sectors. The isolated "protected" node (`se`) might represent a specialized or niche category with limited interactions. Dashed edges warrant further investigation to clarify their role in the network.
</details>
Figure 6: Visualization of salary densities grouped by employee sex, indicating a shift to higher values for male employees. This uses the US government-census dataset and shows the situation before applying fair data adaption, while Figure 7 presents transformed salary data.
<details>
<summary>Image 6 Details</summary>

### Visual Description
## Line Chart: Salary Density by Gender
### Overview
The chart visualizes the distribution of salaries by gender using density curves. Two overlapping lines represent female (pink) and male (teal) salary distributions across a range of salary values. The y-axis measures density (0–0.6), while the x-axis represents salary (4–12).
### Components/Axes
- **X-axis (salary)**: Labeled "salary," with increments from 4 to 12 in steps of 2.
- **Y-axis (density)**: Labeled "density," ranging from 0 to 0.6 in steps of 0.1.
- **Legend**: Positioned on the right, with "sex" as the category. Female is pink, male is teal.
- **Lines**: Two density curves:
- **Female (pink)**: Peaks at ~11.5 salary with a density of ~0.55.
- **Male (teal)**: Peaks at ~12 salary with a density of ~0.58.
### Detailed Analysis
- **Female (pink)**:
- Starts near 0 at salary 4, rises gradually, and peaks at ~11.5.
- Density declines sharply after 11.5, reaching near 0 by 12.
- **Male (teal)**:
- Starts near 0 at salary 4, rises more steeply than female.
- Peaks at ~12 with a slightly higher density (~0.58) than female.
- Declines more gradually than female after the peak.
### Key Observations
1. Male salaries cluster slightly higher (peak at 12) compared to female (peak at 11.5).
2. Male density is marginally higher at the peak (~0.58 vs. ~0.55).
3. Both distributions overlap significantly between 8–12 salary, indicating similar salary ranges but a slight male advantage at the upper end.
### Interpretation
The data suggests a gender-based disparity in salary distribution, with males earning higher salaries on average. The density curves reveal that while both genders have overlapping salary ranges, males are more concentrated at the higher end of the scale. This aligns with broader socioeconomic trends of gender pay gaps, though the chart does not account for confounding variables like industry, experience, or location. The slight difference in peak densities (~0.03) may reflect systemic biases or occupational segregation.
</details>
Figure 7: The salary gap between male and female employees of the US government according to the government-census dataset is clearly reduced when comparing raw data (see Figure 6) to transformed salary data as yielded by applying fair data adaption using employee sex as the protected attribute and assuming a causal graph as shown in Figure 5.
<details>
<summary>Image 7 Details</summary>

### Visual Description
## Line Chart: Adapted Salary Density by Gender
### Overview
The chart visualizes the distribution of adapted salaries by gender, comparing the density of salaries for females (pink) and males (teal). Both distributions are plotted on a shared x-axis (salary) and y-axis (density), with overlapping curves indicating comparative trends.
### Components/Axes
- **X-axis (Salary)**: Ranges from 4 to 12, labeled "salary."
- **Y-axis (Density)**: Ranges from 0 to 0.4, labeled "density."
- **Legend**: Positioned on the right, with:
- Pink: Female
- Teal: Male
- **Curves**:
- Female (pink): Smoother, slightly left-shifted peak.
- Male (teal): Sharper, right-shifted peak with higher density.
### Detailed Analysis
- **Female Salary Density**:
- Peak density: ~0.35 at salary ~10.
- Distribution spans ~8 to ~12, with a gradual decline on both sides.
- Left tail extends slightly below 8, indicating lower-earning outliers.
- **Male Salary Density**:
- Peak density: ~0.45 at salary ~11.
- Distribution spans ~9 to ~13, with a steeper decline on the right.
- Left tail overlaps with female distribution near ~9.
- **Overlap**: Both curves intersect between ~9.5 and ~10.5, suggesting similar densities in this range.
### Key Observations
1. **Gender Pay Gap**: Male salaries peak higher (~11 vs. ~10 for females), indicating a systemic disparity.
2. **Distribution Variability**: Male salaries are more concentrated (narrower peak), while female salaries show broader variability.
3. **Outliers**: Female distribution includes lower-earning outliers (<8), absent in the male distribution.
### Interpretation
The data suggests a persistent gender pay gap, with males earning higher salaries on average. The narrower male distribution may reflect occupational segregation or systemic biases favoring male-dominated fields. The female distribution’s broader spread could indicate underrepresentation in high-paying roles or greater diversity in job types. The overlap between ~9.5–10.5 highlights a critical intersection where salary equity is more achievable, but systemic factors still drive disparities at higher earnings tiers.
</details>
```
```
Finally, we can do fair-twin inspection using the fairTwins() function of fairadapt , to retrieve counterfactual feature values:
```
```
Values are unchanged for female individuals (as female is used as baseline level), as is the case for age , which is not a descendant of the protected attribute sex (see Figure 5). However, variables education\_level and salary do change for males, as they are descendants of the protected attribute sex .
The variable hours\_worked is also a descendant of A , and one might argue that this variable should not be adapted in the procedure, i.e., it should remain the same, irrespective of
fairadapt : Fair Data Adaptation
employee sex. This is the idea behind resolving variables , which we discuss next, in Section 5.1. It is worth emphasizing that we are not trying to answer the question of which choice of resolving variables is the correct one in the above example - this choice is left to social scientists deeply familiar with context and specifics of the above described dataset.
## 5. Extensions
Several extensions to the basic Markovian SCM formulation introduced in Section 2.3 exist, some of which are available for use in fairadapt() and are outlined in the following sections.
## 5.1. Adding Resolving Variables
Kilbertus et al. (2017) discuss that in some situations the protected attribute A can affect variables in a non-discriminatory way. For instance, in the Berkeley admissions dataset (Bickel, Hammel, and O'Connell 1975) we observe that females often apply for departments with lower admission rates and consequently have a lower admission probability. However, we perhaps would not wish to account for this difference in the adaptation procedure, if we were to argue that applying to a certain department is a choice everybody is free to make. Such examples motivated the idea of resolving variables by Kilbertus et al. (2017). A variable R is called resolving if
- (i) R ∈ de( A ), where de( A ) are the descendants of A in the causal graph G .
- (ii) The causal effect of A on R is considered to be non-discriminatory.
In presence of resolving variables, computation of the counterfactual is carried out under the more involved intervention do( A = a, R = R ( a ′ )). The potential outcome value V ( A = a, R = R ( a ′ )) is obtained by setting A = a and computing the counterfactual while keeping the values of resolving variables to those they attained naturally . This is a nested counterfactual and the difference in Algorithm 1 is simply that resolving variables R are skipped in the forloop. In order to perform fair data adaptation with the variable test being resolving in the uni\_admission dataset used in Section 3, the string "test" can be passed as res.vars to fairadapt() .
```
```
Figure 8: Visualization of the causal graph corresponding to the university admissions example introduced in Section 1 with the variable test chosen as a resolving variable and therefore highlighted in red.
<details>
<summary>Image 8 Details</summary>

### Visual Description
## Diagram: Conceptual Relationship Model
### Overview
The image depicts a directed graph with four nodes connected by arrows, representing relationships between variables. The nodes are labeled "edu," "gender," "score," and "test," with "test" highlighted in red. Arrows indicate directional influence or dependency between nodes.
### Components/Axes
- **Nodes**:
- `edu` (teal): Positioned on the left.
- `gender` (teal): Positioned at the top.
- `score` (teal): Positioned at the bottom.
- `test` (red): Positioned on the right.
- **Arrows**:
- Black arrows connect nodes, indicating directional relationships.
- No legend is present, but node colors are explicitly labeled.
### Detailed Analysis
- **Node Connections**:
- `edu` → `gender` (direct influence).
- `edu` → `score` (direct influence).
- `edu` → `test` (direct influence).
- `gender` → `test` (direct influence).
- `score` → `test` (direct influence).
- **Color Coding**:
- Teal nodes (`edu`, `gender`, `score`) represent input or intermediate variables.
- Red node (`test`) represents the output or target variable.
### Key Observations
- The diagram emphasizes `test` as the central outcome, influenced by all other nodes.
- `edu` has the most outgoing connections, suggesting it is a foundational variable.
- No numerical values or quantitative data are present; the diagram is conceptual.
### Interpretation
This diagram illustrates a causal or dependency model where education (`edu`) impacts gender, academic performance (`score`), and test outcomes (`test`). Gender and score further mediate the relationship between education and test results. The red color of `test` may symbolize its importance as the final metric. The absence of numerical data implies this is a theoretical framework rather than an empirical analysis.
## Notes
- No numerical data, charts, or tables are present.
- The diagram uses spatial positioning to emphasize the hierarchy of influence (left-to-right flow).
- No textual annotations or legends beyond node labels and colors.
</details>
Number of independent variables:
Total variation (before adaptation):
-0.6757414
Total variation (after adaptation):
-0.4101386
As can be seen from the respective model summary outputs, the total variation after adaptation, in this case, is larger than in the basic example from Section 3, with no resolving variables. The intuitive reasoning here is that resolving variables allow for some discrimination, so we expect to see a larger total variation between the groups.
```
```
A visualization of the corresponding graph is available from Figure 8, which highlights the resolving variable test in red. Apart from color, the graphical model remains unchanged from what is shown in Figure 3.
## 5.2. Semi-Markovian and Topological Ordering Variant
Section 2 focuses on the Markovian case, which assumes that all exogenous variables U i are mutually independent. However, in practice this requirement is often not satisfied. If a mutual dependency structure between variables U i exists, this is called a Semi-Markovian model. In the university admission example, we could, for example, have U test /negationslash ⊥ ⊥ U score , i.e., latent variables corresponding to variables test and final score being correlated. Such dependencies between latent variables can be represented by dashed, bidirected arrows in the causal diagram, as shown in Figures 9 and 10.
There is an important difference in the adaptation procedure for Semi-Markovian case: when inferring the latent quantiles U i of variable V i , in the Markovian case, only the direct parents pa( V i ) are needed. In the Semi-Markovian case, due to correlation of latent variables, using only the pa( V i ) can lead to biased estimates of the U i . Instead, the set of direct parents needs to be extended, as described in more detail by Tian and Pearl (2002). A brief sketch of the argument goes as follows: Let the C-components be a partition of the set V , such that each C-component contains a set of variables which are mutually connected by bidirectional edges.
fairadapt : Fair Data Adaptation
Figure 9: Causal graphical model corresponding to a Semi-Markovian variant of the university admissions example, introduced in Section 3. and visualized in its basic form in Figures 1 and 3. Here, we allow for the possibility of a mutual dependency between the latent variables corresponding to variables test and final score.
<details>
<summary>Image 9 Details</summary>

### Visual Description
## Diagram: Directed Graph with Nodes A, E, T, Y
### Overview
The image depicts a directed graph with four nodes labeled **A**, **E**, **T**, and **Y**, connected by arrows. The graph includes both solid and dashed edges, suggesting different types of relationships or flows between nodes.
### Components/Axes
- **Nodes**:
- **A** (leftmost node)
- **E** (second node, connected to A and T)
- **T** (third node, connected to E and Y)
- **Y** (rightmost node, connected to T)
- **Edges**:
- Solid arrows:
- **A → E** (direct flow from A to E)
- **E → T** (direct flow from E to T)
- **T → Y** (direct flow from T to Y)
- Dashed arrow:
- **T → Y** (alternative or conditional flow from T to Y)
### Detailed Analysis
- **Node A** initiates the flow, directing to **Node E**.
- **Node E** acts as an intermediary, connecting **A** to **T**.
- **Node T** has two outgoing paths:
- A solid arrow to **Y** (primary flow).
- A dashed arrow to **Y** (potential secondary or conditional flow).
- **Node Y** receives input from **T** but has no outgoing edges.
### Key Observations
1. The graph represents a sequential process (A → E → T → Y) with a feedback loop from **T** to **Y** via a dashed edge.
2. The dashed arrow from **T** to **Y** may indicate an optional, probabilistic, or error-handling pathway.
3. No numerical values, legends, or axis markers are present.
### Interpretation
This diagram likely models a workflow, decision tree, or state transition system. The solid edges define a mandatory progression, while the dashed edge suggests flexibility or redundancy. For example:
- **A → E → T → Y** could represent a linear process (e.g., data processing stages).
- The **T → Y** feedback loop might allow revisiting **T** under specific conditions (e.g., validation failure).
- The absence of labels on edges implies uniform weight or priority across connections, though the dashed line visually distinguishes the secondary path.
No numerical data or categorical labels are provided, so trends or quantitative analysis cannot be performed. The structure emphasizes directional dependencies and potential cyclical behavior.
</details>
Let C ( V i ) denote the entire C-component of variable V i . We then define the set of extended parents as
<!-- formula-not-decoded -->
where an( V i ) is the set of ancestors of V i . The adaptation procedure in the Semi-Markovian case in principle remains the same as outlined in Algorithm 1, with the difference that the set of direct parents pa( V i ) is replaced by Pa( V i ) at each step.
To include the bidirectional confounding edges in the adaptation, we can pass a matrix as cfd.mat argument to fairadapt() such that:
- cfd.mat has the same dimension, column and row names as adj.mat .
- As is the case with the adjacency matrix passed as adj.mat , an entry cfd.mat[i, j] == 1 indicates that there is a bidirectional edge between variables i and j .
- cfd.mat is symmetric.
The following code performs fair data adaptation of the Semi-Markovian university admission variant with a mutual dependency between the variables representing test and final scores. For this, we create a matrix uni\_cfd with the same attributes as the adjacency matrix uni\_adj and set the entries representing the bidirected edge between vertices test and score to 1. Finally, we can pass this confounding matrix as cfd.mat to fairadapt() . A visualization of the resulting causal graph is available from Figure 10.
```
```
Alternatively, instead of using the extended parent set Pa( V i ), we could also use the entire set of ancestors an( V i ). This approach is implemented as well, and available by specifying a topological ordering. This is achieved by passing a character vector, containing the correct ordering of the names appearing in names(train.data) as top.ord argument to
Figure 10: Visualization of the causal graphical model also shown in Figure 9, obtained when passing a confounding matrix indicating a bidirectional edge between vertices test and score to fairadapt() . The resulting Semi-Markovian setting is also handled by fairadapt() , extending the basic Markovian formulation introduced in Section 2.3.
<details>
<summary>Image 10 Details</summary>

### Visual Description
## Diagram: Conceptual Relationship Model
### Overview
The image depicts a conceptual relationship diagram with four nodes connected by directional arrows. The nodes represent variables ("edu," "gender," "test," "score"), and the arrows indicate relationships or influences between them. One arrow is dashed, suggesting a weaker or indirect relationship.
### Components/Axes
- **Nodes**:
- `edu` (education)
- `gender`
- `test`
- `score`
- **Arrows**:
- Solid arrow from `edu` → `test`
- Solid arrow from `edu` → `gender`
- Solid arrow from `test` → `score`
- Dashed arrow from `score` → `test`
- Solid arrow from `gender` → `test`
### Detailed Analysis
- **Node Relationships**:
- `edu` directly influences both `test` and `gender`.
- `test` directly affects `score`.
- `score` has a feedback loop to `test` (dashed arrow), implying a potential cyclical relationship.
- `gender` influences `test`, suggesting a mediating or confounding factor.
### Key Observations
- The diagram emphasizes bidirectional influence between `test` and `score` (via the dashed arrow), which may indicate measurement error, iterative processes, or feedback mechanisms.
- `gender` acts as an external variable affecting `test`, potentially introducing bias or correlation.
- `edu` is positioned as a primary driver of both `test` and `gender`, suggesting foundational causality.
### Interpretation
This diagram likely models a causal or correlational framework in educational or social science research. The inclusion of `gender` as a node influencing `test` highlights potential equity considerations in testing outcomes. The feedback loop between `test` and `score` could represent adaptive learning systems or iterative assessment processes. The solid arrows from `edu` to `test` and `gender` imply that education is a root variable shaping both academic performance and demographic factors, though the latter relationship may require further contextualization (e.g., cultural or systemic influences). The dashed arrow introduces ambiguity, warranting clarification on whether it represents uncertainty, indirect effects, or non-linear dynamics.
</details>
fairadapt() . The benefit of using this option is that the specific edges of the causal model G need not be specified. However, in the linear case, specifying the edges of the graph, so that the quantiles are inferred using only the set of parents, will in principle have better performance.
## 5.3. Questions of Identifiability
So far we did not discuss whether it is always possible to carry out the counterfactual inference described in Section 2. In the causal literature, an intervention is termed identifiable if it can be computed uniquely using the data and the assumptions encoded in the graphical model G . An important result by Tian and Pearl (2002) states that an intervention do( X = x ) on a singleton variable X is identifiable if there is no bidirected path between X and ch( X ). Therefore, our intervention of interest is identifiable if one of the two following conditions are met:
- The model is Markovian.
- The model is Semi-Markovian and,
- (i) there is no bidirected path between A and ch( A ) and,
- (ii) there is no bidirected path between R i and ch( R i ) for any resolving variable R i .
Based on this, the fairadapt() function may return an error, if the specified intervention is not possible to compute. An additional limitation is that fairadapt currently does not support front-door identification (Pearl 2009, Chapter 3), meaning that certain special cases which are in principle identifiable are not currently handled. We hope to include this case in a future version.
## References
Bickel PJ, Hammel EA, O'Connell JW (1975). 'Sex Bias in Graduate Admissions: Data From Berkeley.' Science , 187 (4175), 398-404.
- Blau FD, Kahn LM (2003). 'Understanding International Differences in the Gender Pay Gap.' Journal of Labor Economics , 21 (1), 106-144.
- Cannon AJ (2015). qrnn : Quantile Regression Neural Network . R package version 2.0.5, URL https://cran.r-project.org/web/packages/qrnn .
- Cannon AJ (2018). 'Non-Crossing Nonlinear Regression Quantiles by Monotone Composite Quantile Regression Neural Network, With Application to Rainfall Extremes.' Stochastic Environmental Research and Risk Assessment , 32 (11), 3207-3225.
- Corbett-Davies S, Goel S (2018). 'The Measure and Mismeasure of Fairness: A Critical Review of Fair Machine Learning.' arXiv preprint arXiv:1808.00023 .
- Csardi G, Nepusz T (2006). 'The igraph Software Package for Complex Network Research.' InterJournal , Complex Systems , 1695. URL https://igraph.org .
- Darlington RB (1971). 'Another Look at Cultural Fairness.' Journal of Educational Measurement , 8 (2), 71-82.
- Galles D, Pearl J (1998). 'An Axiomatic Characterization of Causal Counterfactuals.' Foundations of Science , 3 (1), 151-182.
- Hardt M, Price E, Srebro N, et al. (2016). 'Equality of Opportunity in Supervised Learning.' In Advances in neural information processing systems , pp. 3315-3323.
- Kilbertus N, Carulla MR, Parascandolo G, Hardt M, Janzing D, Schölkopf B (2017). 'Avoiding Discrimination Through Causal Reasoning.' In Advances in Neural Information Processing Systems , pp. 656-666.
- Koenker R, Hallock KF (2001). 'Quantile Regression.' Journal of Economic Perspectives , 15 (4), 143-156.
- Koenker R, Portnoy S, Ng PT, Zeileis A, Grosjean P, Ripley BD (2018). quantreg : Quantile Regression . R package version 5.86.
- Komiyama J, Takeda A, Honda J, Shimao H (2018). 'Nonconvex Optimization for Regression with Fairness Constraints.' In International Conference on Machine Learning , pp. 27372746. PMLR.
- Kozodoi N, V Varga T (2021). fairness : Algorithmic Fairness Metrics . R package version 1.2.2, URL https://CRAN.R-project.org/package=fairness .
- Kusner MJ, Loftus J, Russell C, Silva R (2017). 'Counterfactual Fairness.' In Advances in Neural Information Processing Systems , pp. 4066-4076.
- Lambrecht A, Tucker C (2019). 'Algorithmic Bias? An Empirical Study of Apparent GenderBased Discrimination in the Display of STEM Career Ads.' Management Science , 65 (7), 2966-2981.
- Larson J, Mattu S, Kirchner L, Angwin J (2016). 'How We Analyzed the COMPAS Recidivism Algorithm.' ProPublica (5 2016) , 9 .
- McGinley AC (2011). 'Ricci v. DeStefano: Diluting Disparate Impact and Redefining Disparate Treatment.' Scholarly Works , 646 .
- Meinshausen N (2006). 'Quantile Regression Forests.' Journal of Machine Learning Research , 7 (Jun), 983-999.
- Pearl J (2009). Causality . Cambridge University Press.
- Plecko D, Meinshausen N (2020). 'Fair Data Adaptation with Quantile Preservation.' Journal of Machine Learning Research , 21 , 1-44.
- Scutari M (2021). fairml : Fair Models in Machine Learning . R package version 0.6, URL https://CRAN.R-project.org/package=fairml .
- Tian J, Pearl J (2002). 'A General Identification Condition for Causal Effects.' In Eighteenth National Conference on Artificial Intelligence , pp. 567-573. American Association for Artificial Intelligence, USA.
- Wickham H (2016). ggplot2 : Elegant Graphics for Data Analysis . Springer-Verlag New York. URL https://ggplot2.tidyverse.org .
- Wiśniewski J, Biecek P (2021). ' fairmodels : A Flexible Tool For Bias Detection.' arXiv preprint arXiv:2104.00507 .
- Wright MN, Ziegler A (2015). ' ranger : A Fast Implementation of Random Forests for High Dimensional Data in C++ and R.' arXiv preprint arXiv:1508.04409 .
- Zhang J, Bareinboim E (2018). 'Fairness in Decision-Making: The Causal Explanation Formula.' In Thirty-Second National Conference on Artificial Intelligence . American Association for Artificial Intelligence, USA.
## Affiliation:
Drago Plečko
ETH Zürich
Seminar for Statistics Rämistrasse 101 CH-8092 Zurich
E-mail:
drago.plecko@stat.math.ethz.ch
Nicolas Bennett
ETH Zürich
Seminar for Statistics Rämistrasse 101 CH-8092 Zurich
E-mail:
nicolas.bennett@stat.math.ethz.ch
Nicolai Meinshausen
ETH Zürich
Seminar for Statistics Rämistrasse 101 CH-8092 Zurich
E-mail:
meinshausen@stat.math.ethz.ch