install.packages(c(
"knitr","rmarkdown","tidyverse","glue","scales","mnormt","expm","fairadapt",
"randomForest","mediation","transport","T4transport","latex2exp","tikzDevice",
"extrafont","kableExtra","ggtext","ggtern","devtools","compositions","clue",
"ggalluvial","MCMCpack","ks","ellipse","Hmisc","mvtnorm","pbapply","caret",
"proxy","grf","reticulate","remotes"))
remotes::install_github("fer-agathe/sequential_transport", subdir = "seqtransfairness")
remotes::install_github("fer-agathe/transport-simplex")
# Font for graphs: you can install the CMU Serif font on your machine; otherwise
# the default serif font will be used.
# If you want the CMU Serif font in the graphs, install it and run:
extrafont::font_import(pattern = "cmun", prompt = FALSE)Graph-Aligned Sequential Transport for Distributional Disparity Decomposition
1 Preface
This ebook contains the codes and explanations of codes used to produce the results of our paper titled Sequential Transport for Causal Mediation Analysis.
Abstract
We propose sequential transport (ST), a graph-aligned optimal-transport framework for decomposing observed group differences through ordered mediator variables. Given a binary group indicator \(A\), a mediator DAG on \(\boldsymbol X=(X_1,\ldots,X_d)\), and an outcome \(Y\), ST moves each mediator marginally or conditionally on already transported parents toward its distribution in the target group. Numerical mediators are handled by monotone conditional quantile maps and categorical mediators by simplex-based transport. For continuous mediators under the graph factorization assumptions, ST selects a conditional-rank-preserving coupling. Exact global OT also reproduces the target joint distribution, but generally selects a different coupling.
The method defines aggregate mediator-driven, residual, and total distributional functionals of the observable law; the observation-level quantities produced by the algorithm are plug-in contributions to these aggregates, not individualized causal effects. A causal reading requires additional assumptions linking the selected transport map to the relevant structural mechanism. We establish consistency of the estimated maps, transported profiles, and induced plug-in contributions under explicit regularity and support conditions.
Gaussian examples describe a compatible case where the decomposition agrees with classical mediation formulas and distinguish graph-aligned from global couplings. New non-Gaussian simulations quantify graph-dependent bias–variance trade-offs for individual profiles and aggregate contributions as sample size, mediator dimension, parent-set size, and dependence strength vary. Finally, mixed-type simulations and an application to real-world recidivism risk assessment data illustrate the use of ST as a graph-aligned distributional audit.
1.1 Replication Package
To replicate the empirical results of the paper (using R and Python):
Download the Replication Codes (Zip archive)
(See the readme file in the archive for more details.)
The results presented in the paper focus on the following chapters of this ebook:
The other chapters provide additional context and details.
The following packages are required to run this ebooks
1.2 Outline of this Ebook
The document is made of 5 parts:
Introduction
This part provides a refresher on the decomposition of group differences through mediators and on the notation used in the paper (Chapter 2), gives a few colours and plot theme functions (Chapter 3), and contains the main estimation functions used in the subsequent chapters (Chapter 4).A Gaussian Example
Simulations are conducted with Gaussian variables to evaluate the estimation of the mediator-driven, residual and total effects. In particular, we compare the estimates obtained with the Linear Structural Equation Model (LSEM) approach, implemented in the R package {mediation}, with those derived from transported profiles built with optimal transport, penalized transport and sequential transport (Chapter 5). Monte Carlo experiments then assess how these estimates behave under varying data conditions (Chapter 6).Transport of Categorical Mediators
After a short presentation of the context (Chapter 7), we present different methods to transport a categorical mediator from one group to the other: random matching (Chapter 8), optimal transport on label-encoded variables (Chapter 9), and optimal transport on the simplex (Chapter 10). These methods are then compared on a small example (Chapter 11).Transport with Weights
In Chapter 12, we present another way to perform univariate conditional transport in the Gaussian case, using local weights. We illustrate the method on simulated data and compare the transported values with those obtained by sequential transport.Experiments
We run experiments on a synthetic dataset (Chapter 13) and on a real-world dataset, COMPAS (Chapter 15), to illustrate the full method. Chapter 14 presents an additional controlled simulation, with known targets, on the bias–variance trade-off associated with the choice of graph (sample size, mediator dimension, parent-set size and strength of omitted dependences).