# Causal mediation analysis with one or multiple mediators: a comparative study

Judith Abécassis, Houssam Zenati, Sami Boumaïza, Julie Josse, Bertrand Thirion

► To cite this version:

Judith Abécassis, Houssam Zenati, Sami Boumaïza, Julie Josse, Bertrand Thirion. Causal mediation analysis with one or multiple mediators: a comparative study. 2025. hal-05060162

HAL Id: hal-05060162

https://hal.science/hal-05060162v1

Preprint submitted on 7 May 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Causal mediation analysis with one or multiple mediators: a comparative study

**Judith Abécassis**

Soda project-team,
Mind project-team,
INRIA Saclay,
Institut Polytechnique de Paris,
France.

judith.abecassis@inria.fr

**Houssam Zenati**

Mind project-team,
INRIA Saclay, CEA,
Université Paris-Saclay,
France.

houssam.zenati@inria.fr

**Sami Boumaïza**

Soda project-team,
INRIA Saclay,
Institut Polytechnique de Paris,
France.

**Julie Josse**

PreMeDICaL project team,
INRIA Sophia-Antipolis-Inserm,
Université de Montpellier,
France.

julie.josse@inria.fr

**Bertrand Thirion**

Mind project-team,
INRIA Saclay, CEA,
Université Paris-Saclay,
France.

bertrand.thirion@inria.fr

*Working version - May 7, 2025- This paper has not been peer reviewed.*

## Abstract

Mediation analysis breaks down the causal effect of a treatment on an outcome into an indirect effect, acting through a third group of variables called mediators, and a direct effect, operating through other mechanisms. Mediation analysis is hard because confounders between treatment, mediators, and outcome blur effect estimates in observational studies. Many estimators have been proposed to adjust on those confounders and provide accurate causal estimates. We consider parametric and non-parametric implementations of classical estimators and provide a thorough evaluation for the estimation of the direct and indirect effects in the context of causal mediation analysis for binary, continuous, and multi-dimensional mediators. We assess several approaches in a comprehensive benchmark on simulated data. Our results show that advanced statistical approaches such as the multiply robust and the double machine learning estimators achieve good performances in most of the simulated settings and on real data. As an example of application, we propose a thorough analysis of factors known to influence cognitive functions to assess if the mechanism involves modifications in brain morphology using the UK Biobank brain imaging cohort. This analysis shows that for several physiological factors, such as hypertension and obesity, a substantial part of the effect is mediated by changes in the brain structure. This work provides guidance to the practitioner from the formulation of a valid causal mediation problem, including the verification of the identification assumptions, to the choice of an adequate estimator.
# 1 Introduction

Causal inference in observational studies is primarily used to measure the causal effect of a treatment on an outcome. Nevertheless, in a lot of fields, disentangling the mechanism of action is just as important, as it allows us to identify potential intermediate intervention targets, and more generally, deepen our understanding of the processes that lead to the observed outcome.

Causal mediation analysis aims at separating the (total) causal effect into two components: an indirect effect through a third (group of) variable(s) called mediator(s), and a direct effect through alternative path(s) [Pearl, 2001]. A central issue in solving this question is confounding, as even in the "ideal" case of a randomized controlled trial, only the exposure is randomized, and not the mediator. Further control on the mediator is thus necessary to identify the direct and indirect effects, as outlined in Robins and Greenland [1992] in the potential outcomes framework [Imbens and Rubin, 2015]. Estimation in causal mediation analysis aims to provide a robust statistical framework for adjusting for confounding variables by accounting for their relationships with the treatment, the mediator, and the outcome, respectively. Previous work on mediation was mostly based on parametric structural equations [Cochran, 1957, Judd and Kenny, 1981, Baron and Kenny, 1986], that may not fully account for the confounders' impact, and neglected identifiability assumptions. Further work has clarified identification assumptions and developed new estimation approaches in parametric and non-parametric settings [Robins and Greenland, 1992, Pearl, 2001, Robins, 2003, Petersen et al., 2006, Imai et al., 2010, Hong, 2010, Albert and Nelson, 2011, Tchetgen and Shpitser, 2012, Huber, 2014, Zheng and van der Laan, 2012, Farbmacher et al., 2022, Hines et al., 2021]. This has led to the development of more complex estimators, that proceed in two steps: first they fit intermediate variables through classification or regression models based on the data, and then they use the predictions of these models to compute the effects of interest. The models of the first step are called nuisance models because they do not directly estimate the quantities of interest. Most existing applicative studies generally resort to parametric linear models for the nuisance functions, that may fail to reflect the role of confounding variables. Yet, the consistency of the different estimators relies on the consistency of at least a subset of those nuisance models. Hence, model misspecification, i.e. the inadequacy between a parametric model and the actual underlying phenomenon, can lead to erroneous estimates.

Another limitation of classical estimators is that most methods are dedicated to the case of a one-dimensional binary mediator, while the problem of handling multiple binary or continuous mediators is increasingly considered in the literature. VanderWeele and Vansteelandt [2014], Jéron et al. [2020], Avin et al. [2005] have specified identifiability assumptions for direct and indirect effects, either jointly through all mediators, or for a path-specific effect through one particular mediator. An additional difficulty lies in potential causal relations between mediators [VanderWeele and Vansteelandt, 2014, Jéron et al., 2020, Huber, 2019, Nguyen et al., 2021]. Recent work [Chén et al., 2018, Zhao et al., 2020, Huang and Pan, 2016] has focused on high-dimensional settings, where there are numerous mediators, potentially highly correlated, such as gene expression or medical imaging. In Huang and Pan [2016], dimensionality reduction is performed first, using Principal Component analysis (PCA) while in Zhao et al. [2020], Independent Component Analysis (ICA) or a sparse version of PCA is used instead. The objective was to compute a smaller number of orthogonal "directions of mediation". Alternatively, Zhang et al. [2021], Djordjilović et al. [2019] propose statistical tests to select only a relevant subset of mediators. After dimension reduction, the authors of those works conduct an analysis of mediation using structural equations models with the classic approach of the product of coefficients [Baron and Kenny, 1986, MacKinnon, 2012], which relies on a linear parametric relation between the directions of mediation, the covariates and the treatment, and between the directions of mediation, the covariates and the outcome, even if confounding covariates are often omitted.

In this work, we focus on the problem of jointly estimating the direct and indirect effects of one or more mediators (no path-specific effect) using either classical approaches or more recent approaches that are robust to model misspecification. We propose new variants of existing estimators, with more flexible machine learning models to account for complex relations between the variables of interest,
and assess the relevance of using such models over various contexts. We provide a comprehensive evaluation of classical and more recent methods on simulated data, extending the work of [Huber et al., 2016, Rudolph et al., 2020] for a binary mediator to the continuous and multi-dimensional mediators, with additional estimators. We rely on a variety of simulation settings to explore the practical implications of violations of parametric model specifications, violations of the overlap assumption, and variations in the number of observations. This benchmark provides an overview of available estimators, their validity conditions, and limitations which constitutes a valuable guide to the practitioner. We also provide a Python implementation of all the estimators for an easy off-the-shelf use for Python users, as existing implementations are available only in other programming languages such as R or SAS Valente et al. [2020].

To go beyond performance analysis on simulated data, we conduct several mediation analyses on data from the UK Biobank to explore cognitive functions in a cohort of middle-aged adults. UK Biobank [Sudlow et al., 2015] is a prospective cohort of about 500,000 healthy participants in the UK with very thorough socio-demographic, medical, lifestyle, physical, and cognitive assessments. A subset of nearly 40,000 participants also underwent a more enhanced functional exploration including brain structural and functional Magnetic Resonance Imaging (MRI). This unprecedentedly large imaging database allows us to assess the potential role of brain structure in the shaping of cognitive functions while observing potential confounders. Specifically, we build on the view that brain characteristics do not represent an independent source of information about cognitive scores but rather integrate individual characteristics that are accessible from questionnaires. For this reason, we handle brain morphological characteristics as a mediator between socio-demographic variables and behavioral outcomes. The results obtained for several potential exposures further illustrate the properties of the different estimators considered, in particular the accuracy and the stability of the classical coefficient product, approach and the robust double machine learning estimator in a variety of complex real-world data settings. Moreover, this real-data study offers a comprehensive example encompassing all facets of causal mediation analysis. In contrast, most existing works focus either on the correct framing of a causal mediation question [Lee et al., 2021, Stuart et al., 2021, Rohrer et al., 2022], or the estimation [Rijnhart et al., 2017, Huber et al., 2016, Rudolph et al., 2020, Nguyen et al., 2023]. However, both aspects are essential for achieving rigorous results.

The rest of the article is organized as follows. In section 2 we formalize the causal mediation analysis problem, defining the natural direct and indirect effects, and the associated identifiability assumptions. In Section 3, we present the assessed estimators, as well as the underlying models and implementations. We propose a companion Github package<fnref n="1" /> to this paper, with Python implementation or wrapping of the R implementation for all those estimators, as well as tutorials for the practitioner. Section 4 presents in detail the simulation process and the main trends in results. An application of mediation analysis to decipher some aspects of the effect of education on middle-age cognitive functions is proposed in Section 5. We highlight a group of physiological exposures for which an significant part of their effect on cognitive function is mediated through the brain structure. Finally, we discuss the overall results and the limits of our work in Section 6.

# 2 Problem setting: causal mediation analysis

In this section, we introduce the potential outcome framework to define the causal quantities of interest, also called estimands. We then specify the required assumptions to identify those quantities, i.e. estimate them with the data at our disposal.

## 2.1 Natural direct and indirect effects

The objective of mediation analysis is to quantify the part of the total effect achieved through the mediator, i.e. the indirect effect, and the effect of the treatment without further intermediate, i.e. the direct effect. For each individual, we denote the (binary) treatment $T$, the observed outcome $Y$, the

<footnote n="1">¹https://github.com/judithabk6/med_bench</footnote>
<figure><img src="image_2.png" /><figcaption>Figure 1: A general directed acyclic graph for causal mediation analysis. Each node represents a group of variables, and arrows denote causal relations between them.</figcaption></figure>

observed mediator(s) *M*, and the covariate(s) *X*; covariates associated with at least two variables among the treatment, mediator(s) and outcome are confounders and should be adjusted for. Let us note *T*, *Y*, *M* and *X*. The relations between those variables are illustrated in Figure 1. Extending the potential outcomes framework [Imbens and Rubin, 2015], in the case of a binary treatment, we can define *M(t)* and *Y(t, M(t))* the potential mediator and the potential outcome under the treatment value *t* ∈ {0, 1}. For each unit, only one potential outcome and mediator state are observed. We assume that the observed outcome and mediator are the potential outcome and mediator under the actual assigned treatment.

**Assumption 1 (SUTVA (Stable Unit Treatment Values) and consistency).**

$$M = TM(1) + (1-T)M(0) \text{ and } Y = TY(1, M(1)) + (1-T)Y(0, M(0)) \quad (1)$$

We then define the total average treatment effect (ATE) as:

**Definition 1 (Total average treatment effect).**

$$\tau = \mathbb{E}[Y(1, M(1)) - Y(0, M(0))] \quad (2)$$

To further decompose the total effect into natural direct and indirect effects [Pearl, 2001, Huber, 2019, Nguyen et al., 2021], we define cross-world potential outcomes that correspond to varying the treatment, while maintaining the value of the mediator to the value it would have without changing the treatment, and the converse. Contrary to the previously mentioned potential outcomes, where one of them is observed, cross-world outcomes can never be observed. Those additional terms allow us to define the natural direct effect as

**Definition 2 (Natural direct effect).**

$$\theta(t) = \mathbb{E}[Y(1, M(t)) - Y(0, M(t))], \quad t \in \{0, 1\},$$

and the natural indirect effect

**Definition 3 (Natural indirect effect).**

$$\delta(t) = \mathbb{E}[Y(t, M(1)) - Y(t, M(0))], \quad t \in \{0, 1\}.$$

We hence define two natural direct effects, the natural direct effect on the exposed, $\theta(1)$ or the total direct effect, while $\theta(0)$ is called the natural direct effect on the unexposed, or pure direct effect [Vansteelandt and VanderWeele, 2012]. Similarly, we can distinguish the natural indirect effect on the exposed, $\delta(1)$, also called the total indirect effect, and the natural indirect effect on the unexposed, $\delta(0)$, or pure indirect effect. In the case where there is no interaction between the treatment and the mediator, i.e. effect heterogeneity, the effects are equal among the exposed or the unexposed (i.e. $\theta(1) = \theta(0)$ and $\delta(1) = \delta(0)$) [Huber et al., 2016, Rohrer et al., 2022]. The ATE in equation (2) is the sum of the direct and indirect effects of opposite treatment states: $\tau = \theta(0) + \delta(1) = \theta(1) + \delta(0)$. In the rest of this work, we will use the first decomposition.
## 2.2 Identification assumptions

As mentioned above, the parameters of interest include both unobserved and unobservable terms. In addition to the SUTVA and consistency assumptions, already introduced in the previous paragraph, identification requires additional assumptions, stronger than in standard causal inference settings:

**Assumption 2** (Sequential conditional independence of the treatment [Imai et al., 2010]).

$$ \{Y(t', m), M(t)\} \perp T | X \quad \text{for all } t', t \in \{0, 1\} \text{ and } m \in \mathcal{M}, \quad (3) $$

where $\perp$ denotes independence.

Assumption 2 imposes the absence of unobserved confounders of the treatment and the outcome on the one hand, and of the treatment and the mediator on the other hand.

**Assumption 3** (Sequential conditional independence of the mediator [Imai et al., 2010]).

$$ Y(t', m) \perp M | T = t, X = x \quad \text{for all } t', t \in \{0, 1\}, m \in \mathcal{M} \text{ and } x \in \mathcal{X}. $$

where $X$ contains no variable affected by the treatment (post-treatment variable).

Assumption 3 forbids the existence of unobserved confounders affecting both the mediator and the outcome.

Finally, a common support assumption (also called positivity or overlap) is needed. Informally, this assumption ensures that for each individual, we can find a comparable individual with the opposite treatment or mediator value in the dataset, ensuring that the effect of interest can be computed.

**Assumption 4** (Positivity assumption).

$$ P(T = t | X = x) > 0 \text{ and } 0 < P(M(t) = m | T = t, X = x) \text{ for all } t \in \{0, 1\}, m \in \mathcal{M} \text{ and } x \in \mathcal{X}. $$

Relying on Assumptions 2, 3, and 4 the total effect, along with the natural direct and indirect effects are identifiable. We give the demonstration in the Appendix section S1 that the mean potential outcomes and cross-world potential outcomes needed to compute the effects of interest can be identified non-parametrically, that is without any form restriction such as linearity [Imai et al., 2010, Huber, 2019].

## 2.3 The case of several mediators

If we now consider several mediators of interest, $\mathbf{M} = (M_1, \dots, M_K)$, and aim at computing the indirect effect through all the mediators jointly, all the definitions and assumptions above can be written similarly, by just replacing the mediator $\mathbf{M}$ by a mediator vector $\mathbf{M}$. The identification of path-specific effects through one particular mediator among several mediators of interest requires additional assumptions [VanderWeele and Vansteelandt, 2014, Huber, 2019] and is not the objective of this work. However, Assumption 3 forbids the existence of any post-treatment confounder of the mediator of interest and the outcome. Such a variable would actually be an additional mediator.

To illustrate what happens in this case, let us consider two mediators $M_1$ and $M_2$, with the causal graph defined in Figure 2. Huber [Huber, 2019] defines several path-specific (indirect) effects:

**Definition 4** (Natural indirect effect (with respect to $M_1$, operating through $M_2$) Figure 2, panel d).

$$ \delta^{M_1}(t) = \mathbb{E}[Y(t, M_1(1, M_2(1)), M_2(t)) - Y(t, M_1(0, M_2(0)), M_2(t))], \quad t \in \{0, 1\}. $$

**Definition 5** (Path-specific indirect effect (with respect to $M_1$, not operating through $M_2$) Figure 2, panel e).

$$ \delta^{M_1 p}(t) = \mathbb{E}[Y(t, M_1(1, M_2(t)), M_2(t)) - Y(t, M_1(0, M_2(t)), M_2(t))], \quad t \in \{0, 1\}. $$

**Definition 6** (Joint indirect effect through $M_1$ and $M_2$, Figure 2, panel f).

$$ \delta^{M_1, M_2}(t) = \mathbb{E}[Y(t, M_1(1, M_2(1)), M_2(1)) - Y(t, M_1(0, M_2(0)), M_2(0))], \quad t \in \{0, 1\}. $$
<figure><img src="image_3.png" /><figcaption>Figure 2: Configurations to consider with two mediators *M*₁ and *M*₂. In panels a, b and c, we show the possible relations between two distinct mediators (adapted from Jérolon et al. [2020]). In panels d, e and f, we show in bold red arrows several indirect effects in the case of causally related mediators that can be of interest (adapted from Huber [2019]). The indirect effect shown in panel d, the indirect effect mediated by *M*₁ is not identified, as it involves counterfactual outcomes with two different potential states for the mediator *M*₂, which is impossible to estimate. The indirect effect shown in panel e (the indirect effect going through *M*₁ but not through *M*₂) is identified, as well as the total mediated effect going through both *M*₂ and *M*₁ (panel f).</figcaption></figure>

Of these three indirect effects of interest, the most interesting one, $\delta^{M_1}(t)$ is not identifiable without
restrictive additional assumptions, as it gives rise to potential outcomes with two different states
of the mediator $M_2$, which is impossible to estimate [Robins and Greenland, 1992]. The effect
$\delta^{M_{1p}}(t)$ is identifiable, but provides only a partial view of the role of $M_1$. The effect $\delta^{M_1,M_2}(t)$ is
also identifiable, but does not represent the contribution of a particular mediator to the total effect.

Therefore, if we are interested in the indirect effect through a mediator $M_1$, we should still consider
all other mediators placed on the path between the treatment node and the mediator $M_1$ node in the
causal graph (i.e. post-treatment variables affecting both the mediator $M_1$ and the outcome $Y$). In
the simple example of the causal diagram of Figure 2, if we ignore entirely the mediator $M_2$, and
consider the indirect effect from Definition 3, the considered estimand is $\delta^{M_{1p}}(t)$, which does not
capture entirely the indirect effect mediated by $M_1$. As a consequence, identification of the direct
and indirect effects is challenging, as one should unpack all the causal chain between the treatment
and the mediator(s) of interest, which is practically infeasible [Rohrer et al., 2022]. In this paper, we
only consider the joint effect of all mediators, hence $\delta^{M_1, M_2}(t)$.

3 Overview of estimators for mediation analysis

In this study, we consider several estimators for the natural direct and indirect effects that can
be used for binary, continuous and/or multi-dimensional mediators. We compare their properties,
conditions of application and performances on simulated data with binary and continuous multi-
dimensional mediators in Section 4. This section introduces the different estimators, and describes the
implementations of the estimators used in the experiments. Some estimators include a procedure for
estimating uncertainty, but not all, so we have limited our comparison to estimating direct and indirect
effects and assessing the variance of estimators with several independent data draws. We distinguish
parametric estimators that rely solely on the output of nuisance models to compute the effects of
interest, and semi-parametric estimators where the original observed values for the treatment and the
outcome variables are also used in the computation of the model. We note that we can however use
non-parametric models for predictions even in the so-called "parametric estimators".
## 3.1 Parametric estimators

### 3.1.1 Coefficient product

The method of coefficient product developed by Baron and Kenny [1986] is the first estimator developed for mediation analysis. It consists in assuming the following structural equation model:

$$M(x, t) = \beta_0 + \beta_T t + x^t \beta_X + \epsilon_M \quad (4)$$

$$Y(x, t, m) = \gamma_0 + \gamma_T t + x^t \gamma_X + \gamma_M m + \epsilon_Y \quad (5)$$

where $\epsilon_M$ and $\epsilon_Y$ are independent centered normal random variables, and the superscript t represents the transpose operation.

Then we have, after estimation of the regression parameters

$$\hat{\theta}(0) = \hat{\theta}(1) = \hat{\gamma}_T$$

$$\hat{\delta}(0) = \hat{\delta}(1) = \hat{\gamma}_M \hat{\beta}_T$$

$$\hat{\tau} = \hat{\theta}(1) + \hat{\delta}(0) = \hat{\theta}(0) + \hat{\delta}(1).$$

This estimator is consistent if the models for the outcome and for the mediator are both correctly specified. The models can be easily extended to situations with interactions by adding interaction terms to the structural equations [VanderWeele, 2015]. The coefficient product exists in many variations to account for binary mediators or outcomes, or different parametric models, as detailed in VanderWeele [2015], which requires to vary the formulas to obtain the effects and the implementation. For the sake of simplicity and to avoid overwhelming the reader with those slight variations, we will consider this version even for the case of a binary mediator, where we observe exactly the expected behavior of this estimator on our simulations.

### 3.1.2 G-computation

The following formula is directly derived from the identifiability demonstration step 14 in section S1. It is very intuitive: it relies on regressing the outcome Y on the mediator(s) M, the treatment T, and the covariates X, and consider differences between the predictions obtained for different values of the treatment and/or the mediator(s) to derive estimates for the natural direct and indirect effects. Hence, it is slightly more sophisticated than the coefficient product in the choice of the model allowed for this regression, and in the estimation, based on the predictions rather than the coefficient values. We denote $f_{A=a}$ and $f_{A=a|B=b}$ the probability density function of a random variable A, unconditionally or conditionally given other random variable(s) B. The factual and counterfactual treatments are denoted t and t' respectively.

$$\mathbb{E}[Y(t, M(t'))] = \iint \mathbb{E}[Y|T=t, M=m, X=x] f_{M=m|T=t', X=x} f_{X=x} dm dx$$

It directly yields the mediation formula [Pearl, 2001, Imai et al., 2010],

$$\theta(t) = \iint \{\mathbb{E}[Y | T = 1, M = m, X = x] - \mathbb{E}[Y | T = 0, M = m, X = x]\} f_{M=m|T=t, X=x} dm f_{X=x} dx$$

$$\delta(t) = \iint \mathbb{E}[Y | T = t, M = m, X = x] \{f_{M=m|T=1, X=x} - f_{M=m|T=0, X=x}\} dm f_{X=x} dx.$$

In practice, we perform parametric or non-parametric estimation of $\hat{\mu}_Y(t, m, x)$ for the conditional mean outcome $\mathbb{E}[Y | T = t, M = m, X = x]$ by regressing and $\hat{f}(m|t, x)$ for the conditional mediator density $f_{M=m|T=t, X=x}$ (or conditional probability if the mediator is discrete), and the final effects are estimated as follows:

$$\hat{\theta}(t) = \frac{1}{n} \sum_{i=1}^{n} \sum_{m=0}^{1} \{ (\hat{\mu}_{Y}(1, m, X_i) - \hat{\mu}_{Y}(0, m, X_i)) \hat{f}(m|t, X_i) \}, \quad (6)$$

$$\hat{\delta}(t) = \frac{1}{n} \sum_{i=1}^{n} \sum_{m=0}^{1} \{ \hat{\mu}_{Y}(t, m, X_i) (\hat{f}(m|1, X_i) - \hat{f}(m|0, X_i)) \}.$$
The G-computation estimator is consistent if both plug-in models are correctly specified. The estimation of the conditional mediator density is challenging for multi-dimensional mediators. Indeed, one can perform parametric density estimation, which relies on strong assumptions about the distribution (e.g., assuming a normal distribution), or non-parametric density estimation, which requires a number of observations that increases exponentially with dimensionality [Scott and Sain, 2004]. Considering the case of independent mediators facilitates density estimation.

Alternatively, following the implementation strategy in the R package causalweight [Bodory and Huber, 2018], this mediator density step can also be ignored altogether with the following estimation approach. The derivation of this strategy is detailed in Supplementary S2.1, and will be referred to as implicit integration G-computation.

In this work, this estimator is implemented with the explicit integration over the mediator for a binary mediator as outlined in equation 6, and with the implicit integration for other cases (continuous or multi-dimensional mediator) with the formula of equation 17, following the best-performing strategy for each situation.

## 3.2 Semi-parametric estimators

### 3.2.1 Inverse probability weighting estimator (IPW)

The identifiability computation in step (15) in Appendix S1 provides the ground for an inverse probability weighting-type approach (IPW), developed in Huber [2014]. It consists in the extension to the mediation analysis of a very classical strategy in causal inference [Horvitz and Thompson, 1952, Huber, 2014]. Computation requires the estimation of two nuisance parameters, the conditional probability of treatment given X covariates, $p(X) = P(T = 1 | X)$, and the conditional probability of treatment given covariates and mediator(s), $\rho(M, X) = P(T = 1 | X, M)$. In practical implementation, the weights are normalized for more stability; we can write the normalized estimator as follows

$$ \hat{\theta}(0) = \frac{\sum_{i=1}^{n} Y_i T_i (1 - \hat{\rho}(M_i, X_i)) / [\hat{\rho}(M_i, X_i)(1 - \hat{\rho}(X_i))]}{\sum_{i=1}^{n} T_i (1 - \hat{\rho}(M_i, X_i)) / [\hat{\rho}(M_i, X_i)(1 - \hat{\rho}(X_i))]} - \frac{\sum_{i=1}^{n} Y_i (1 - T_i) / (1 - \hat{\rho}(X_i))}{\sum_{i=1}^{n} (1 - T_i) / (1 - \hat{\rho}(X_i))} $$

$$ \hat{\delta}(1) = \frac{\sum_{i=1}^{n} Y_i T_i / \hat{\rho}(X_i)}{\sum_{i=1}^{n} T_i / \hat{\rho}(X_i)} - \frac{\sum_{i=1}^{n} Y_i T_i (1 - \hat{\rho}(M_i, X_i)) / [\hat{\rho}(M_i, X_i)(1 - \hat{\rho}(X_i))]}{\sum_{i=1}^{n} T_i (1 - \hat{\rho}(M_i, X_i)) / [\hat{\rho}(M_i, X_i)(1 - \hat{\rho}(X_i))]} $$

The IPW estimator is consistent if models for $p$ and $\rho$ are consistently estimated. The absence of estimation of the density of the estimator(s) allows us to use this estimator when the mediator is continuous and/or multi-dimensional. The total effect, which is the sum of the direct effect $\hat{\theta}(0)$, and the indirect effect $\hat{\delta}(1)$, does not involve $\hat{\rho}$. Hence it is robust to misspecification of the mediator model.

### 3.2.2 Multiply-robust estimator

The multiply-robust estimator has been derived in the framework of semi-parametric theory, that aims at minimizing the variation of the causal estimate for a variation (or an error) on the nuisance functions [Kennedy, 2024]. Hence it gives a property of robustness to misspecification of the nuisance models to the obtained estimator, which is a highly desirable property. The inverse mediator density weighting implemented in the multiply-robust estimator [Tchetgen and Shpitser, 2012] is motivated by the last step 16 of the identifiability computation in Appendix S1. We can then write [Tchetgen and Shpitser, 2012, Huber et al., 2016]
$$ \hat{\theta}(0) = \frac{1}{n} \sum_{i=1}^{n} \left\{ \left[ \frac{T_i \hat{f}(M_i|0, X_i)}{\hat{p}(X_i) \hat{f}(M_i|1, X_i)} - \frac{1-T_i}{1-\hat{p}(X_i)} \right] (Y_i - \hat{\mu}_Y(T_i, M_i, X_i)) \right. \\ \left. + \frac{1-T_i}{1-\hat{p}(X_i)} (\hat{\mu}_Y(1, M_i, X_i) - \hat{\mu}_Y(0, M_i, X_i) - \hat{\omega}_Y(1, 0, X_i) + \hat{\omega}_Y(0, 0, X_i)) \right. \\ \left. - \hat{\omega}_Y(1, 0, X_i) + \hat{\omega}_Y(0, 0, X_i) \right\} \quad (7) $$

$$ \hat{\delta}(1) = \frac{1}{n} \sum_{i=1}^{n} \left\{ \frac{T_i}{\hat{p}(X_i)} \left[ Y_i - \hat{\psi}(1, X_i) - \frac{\hat{f}(M_i|0, X_i)}{\hat{f}(M_i|1, X_i)} (Y - \hat{\mu}_Y(1, M_i, X_i)) \right] \right. \\ \left. - \frac{1-T_i}{1-\hat{p}(X_i)} (\hat{\mu}_Y(1, M_i, X_i) - \hat{\omega}_Y(1, 0, X_i)) + \hat{\omega}_Y(1, 1, X_i) - \hat{\omega}_Y(1, 0, X_i) \right\} \quad (8) $$

cross-world conditional mean outcomes, $\omega_Y(t, t', x) = E[\mu_Y(t, m, x)|T = t', X = x]$

with $\hat{\mu}_Y(t, m, x)$ estimating the conditional mean outcome $E[Y|T = t, M = m, X = x]$, $\hat{f}(m|t, x)$ estimating the conditional mediator density $f_{M|T=t, X=x}(m)$ (or conditional probability if the mediator is discrete), $\hat{p}(x)$ estimating the treatment propensity score $P(T = 1|X = x)$, and $\hat{\omega}_Y(t, t', x)$ estimating the cross-world conditional mean outcome $E[\mu_Y(t, m, x)|T = t', X = x]$, which can be estimated using two nested regressions, as introduced for the implicit integration of the G-computation, and detailed in Appendix S2.1.

A very interesting property of this estimator is that it is triply-robust, as it remains consistent if at least two of the three following models are well specified: (i) the conditional mean outcome, $E[Y|T, M, X]$, (ii) the conditional density of M given T, X, and (iii) the treatment propensity score. This estimator is also asymptotically semi-parametrically efficient if (i), (ii), and (iii) are all correctly specified, meaning that it optimally uses the available data to obtain (theoretically) the smallest variance possible. The estimation of the mediator conditional density makes the use of this estimator difficult for a continuous and/or multi-dimensional mediator without further assumptions, however the same technique for implicit integration described in Appendix S2.1 can also be applied here, but was not used in this work as it is redundant with the Double-Machine Learning estimator presented in the next section. As for the IPW estimator, the weights have been normalized to improve numerical stability.

### 3.2.3 Double-Machine Learning for mediation estimator (medDML)

The multiply-robust estimator (Section 3.2.2) was extended in Farbmacher et al. [2022], by removing the requirement to estimate the conditional mediator density using Bayes' law. Indeed, it can be shown that

$$ \frac{f(M|T = 1 - t, X)}{p(T = t|X)f(M|T = t, X)} = \frac{(1 - p(T = t|X, M))f(M|X)}{1 - p(T = t|X)} \frac{p(T = t|X)}{p(T = t|X, M)f(M|X)p(T = t|X)} \\ = \frac{1 - p(T = t|X, M)}{p(T = t|X, M)(1 - p(T = t|X))} $$

This new expression can be directly used in equations (7) and (8), lifting the previously mentioned restrictions for continuous and/or multi-dimensional mediators. Additionally, the authors show that this new estimator is Neyman orthogonal, which is crucial to the application of the double machine learning framework, in addition to the use of cross-fitting [Chernozhukov et al., 2018]. Compared to the semi-parametric framework used in the multiply-robust estimator presented in the previous section (Section 3.2.2), the property that the model can reach a fast convergence rate, even with complex machine learning models for the plug-in estimator, by using cross-fitting. As for the IPW estimator, the weights have been normalized to improve numerical stability.
### 3.3 Implementation considerations

We re-implemented some of the considered estimators, using the Python package `scikit-learn` [Pedregosa et al., 2011]. This re-implementation has allowed us to centralize the main mediation estimators within a unified framework, with more flexibility in the choice of algorithms for nuisance parameters estimation, in particular the use of random forests [Breiman, 2001]. We provide a flexible interface for those estimators allowing to use any model or combination of models from `scikit-learn`, including regularization, probability calibration [Zadrozny and Elkan, 2002, Niculescu-Mizil and Caruana, 2005], ensemble models. The main characteristics of available implementations for each estimator are presented in Table 1. We refer the reader to this review of existing implementations in languages other than Python for a complete view [Valente et al., 2020]. In the experiments presented here, we used the Python implementation when it was available. Our implementations are available as a Python package at https://github.com/judithabk6/med_bench, with examples and guidance for the practitioner.

<table><caption>Table 1: Characteristics of the estimator implementations. The columns "binary", "continuous" and "multi-dimensional" refer to the ability of methods to handle mediators of this kind. Symbols "x" and "-" mean available or not respectively. Most estimators have an implementation in R. We have reimplemented them in Python to make it easier for Python users to perform mediation analysis.</caption><thead><tr><th>estimator</th><th>binary</th><th>continuous</th><th>multi<br>dimensional</th><th>reference<br>R implementation</th><th>Python<br>implementation<br>(package med_bench)</th></tr></thead><tbody><tr><td>coefficient<br>product 3.1.1</td><td>x</td><td>x</td><td>x</td><td>no</td><td>function mediation碗coefficient product with linear regression models with L2 regularization (cross-validation or fixed at α = 10<sup>-12</sup>). Also estimation method mediation.two-stage regression in DoWhy package.</td></tr><tr><td>g-Computation or<br>g-formula 3.1.2</td><td>x</td><td>x</td><td>x</td><td>no</td><td>function mediation_g formula with linear and logistic models (with or without L2 regularization) or random forests to estimate β̂<sub>Y</sub> and f</td></tr><tr><td>IPW 3.2.1</td><td>x</td><td>x</td><td>x</td><td>function medweight in package causalweight [Bodory and Huber, 2018] with logit or probit regression to estimate conditional probabilities, and package twangMediation with gradient boosting</td><td>function mediation_IPW with linear models (with or without L2 regularization) or non-parametric estimators (random forests)</td></tr><tr><td>multiply-<br>robust<br>estimator</td><td>3.2.2<br>x</td><td>-</td><td>-</td><td>no</td><td>function mediation_multiplier with linear models (with or without L2 regularization) or non-parametric estimators (random forests)</td></tr><tr><td>medDML 3.2.3</td><td>x</td><td>x</td><td>x</td><td>function medDML in package causalweight [Bodory and Huber, 2018], with parametric linear models</td><td>function mediation_DML with linear models (with or without L2 regularization) or non-parametric estimators (random forests)</td></tr></tbody></table>

The R package, CMAverse [Shi et al., 2021] is currently developed with a similar objective of unification. However, the implemented estimators are not exactly the same as the ones we consider: the definitions of some estimators slightly differ (g-formula, weighting-based approach), and the most recent robust approaches with the best performances in our work, such as the multiply robust and the double machine learning estimators are not available.

Another robust estimator for mediation is derived from the Targeted Maximum Likelihood Estimation (TMLE) framework [Zheng and van der Laan, 2012]. From a theoretical point of view, TMLE also relies on influence functions from the semi-parametric theory [Kennedy, 2024], like
the double-machine learning and the multiply robust estimator, but with a different bias-correction approach. Implementations are available as R packages `tmle3mediate` [Hejazi et al., 2021] and `medoutcon` [Hejazi et al., 2022]. The empirical performances and properties are very close to the other robust estimators [Huber et al., 2016], so we have not reimplemented the TMLE estimator in Python.

# 4 Performances on simulations

## 4.1 Generation of simulated data

We have generated simulated datasets with a number of varying characteristics:

* the number of observations $n \in \{500, 1000, 10000\}$ (3 possible values)

* the dimension (and variable type - binary or continuous) of the mediator $M$, either 1 (binary and continuous) or 5 (continuous) (3 possible values)

* the linearity (or not) of the mediator and outcome models; we introduced non-linearities with interactions between the input variables. (4 possible options)

* the mediated proportion, through varying the mediator parameter in the outcome model, and the common support assumption, through varying the strength of the association between treatment and mediator (3 sets of association strengths).

Overall, this yields a total of 108 ($3 \times 3 \times 4 \times 3$) simulated settings. Supplementary Table S1 summarizes the characteristics of the 36 main simulation settings (excluding the variation of the number of observations).

We note $K$ the number of dimensions of confounder covariates $X$. In this set of simulations, $K$ is fixed at 5. We define a confounder as a variable causally associated with at least two of the three variable types: treatment, outcome and mediator. We follow guidelines from Nguyen et al. [2021] and associate the (potentially disjoint) sets $T - Y$, $T - M$ and $M - Y$ confounders in a single set $X$. Similarly for mediators, $L$ is the true number of dimensions of mediators (a true mediator is characterized by a non-zero causal effect from the treatment on the mediator, and a non-zero effect of the mediator on the outcome).

We have used the following simulation framework

adjusting the strength of the indirect effect through T-M edge

$$X \sim \mathcal{N}(0, I_p) \qquad \text{non-linearity in the M model} \tag{9}$$

$$T|X \sim \text{Bernoulli}(\expit(\alpha_0 + X^t \alpha_X)) \tag{10}$$

$$M|X, T \sim \begin{cases} \text{Bernoulli}(\expit(\beta_0 + X^t \beta_X + (TX)^t \beta_{TX} + \omega_T \beta_T T)) & \text{if } M \text{ is binary} \\ \beta_0 + X^t \beta_X + (TX)^t \beta_{TX} + \omega_T \beta_T T + \mathcal{N}(0, \sigma_M^2) & \text{if } M \text{ is continuous} \end{cases} \tag{11}$$

$$Y|X, T, M \sim \gamma_0 + \gamma_T T + X^t \gamma_X + \omega_M \gamma_M M + \gamma_{MT} MT + \mathcal{N}(0, \sigma_Y^2) \tag{12}$$

non-linearity in the Y model

adjusting the strength of the indirect effect through M-Y edge

For all simulations, we have set $\sigma_M = \sigma_Y = 0.5$. The coefficients $\alpha_0, \beta_0$ and $\gamma_0$ are set to zero; $\alpha_X, \beta_X, \beta_T$, and $\beta_{TX}$ are drawn from a standard normal distribution, scaled by the total size of the coefficient, with $\beta_{TX}$ set to zero for simulations without non-linearity in the mediator model. For each simulation setting, a random seed is set, so that the coefficients do not vary among the repetitions, only the drawn data points. The coefficients for the outcome model are respectively set to

* $\gamma_0 = 0$;
* $\gamma_M = \mathbf{1}_L \frac{1}{2L}$, with $\mathbf{1}_d$ is the vector of length $d$ containing only ones;

* $\gamma_X = \frac{1}{K}$;

* $\gamma_T = 1.2$;

* $\gamma_{MT} = \gamma_M$ if we introduce a non-linearity in the outcome model, and the null vector otherwise.

In the rest of the article, we refer to misspecification for the outcome or mediator models when we introduce a non-linearity, i.e. when $\gamma_{MT}$ or $\beta_{TX}$ are different from zero respectively. The notion of misspecification is to understand with respect to the linear parametric specification of the nuisance parameters, used by default for most estimators, as described in Section 3.3.

The coefficient $\omega_M$ is used to modulate the mediated proportion, without influencing the respect of the positivity or overlap assumption 4. Increasing the $\omega_T$ coefficient also increases the indirect effect (and hence the mediated proportion), but can also generate violations to the positivity assumption 4. We have manually defined three sets of values for the pair $(\omega_T, \omega_M)$ for each of the mediator types (different values as we consider the joint effect, regardless of the dimension of the mediator) to cover the following situations

* low $\omega_M$ and $\omega_T$: low mediated proportion and no overlap violation,

* high $\omega_M$ and medium $\omega_T$: high mediated proportion and no overlap violation,

* medium $\omega_M$ and high $\omega_T$: high mediated proportion and strong overlap violation.

Supplementary Figure S1 illustrates the respect of the overlap assumption in simulated settings representative of those three situations.

The true effects of interest are defined as

$$ \theta(t) = \begin{cases} \gamma_T + \gamma_{MT} \mathbb{E}_X [\expit(\beta_0 + X^T \beta_X + (tX)^T \beta_{TX} + \omega_T \beta_T t)] & \text{if } M \text{ is binary} \\ \gamma_T + \gamma_{MT} \mathbb{E}_X [\beta_0 + X^T \beta_X + (tX)^T \beta_{TX} + \omega_T \beta_T t] & \text{if } M \text{ is continuous} \end{cases} $$

$$ \delta(t) = \begin{cases} \mathbb{E}_X [\mathbb{E} [(\expit(\beta_0 + X^T \beta_X + X^T \beta_{TX} + \omega_T \beta_T) - \expit(\beta_0 + X^T \beta_X)) (\omega_M \gamma_M + t \gamma_{MT})]] & \text{if } M \text{ is binary} \\ \mathbb{E}_X [\mathbb{E} [((\beta_0 + X^T \beta_X + (X)^T \beta_{TX} + \omega_T \beta_T) - (\beta_0 + X^T \beta_X)) (\omega_M \gamma_M + t \gamma_{MT})]] & \text{if } M \text{ is continuous.} \end{cases} $$

We computed the empirical expectations on our simulated data to obtain the true effect values using extremely large samples ($10^5$). The full detail of the computation can be found in Supplementary Paragraph S3.1.

We generated 200 repetitions for each of the 26 combinations of parameters, with 3 dataset sizes, making a total of 21,600 simulated datasets.

## 4.2 Uncertainty quantification

Some of the implemented estimators have theoretical results regarding the quantification uncertainty, i.e. provide asymptotic convergence results to obtain a confidence interval. To compare all estimators on an equal ground, and to simplify the implementation work, we use bootstrap to obtain confidence intervals, as it has been shown to be reliable [Hayes and Scharkow, 2013]. To make a mindful usage of computing resources, we have attempted to assess a reasonable number of bootstrap repetitions. Indeed, before bootstrap, we have more than 21,600 × 20 = 432,000 unique runs for all the datasets with all the methods (accounting for the fact that a few methods do not run in all the simulated mediator types), which then will be multiplied by the number of bootstrap repetitions. The complete benchmark without bootstrap repetitions has a total time slightly above 8.5 CPU days.

We have selected a subset of 100 simulated datasets, encompassing all the configurations and all the dataset sizes, and generated 1,000 bootstrap samples. We have then analyzed the stability of 95%-percentile-confidence intervals for an increasing number of bootstrap repetitions, and selected 100 repetitions, as it seems that most methods in most settings have then reached a stable estimate, which already represents 867 CPU days. We present a few representative illustrations of the confidence interval behavior in Supplementary Figure S2.
## 4.3 Results

We have applied the five representative mediation estimators (with a total of 26 variants listed in Supplementary Table S2) on a family of simulated datasets with varying types of mediator, and degree of non-linearity of the outcome and mediator models. We refer to settings with non-linearity of the outcome or mediator models as *misspecification*, in the sense that when estimators use parametric models for nuisance parameters estimation, this parametric model is linear, and hence misspecified to account for non-linearities. We compare the relative error for the total, direct and indirect effect, defined as $\frac{\hat{\tau}-\tau}{\tau}$, for example for the total effect $\tau$.

### 4.3.1 General trends

We first compare the estimators using the simplest setting (non-regularized generalized linear models in Fig. 3), and then assess the contribution of more complex estimation approaches. In Fig. 3, we

<figure><img src="image_4.png" /></figure>

**Figure 3: Total and natural direct and indirect effects obtained with unregularized estimators for a binary mediator.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. Each dot represents the average relative error (i.e. $\frac{\hat{\tau}-\tau}{\tau}$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the *high mediated proportion without overlap violation* framework with $n = 1,000$ observations, in the case of a binary mediator. The total effect is generally well estimated in all situations, but not the direct and indirect effects. The indirect and direct effects have different value, leading to a lack of symmetry in their relative error values, even if their absolute values are equal, leading to no error for the total effect estimation. Model misspecifications lead to estimation errors for most estimators, especially when the outcome model is misspecified. The results for all types of mediators are shown in Supplementary Figure S3.

present the relative errors for the total, direct and indirect effects with the *high mediated proportion without overlap violation* framework and $n = 1,000$ observations, for a binary mediator. Complete results for all estimator types are shown in Supplementary Figure S3. The total effect is almost always well estimated, but not the direct and indirect effects that exhibit opposite errors.

For the simplest simulations with a one-dimensional binary mediator, the different estimators behave mostly as expected depending the theoretical properties. All estimators achieve a very small or even negligible error in the *linear* setting where all models are well specified. The misspecification of the mediator model induces an error in the IPW estimator that relies solely on the estimation of the propensity of the treatment given the covariates, and on the propensity of the treatment given the covariates and the mediator; estimation of the latter can be impaired by the introduction of the interaction between the covariates and the mediator. The misspecification of the outcome model leads to a high estimation error for the estimators that rely the most on regression approaches of the outcome given the treatment, covariates and mediator, namely the coefficient product and the G-computation. Interestingly, estimators that require both the mediator and the outcome models to be correctly specified (*ie* the coefficient product and the G-estimation estimators) are more robust to a misspecification of the mediator model. This might be due to our simulation setting where the binary mediator has a more modest range of possible error, while the outcome is a continuous
variable. The multiply robust estimator and the double machine learning estimator have no error in the case where only the mediator or the outcome model, which illustrates their theoretical robustness property. Finally, when both the mediator and the outcome model are misspecified, all the non-robust estimators exhibit an erroneous estimation of the direct and indirect effects. This result is surprising as two misspecified models exceed the theoretical robustness property of the multiply robust and the double machine learning estimators, which might be related to the "mildness" of the mediator model misspecification mentioned above.

We observe a similar pattern for the results with a continuous one-dimension mediator. In that setting, only the coefficient product, the IPW and the double-machine-learning estimator provide a result. All estimators have a very small or no error when all models are linear; misspecification of the mediator but not the outcome model leads to an error for the IPW estimator, and the opposite for the coefficient product. The double machine learning estimator 3.2.3, with a simple unregularized linear nuisance estimation, is robust to misspecification, even of both the outcome and the mediator models.

For a mediator, we observe a similar behavior of the IPW and the coefficient product estimators. The G-computation estimator is also robust to the misspecification of the outcome model, which can be explained by a slightly different implementation for the implicit integration case that is used for continuous mediators, which allows more robustness to interactions, which is the type of misspecification used in this simulated dataset. In the case of a five-dimensional mediator, the IPW estimator exhibits a smaller error when the mediator model is misspecified, which might be linked to an intrinsic flexibility allowed by more variables and more parameters, that could compensate for the restriction of the linear parametric form Künzel et al. [2019].

Beyond the bias of the estimator, we have also explored the uncertainty of the estimates obtained with the different estimators, to go beyond the uncertainty visible so far that is due to the 200 repeated simulations of each situation. To that end, we generate 100 bootstrap samples in each case, and obtain a 95%-confidence intervals based on the 2.5 and 97.5 percentiles of the empirical bootstrap distribution. Supplementary Figure S4 presents the coverage of the confidence intervals *ie* the proportion of simulations where the true value is inside the confidence interval. By construction, this proportion should be 95%. We observe results that are very similar to what is obtained for the estimation error. We also consider the confidence interval width, represented in Supplementary Figure S5. A valuable insight is that the IPW estimator systematically has wider confidence intervals compared to the other methods, and that the doubly-robust estimators has slightly narrower intervals than the G-computation approach. This can constitute a discriminative criterion for the choice of the estimator as both estimators have very similar results for the estimation error.

### 4.3.2 Effect of the mediated proportion and overlap assumption

This first part of the results focuses on the assumptions about the parametric form of the nuisance parameter models, but the identification assumptions are also key to the validity of a causal mediation analysis. We now explore the impact of the size of the effect to estimate, and the validity of the overlap assumption.

In Figure 4, we compare the relative error in the estimation of the indirect effect in the three different simulation frameworks defined in Section 4.1: "low mediated proportion without overlap violation", "high mediated proportion without overlap violation" and "high mediated proportion with strong overlap violation". For consistency with other graphical representations, and to allow comparison between the different simulation frameworks, the estimation error in Figure 4 is presented as a relative error. However, the indirect effect in the "low mediated proportion without overlap violation" is very low, so even a small error leads to a large relative error, which can be misleading, so we also represent the absolute errors in Supplementary Figure S6. In both representations, we observe again that the violation of the overlap or positivity assumption leads to a higher error for almost all estimators, compared to the same order of magnitude of the mediated proportion without violation of this assumption. In particular, it breaks the multiply robust estimator and the double machine learning estimator that would otherwise exhibit very low error, even with model misspecification.
<figure><img src="image_5.png" /><figcaption>Figure 4: **Indirect effect estimation across different simulation frameworks with a binary mediator.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The three sets of dots in each panel correspond to the three simulation frameworks, in that order: *low mediated proportion without overlap violation, high mediated proportion without overlap violation* and *high mediated proportion with strong overlap violation*. "MP" stands for "mediated proportion" and "OV" for "overlap violation". Each dot represents the average relative error (i.e. $\frac{\tau-\tau}{\tau}$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are done with $n = 1,000$ observations. The estimation error for most estimators is greater when there is a violation of the overlap assumption, including in robust estimators. The absolute value of the indirect effect in the *low mediated proportion without overlap violation* is often very low, leading to very high relative errors compared to other settings. We found however that the representation of the relative error is informative. To enable the reader to have a thorough overview of the results, we have included the same figure with the absolute error as Supplementary Figure S6, as well as for other types of mediators.</figcaption></figure>

This is particularly obvious when considering the coverage shown in Supplementary Figure S7 and the width of the 95% bootstrap confidence intervals, shown in Supplementary Figure S8.

For the interpretation of results for the "low mediated proportion without overlap violation" framework, we refer to the Supplementary Figure S6, with the absolute error. We observe estimation errors similar to the "high mediated proportion without overlap violation" framework largely commented in Section 4.3.1. The apparently paradoxical very high relative error when the models are not misspecified observed for this framework in Figure 4 is only due to the relative error representation.

### 4.3.3 Effect of the number of observations

In Figure 5, we compare the relative error in the estimation of the indirect effect for three different numbers of observations. We observe little effect of the number of observations on the magnitude of the error. The main impact of increasing the number of available observations is to decrease the variance of the estimation, thus resulting in a more reliable result. For estimators with non-parametric models for the estimation of nuisance functions (Supplementary Figures S9 and S10), the behavior is different, and the relative error in the estimation of the indirect effect decreases with the increase of the number of observations, hinting at slow estimator convergence.

### 4.3.4 Practical recommendations to select an estimator and estimate nuisance parameters

We further explore the effect of some implementation variations of nuisance parameters estimation, namely the use of non-parametric models such as random forests [Breiman, 2001] (Figure 6-a, Supplementary Figure S10), the regularization of machine learning models (Figure 6-b, Supplementary Figure S9), the use of cross-fitting for a faster convergence [Chernozhukov et al., 2018] (Figure 6-c-d, Supplementary Figures S11 and S12).

Using machine learning models more complex than plain unregularized linear models, such as regularized linear models (Supplementary Figure S9) or random forests (Supplementary Figure S10)
<figure><img src="image_6.png" /><figcaption>**Figure 5: Relative indirect effect for different number of observations.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The three sets of dots in each panel correspond to estimations with an increasing number of observations from left to right ($n = 500, n = 1,000$ and $n = 10,000$ on each panel). Each dot represents the average relative error (i.e. $\frac{\hat{\tau} - \tau}{\tau}$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the "high mediated proportion without overlap violation" framework. The multiply-robust estimator only handles binary one-dimensional mediators, and has no results for the second and third rows. Overall, the position of each dot is quite steady over the three possible numbers of observations considered. Increasing the number of observations decreases the estimation uncertainty.</figcaption></figure>

generally yields a larger estimation error for the G-computation and IPW estimators. For the multiply robust and the double machine learning estimators, the results remain almost unbiased for all situations, except with random forests for nuisance estimation with continuous mediators. Cross-fitting (Figures S11 and S12) does not improve the performances.

Overall, our results show that the statistical robustness properties of some estimators are a better choice than the use of flexible non-parametric machine learning models in the case of model misspecification. However, the variance of the robust double machine learning or multiply-robust estimator increases importantly in the case of overlap violation. This failure can be a good way to practically detect this violation, and that the effects of interest are actually not identified.

When overlap is insufficient, interpolating effects from regions with overlap to those without can introduce bias. In the case where the user trusts that the effects are not too variant with the value of the covariates (low effect heterogeneity) interpolation of the effects from the regions of the feature space with overlap to the regions that lack overlap. In such cases, employing G-computation can mitigate this issue by estimating causal effects across the entire feature space.

Alternatively, enhancing the parametric models for both the mediator and outcome variables can improve estimation accuracy. Utilizing variants of the coefficient product estimator, which multiplies coefficients from different model components, can further refine the analysis [VanderWeele, 2015].
<figure><img src="image_7.png" /><figcaption>Figure 6: **Relative indirect effect for different plug-in nuisance parameters estimation strategies.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. Each panel compares two strategies for plug-in nuisance parameters estimation: (a) Random forest versus linear models, (b) linear models with or without L2-regularization, (c) regularized linear models with or without cross-fitting, (d) Random forests with or without cross-fitting. The three sets of dots in each panel correspond to estimations with an increasing number of observations from left to right ($n = 500, n = 1,000$ and $n = 10,000$ on each panel). Each dot represents the average relative error (i.e. $\frac{\hat{\tau}-\tau}{\tau}$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the "high mediated proportion without overlap violation" framework. Results are shown only for the binary one-dimensional mediators setting, full results are available in Supplementary Figures S9) to S12). Overall, alternative estimation strategies show very limited improvements or even performance deteriorations compared to the unregularized linear models, probably due to the very regular and simple simulation setting, and the slower convergence rate.</figcaption></figure>
Those more complex models include for example the use of a proper model depending on the type of
the mediator (logistic regression for a binary mediator instead of a standard regression), or parametric
regressions with interactions or engineered non-linear transformations of the covariates. These
approaches ensure that causal inferences remain robust and reliable, even in the presence of limited
overlap. We strongly recommend to use different estimators, and the comparison of the obtained
results can help diagnose whether the main issue is model misspecification or lack of overlap.

# 5 Application to cognitive function in the UK Biobank

The results on simulations constitute a valuable resource to understand and gain intuition on the
strengths and limitations of the different estimators. The analysis of real data often proves much
more complex, and we aim at providing a realistic example of how to conduct a causal mediation
analysis on actual data, with the associated difficulties, eg important number of variables, missing
data. We also illustrate how the results from the simulations can be used to diagnose the behavior
of the estimators on unknown data. Moreover, beyond the nuances between different estimators,
we aim to demonstrate that the validity and robustness of a causal mediation analysis also depend
on the entire process. This includes formulating the question, explicitly stating the identifiability
assumptions, making modeling choices, and, most importantly, clearly specifying and explaining
all choices and reasoning. This allows for scientific debate on the obtained results, for example, by
following the guidelines established by Lee et al. [2021].

## 5.1 Definition of the causal mediation question

The UK Biobank imaging project aims to collect brain scans from 100,000 participants (around 40,000 at the time data was collected for this research). This study makes it possible to use machine learning to derive objective measures of brain health without requiring in-depth human expert analysis. Previous studies found that to predict some constructs such as fluid intelligence and neuroticism, the joint use of both image-derived phenotypes (IDPs) and socio-demographic variables brought little to no performance increase compared to socio-demographic alone, although the IDPs alone have a non-zero predictive power Dadi et al. [2021], Cox et al. [2019]. This leads us to consider the hypothesis that the potential causal effect of some relevant socio-demographic features on cognitive function is actually mediated by the brain structure, which is captured by brain imaging. Furthermore, studies have shown that brain MRI captures biomarkers reflecting individuals’ overall health status and the pace of their aging [Cole et al., 2018]. This supports our mediator hypothesis, which incorporates various types of exposures throughout an individual’s life. This hypothesis is illustrated in the simplified causal graph presented in Figure 7.

To explore further this general hypothesis, we consider several exposures (or treatments) that have been shown to influence the brain structure and the cognitive functions. We have designed the following binary treatment variables from the raw UKBB variables: college or university degree, diabetes, hypercholesterol, hypertension, current depression, lifelong depression, social support, inflammation, current smoking, alcohol consumption, and obesity. More details about the UKBB variables used, and how they were aggregated to obtain binary exposures can be found in Supplementary Table S3.

The choice of considering several potential treatments with the same mediator allows us to tackle
the more general problem of the factors of brain plasticity with respect to complex and intricate life
factors rather than making strong claims about the particular mechanism of one exposure in particular.

## 5.2 Establishing identifiability: discussion the plausibility of the assumptions

After the definition of the causal question at hand, and the definition of the hypothesized potential
causal relationships between the variables, broadly sketched in the graph of Figure 7, one needs to
check the identifiability assumptions. The considered treatments are precisely defined and present
no interaction between the subjects, as they are independent participants to the UKBB study, hence
SUTVA is satisfied. Assumptions 2 and 3 focus on the confounding variables of either the treatment
<figure><img src="image_8.png" /><figcaption>**Figure 7:** Simplified causal graph illustrating the potential mediating role of the brain structural characteristics. To preserve readability, not all variables included in the analysis are represented. Several confounders are not directly observed, are difficult to define and properly assess. Thus they are grouped under the U node (Unobserved), such as genetic factors influencing the behavior or the physiology, environmental factors, developmental factors, major life events, personality traits, propensity to addictions. We assume that observed covariates cover all relevant aspects of those unobserved confounders. Other characteristics are measured and included in the adjustment set, such as lifestyle factors beyond alcohol and tobacco consumption, early life factors and the socio-economic status. We finally adjust for age and sex, as well as the all the alternative exposures, assumed to block the backdoor paths with unobserved nodes. This graph was created with Dagitty [Textor et al., 2016], and the source code to reproduce it can be found in Supplementary Code 1, with the list of all edges in the graph.</figcaption></figure>

and the mediator(s), the mediator(s) and the outcome, and of course between the treatment and the
outcome for the identifiability of the total potential causal effect, as well as the direct and indirect
effects. We have included a wide diversity of confounding variables to cover as much as possible
the potential behavioral, physiological and societal determinants of the exposures, mediators, and
outcomes, as well as sources of technical artifacts such as the evaluation center, or the position
of the head in the imaging device, or known brain diseases [Alfaro-Almagro et al., 2021, Newby
and Garfield, 2022, Schurz et al., 2021, Topiwala et al., 2022]. The positivity assumption 4 can
be empirically verified by comparison of the distributions of each confounder among the treated
and untreated, relying on the nuisance parameter that predicts the probability of the treated versus
untreated, conditionally on the covariates and mediators.

A second aspect of establishing identifiability is the preparation of variables to be included in the estimation models. Beyond some grouping rules to construct aggregate variables for treatment, like depressive syndromes detailed in the previous subsection, some groups of variables have been combined together as described below.
The first transformed variable is the outcome where several cognitive tests assessing different functions (e.g. working memory, fluid intelligence, vocabulary) into a single score measuring the general cognitive ability ("g-factor"), obtained as the first component of a Principal Component Analysis (PCA) [Fawns-Ritchie and Deary, 2020]. To avoid missing values, we restricted the construction of the g-factor to four tests at the imaging visit: pairs matching (field 398), the fluid intelligence score (field 20016), the prospective memory result (field 20018), and the reaction time (field 20023). As expected, the g-factor we obtained with PCA with standard scaling (package Scikit-Learn [Pedregosa et al., 2011]) was well correlated with the score of each test.

The second transformed group of variables represents imaging data. To account for a thorough joint mediation analysis by brain imaging data, we collected all the preprocessed variables (IDPs - imaging-derived phenotypes) [Miller et al., 2016, Alfaro-Almagro et al., 2018], namely derived from the dMRI skeleton (Category 134, 432 variables), Subcortical volumes (Category 1102, 14 variables), Regional gray matter volumes (Category 1101, 139 variables), T1 structural brain MRI (Category 110, 26 variables). It should be noted that these variables only describe structural information on the brain, and not function. We reduced the dimension using PCA after standard scaling, and retained 6 components by visual inspection of the explained variance barplot for each component (Supplementary Figure S13).

Finally, we aggregated the variables describing the lifestyle of participants, for two reasons: first reduce their dimensionality to facilitate the convergence of nuisance estimation models, and second to account for missing data due to the structure of the questionnaires where some questions are only presented to a participant depending on their answer to a previous question. We selected the relevant variables, transformed the categorical variables using one-hot-encoding, and only retained the variables with more than 10,000 non-zero values to eliminate the least used modalities. We then imputed the missing values and reduced the dimension of the data with the R packages missMDA and FactoMineR [Josse and Husson, 2016, Lê et al., 2008]. The analysis was then restricted on participants with brain MRI data. We performed the whole analysis with 2 or 5 components, with little influence on the final results for causal effects estimation, as shown in Supplementary Figures S14 and S15 for the effect of hypertension and of smoking. We present in the main text the results with 2 components for imputation.

We constructed two groupings of such variables: one for mental health variables (Categories Social support (100061), Mental health (100060), Addictions (141), Alcohol use (142), Anxiety (140), Depression (138), Happiness and subjective well-being (147), Unusual and psychotic experiences (144), Self-harm behaviors (146), Traumatic events (145), Mania (139), Mental distress (137)); and the other for lifestyle variables other than alcohol and tobacco use that were adjusted for separately (Categories Physical activity (100054), Electronic device use (100053), Sleep (100057), Cannabis use (143)). Adjustment on the derived principal components for mental health summary variables was done for all potential treatments except current and lifelong depressions, and for lifestyle summary variables (see Supplementary Tables S4 to S16).

5.3 Estimation: computation of the direct and indirect effects with different estimators

After the selection and the preparation of the different variables to include into the causal mediation
analysis (either as an exposure, a confounder, a mediator or an outcome, as detailed in Supplementary
Tables S4 to S16), we selected participants with brain imaging data, and no missing values for the
other considered variables, resulting in a dataset of N = 32, 498 independent participants. To estimate
the total, direct and indirect potential causal effects for each treatment, mediated by brain structure,
measured by brain MRI, we applied the estimators able to handle multidimensional mediators: the
coefficient product estimator, and several variants of implementation of the double machine learning
and IPW estimators. To assess uncertainty in the estimation, we applied the estimators to 100
bootstrapped samples for each exposure. We present general results for the three estimators for
all considered exposures in Figure 8. Overall, the results depended weakly on the choice of the
estimation method, nor the choice of the dimension for missing values imputation, as shown for two
representative exposures: hypertension and current smoking in Supplementary Figures S14 and S15.
<figure><img src="image_9.png" /><figcaption>Figure 8: **Total and indirect effect mediated by the brain structure for 11 exposures, estimated by the coefficient product, the double machine learning, the G-computation and the IPW estimators.** The left panel represents the total effect as a point over 100 bootstrapped samples. Each point represents the mean of the distribution. The error bar represent the 95% percentile-interval, estimated from the empirical bootstrap distribution We superimpose "x" crosses to represent the indirect effect on the left panel, where each point represents the average of the indirect effect over 100 bootstrapped samples. The right panel represents a focus on the indirect effects which are of smaller amplitude. The indirect effect for each exposure is represented by a pointplot, with the same representation rules as for the left panel. We can consider an effect to be significantly distinct from zero if the error bars do not cross the zero vertical line.</figcaption></figure>

However, we notice an important difference in the variance between the different estimators, with a very small variance for the coefficient product, and a much larger one for the double machine learning, the G-computation and IPW estimators. This indicates that there is no strong non-linearity in the nuisance parameters models, but that there might be overlap issues.

The interpretation of the estimated effects has to be conducted carefully, as those effects are only causal if all the identification assumptions are valid, otherwise those effects are actually associational. To make it clearer, we will refer to those effects as potentially causal. The exposures that have the potential larger impact on cognitive functions are the initial training obtained degree, as having obtained a college degree or equivalent ensures a much greater g-factor value. On the contrary, being currently smoking (N = 605) or suffering from diabetes is quite deleterious and results in a lower g-factor score. Several physiological disorders, such as diabetes, hyper-cholesterol, hypertension, inflammation and obesity tend to have a negative total potentially causal effect on cognitive functions, though not always found significant in our study. Finally psychological exposures (recent or lifelong depression and social support) have conflicting directions that are difficult to interpret.

Regarding the potential indirect effect estimates, they are systematically of much weaker amplitude than the total effect, except for obesity, hypertension, diabetes and alcohol consumption, indicating a strong contribution of the structural modifications to the total estimated causal effect. We found a significant negative potential indirect effect for exposure to hypertension, inflammation, alcohol consumption, diabetes and obesity, a rather negative but not significant indirect effect for current smoking, and diabetes perhaps due to a high variance associated with the low number of exposed participants. We finally report a null effect for college degree, hypercholesterol, recent or lifelong depression, and social support, indicating other mechanisms are involved in the variation of potential total effect of those exposures on cognitive function. Considering the simulated results, and the agreement between the coefficient product and the other methods, for almost all exposures, it could
be reasonable to consider this estimator's confidence interval for the exposures where all methods agree, yielding a much narrower confidence interval.

# 6 Discussion and Conclusion

In this work, we have proposed a complete overview of causal mediation analysis. We first described the framing of the problem in the potential outcomes framework and identifiability assumptions. We then presented the estimators for the causal effects of interest (the total effect, and the decomposition in the direct and indirect effect through the mediator(s)) ranging from the most classical to more recent approaches. And finally we detailed an illustrated example with all the analysis steps to grasp the range of possible results: total effect versus path-specific effects, and different proportions of the indirect effect compared to the total effect. The different exposures are also different with respect to the positivity assumption respect.

In simulations, we illustrated the limitations of the purely parametric models, in particular the widely used method of coefficient product, as such methods can heavily fail when the true relation between variables is not linear. We have included more recent approaches, as well as a Python implementation that was not available so far, and illustrate their very satisfying performances in a wide variety of simulated settings. Our experiments on the complex UKBB dataset shows they can be successfully applied to large-scale datasets.

Following previous recommendations for causal mediation analysis [Rohrer et al., 2022, Stuart et al., 2021, Lee et al., 2021], we strongly emphasize the importance of the plausibility, but mostly of the clear statement of the underlying identifying assumptions. A potential limit of our application to the UKBB data is that this is cross-sectional data, where a clear temporal order is not explicitly established by the way the data is collected. However, we have selected exposures that consist in explicit past events (college education) or chronic habits or conditions that should be relatively stable over time and be less sensitive to the collection date. Nonetheless, important assumptions regarding the causal relationships between the variables are made to ensure identifiability, as illustrated in the causal graph. Regarding the confounding variables, we have made the strong assumption that the observed variables are a sufficient adjustment set. An important confounder would be the brain structure (or brain imaging) at an earlier age, to ensure that some exposures like depression, are not caused by some early brain anomaly. The exclusion of patients with known brain disease slightly mitigates this risk, but repeated measures would have significantly strengthened the causal claim. An important underlying assumption is not explicitly stated, but can be deduced from the identifiability in the case of several mediators. If there are other mediators that are causally related to the mediator of interest, what we compute as the indirect effect might not entirely cover the full indirect effect. We may think for example to a mediation of obtaining a college degree by the type of professional occupation (intellectual or manual occupation, potentially with odd hours) - node $M_2$ in Figure 2, which might in turn affect the brain structure - node $M_1$ in Figure 2. If that is the case, as we do not account for $M_2$, we are actually computing $\delta^{M_1p}$ instead of $\delta^{M_1}$ (with notations introduced in section 2.3). This is a general limit of mediation analysis as one never considers all possible mediators and their complex relationships. Moreover, we have used a limited repertoire of brain variables (structural only) and reduce them quite strongly with PCA, which may lead to the underestimation of the indirect effect.

The assumptions that support the causal claim for mediation analysis are extremely strong, and stronger than for standard causal inference from observational data, and might be deemed implausible in all situations. Nonetheless, working in the causal framework encourages to a very rigorous and a very explicit framing of the underlying hypotheses, which can then be discussed through an open scientific discussion. Even with debatable validity, this constitutes a much more rigorous framework than other fields of data analysis where the line between interpretation of a predictive and causality is very fuzzy [Kumar et al., 2020, Loftus et al., 2024].

Overall, this work provides clear guidelines to conduct a causal mediation analysis, although the results rely on strong assumptions, and should always be interpreted carefully. It becomes increasingly
clear that mediation analysis helps formulating in a causal language the many correlations observed
in large-scale medical datasets, bridging the gap from basic statistics to causal understanding.

# 7 Data availability statement

The UK Biobank data is publicly available through a procedure described at http://www.ukbiobank.ac.uk/using-the-resource. This research has been conducted using the UK Biobank Resource under Application Number 49314.

# 8 Code availability

The code to reproduce the simulations and numerical analyses presented in this work is available at https://github.com/judithabk6/benchmark_mediation_analysis. The implementation of the causal mediation estimators can be found at https://github.com/judithabk6/med_bench.

# 9 Acknowledgments

This work was supported by the SC1-DTH-07-2018 H2020 VirtualBrainCloud Project under grant agreement No. 826421, the KARAIB AI chair (ANR-20-CHIA-0025-01), the H2020 Research Infrastructures Grant EBRAIN-Health 101058516, and the ANR under the MUSE grant (ANR-16-IDEX-0006). This work has benefited of the support of the Hi! PARIS Engineering Team.
References

J. M. Albert and S. Nelson. Generalized causal mediation analysis. *Biometrics*, 67(3):1028–1038, 2011.

F. Alfaro-Almagro, M. Jenkinson, N. K. Bangerter, J. L. Andersson, L. Griffanti, G. Douaud, S. N. Sotiropoulos, S. Jbabdi, M. Hernandez-Fernandez, E. Vallee, et al. Image processing and quality control for the first 10,000 brain imaging datasets from uk biobank. *Neuroimage*, 166:400–424, 2018.

F. Alfaro-Almagro, P. McCarthy, S. Afyouni, J. L. Andersson, M. Bastiani, K. L. Miller, T. E. Nichols, and S. M. Smith. Confound modelling in uk biobank brain imaging. *NeuroImage*, 224:117002, 2021.

C. Avin, I. Shpitser, and J. Pearl. Identifiability of path-specific effects. 2005.

R. M. Baron and D. A. Kenny. The moderator–mediator variable distinction in social psychological research: Conceptual, strategic, and statistical considerations. *Journal of personality and social psychology*, 51(6):1173, 1986.

H. Bodory and M. Huber. The causalweight package for causal inference in r. Technical report, University of Fribourg, 2018.

L. Breiman. Random forests. *Machine learning*, 45(1):5–32, 2001.

V. Chernozhukov, D. Chetverikov, M. Demirer, E. Duflo, C. Hansen, W. Newey, and J. Robins. Double/debiased machine learning for treatment and structural parameters, 2018.

O. Y. Chén, C. Crainiceanu, E. L. Ogburn, B. S. Caffo, T. D. Wager, and M. A. Lindquist. High-dimensional multivariate mediation with application to neuroimaging data. *Biostatistics*, 19(2):121–136, Apr. 2018. ISSN 1465-4644. doi: 10.1093/biostatistics/kxx027. URL https://academic.oup.com/biostatistics/article/19/2/121/3868977. Publisher: Oxford Academic.

W. G. Cochran. Analysis of covariance: its nature and uses. *Biometrics*, 13(3):261–281, 1957.

J. H. Cole, S. J. Ritchie, M. E. Bastin, V. Hernández, S. Muñoz Maniega, N. Royle, J. Corley, A. Pattie, S. E. Harris, Q. Zhang, et al. Brain age predicts mortality. *Molecular psychiatry*, 23(5):1385–1392, 2018.

S. R. Cox, S. J. Ritchie, C. Fawns-Ritchie, E. M. Tucker-Drob, and I. J. Deary. Structural brain imaging correlates of general intelligence in uk biobank. *Intelligence*, 76:101376, 2019.

K. Dadi, G. Varoquaux, J. Houenou, D. Bzdok, B. Thirion, and D. Engemann. Population modeling with machine learning can enhance measures of mental health. *Gigascience*, 10(10):giab071, 2021.

V. Djordjilović, C. M. Page, J. M. Gran, T. H. Nøst, T. M. Sandanger, M. B. Veierød, and M. Thoresen. Global test for high-dimensional mediation: Testing groups of potential mediators. *Statistics in medicine*, 38(18):3346–3360, 2019.

H. Farbmacher, M. Huber, L. Lafférs, H. Langen, and M. Spindler. Causal mediation analysis with double machine learning. *The Econometrics Journal*, 25(2):277–300, 2022.

C. Fawns-Ritchie and I. J. Deary. Reliability and validity of the uk biobank cognitive tests. *PloS one*, 15(4):e0231627, 2020.

A. F. Hayes and M. Scharkow. The relative trustworthiness of inferential tests of the indirect effect in statistical mediation analysis: does method really matter? *Psychological science*, 24(10): 1918–1927, 2013.
N. Hejazi, K. Rudolph, and I. Díaz. medoutcon: Nonparametric efficient causal mediation analysis with machine learning in r. *Journal of Open Source Software*, 7(69), 2022.

N. S. Hejazi, J. Duncan, D. McCoy, and M. J. van der Laan. tmle3mediate: Targeted learning for causal mediation analysis, 2021. URL https://github.com/tlverse/tmle3mediate. R package version 0.0.3.

O. Hines, S. Vansteelandt, and K. Diaz-Ordaz. Robust inference for mediated effects in partially linear models. *Psychometrika*, pages 1–24, 2021.

G. Hong. Ratio of mediator probability weighting for estimating natural direct and indirect effects. In *Proceedings of the American Statistical Association, Biometrics Section*, pages 2401–2415. American Statistical Association Alexandria, VA, 2010.

D. G. Horvitz and D. J. Thompson. A generalization of sampling without replacement from a finite universe. *Journal of the American statistical Association*, 47(260):663–685, 1952.

Y.-T. Huang and W.-C. Pan. Hypothesis test of mediation effect in causal mediation model with high-dimensional continuous mediators. *Biometrics*, 72(2):402–413, 2016.

M. Huber. Identifying causal mechanisms (primarily) based on inverse probability weighting. *Journal of Applied Econometrics*, 29(6):920–943, 2014.

M. Huber. A review of causal mediation analysis for assessing direct and indirect treatment effects. 2019.

M. Huber, M. Lechner, and G. Mellace. The finite sample performance of estimators for mediation analysis under sequential conditional independence. *Journal of Business & Economic Statistics*, 34(1):139–160, 2016.

K. Imai, L. Keele, and T. Yamamoto. Identification, inference and sensitivity analysis for causal mediation effects. *Statistical science*, 25(1):51–71, 2010.

G. W. Imbens and D. B. Rubin. *Causal inference in statistics, social, and biomedical sciences*. Cambridge University Press, 2015.

A. Jérolon, L. Baglietto, E. Birmelé, F. Alarcon, and V. Perduca. Causal mediation analysis in presence of multiple mediators uncausally related. *The International Journal of Biostatistics*, 2020.

J. Josse and F. Husson. missmda: a package for handling missing values in multivariate data analysis. *Journal of statistical software*, 70:1–31, 2016.

C. M. Judd and D. A. Kenny. Process analysis: Estimating mediation in treatment evaluations. *Evaluation review*, 5(5):602–619, 1981.

E. H. Kennedy. Semiparametric doubly robust targeted double machine learning: a review. *Handbook of Statistical Methods for Precision Medicine*, pages 207–236, 2024.

I. E. Kumar, S. Venkatasubramanian, C. Scheidegger, and S. Friedler. Problems with shapley-value-based explanations as feature importance measures. In *International conference on machine learning*, pages 5491–5500. PMLR, 2020.

S. R. Künzel, J. S. Sekhon, P. J. Bickel, and B. Yu. Metalearners for estimating heterogeneous treatment effects using machine learning. *Proceedings of the national academy of sciences*, 116 (10):4156–4165, 2019.

S. Lê, J. Josse, and F. Husson. Factominer: an r package for multivariate analysis. *Journal of statistical software*, 25:1–18, 2008.
H. Lee, A. G. Cashin, S. E. Lamb, S. Hopewell, S. Vansteelandt, T. J. VanderWeele, D. P. MacKinnon, G. Mansell, G. S. Collins, R. M. Golub, et al. A guideline for reporting mediation analyses of randomized trials and observational studies: the agreement statement. *Jama*, 326(11):1045–1056, 2021.

J. Loftus, L. Bynum, and S. Hansen. Causal dependence plots. *Advances in Neural Information Processing Systems*, 37:112656–112683, 2024.

D. P. MacKinnon. *Introduction to statistical mediation analysis*. Routledge, 2012.

K. L. Miller, F. Alfaro-Almagro, N. K. Bangerter, D. L. Thomas, E. Yacoub, J. Xu, A. J. Bartsch, S. Jbabdi, S. N. Sotiropoulos, J. L. Andersson, et al. Multimodal population brain imaging in the uk biobank prospective epidemiological study. *Nature neuroscience*, 19(11):1523–1536, 2016.

D. Newby and V. Garfield. Understanding the inter-relationships of type 2 diabetes and hypertension with brain and cognitive health: A uk biobank study. *Diabetes, Obesity and Metabolism*, 24(5): 938–947, 2022.

T. Q. Nguyen, I. Schmid, and E. A. Stuart. Clarifying causal mediation analysis for the applied researcher: Defining effects based on what we want to learn. *Psychological methods*, 26(2):255, 2021.

T. Q. Nguyen, E. L. Ogburn, I. Schmid, E. B. Sarker, N. Greifer, I. M. Koning, and E. A. Stuart. Causal mediation analysis: From simple to more robust strategies for estimation of marginal natural (in) direct effects. *Statistics surveys*, 17:1, 2023.

A. Niculescu-Mizil and R. Caruana. Predicting good probabilities with supervised learning. In *Proceedings of the 22nd international conference on Machine learning*, pages 625–632, 2005.

J. Pearl. Direct and indirect effects. In *Proceedings of the Seventeenth conference on Uncertainty in artificial intelligence*, pages 411–420, 2001.

T. A. Pearson, G. A. Mensah, R. W. Alexander, J. L. Anderson, R. O. Cannon III, M. Criqui, Y. Y. Fadl, S. P. Fortmann, Y. Hong, G. L. Myers, et al. Markers of inflammation and cardiovascular disease: application to clinical and public health practice: a statement for healthcare professionals from the centers for disease control and prevention and the american heart association. *circulation*, 107(3):499–511, 2003.

F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. *Journal of Machine Learning Research*, 12:2825–2830, 2011.

M. B. Pepys, G. M. Hirschfield, et al. C-reactive protein: a critical update. *The Journal of clinical investigation*, 111(12):1805–1812, 2003.

M. L. Petersen, S. E. Sinisi, and M. J. van der Laan. Estimation of direct causal effects. *Epidemiology*, pages 276–284, 2006.

J. J. Rijnhart, J. W. Twisk, M. J. Chinapaw, M. R. de Boer, and M. W. Heymans. Comparison of methods for the analysis of relatively simple mediation models. *Contemporary clinical trials communications*, 7:130–135, 2017.

J. M. Robins. Semantics of causal dag models and the identification of direct and indirect effects. In P. J. Green, S. Richardson, and Hjort, editors, *In Highly Structured Stochastic Systems*, pages 70–81. Oxford University Press, 2003.

J. M. Robins and S. Greenland. Identifiability and exchangeability for direct and indirect effects. *Epidemiology*, pages 143–155, 1992.
J. M. Rohrer, P. Hünermund, R. C. Arslan, and M. Elson. That's a lot to process! pitfalls of popular path models. *Advances in Methods and Practices in Psychological Science*, 5(2):25152459221095827, 2022.

K. E. Rudolph, D. E. Goin, and E. A. Stuart. The peril of power: a tutorial on using simulation to better understand when and how we can estimate mediating effects. *American journal of epidemiology*, 189(12):1559–1567, 2020.

M. Schurz, L. Q. Uddin, P. Kanske, C. Lamm, J. Sallet, B. C. Bernhardt, R. B. Mars, and D. Bzdok. Variability in brain structure and function reflects lack of peer support. *Cerebral Cortex*, 31(10): 4612–4627, 2021.

D. W. Scott and S. R. Sain. Multi-dimensional density estimation, 2004.

B. Shi, C. Choirat, B. A. Coull, T. J. VanderWeele, and L. Valeri. Cmaverse: a suite of functions for reproducible causal mediation analyses. *Epidemiology*, 32(5):e20-e22, 2021.

A. Stolicyn, M. A. Harris, X. Shen, M. C. Barbu, M. J. Adams, E. L. Hawkins, L. de Nooij, H. W. Yeung, A. D. Murray, S. M. Lawrie, et al. Automated classification of depression from structural brain measures across two independent community-based cohorts. *Human brain mapping*, 41(14): 3922–3937, 2020.

E. A. Stuart, I. Schmid, T. Nguyen, E. Sarker, A. Pittman, K. Benke, K. Rudolph, E. Badillo-Goicoechea, and J.-M. Leoutsakos. Assumptions not often assessed or satisfied in published mediation analyses in psychology and psychiatry. *Epidemiologic reviews*, 43(1):48–52, 2021.

C. Sudlow, J. Gallacher, N. Allen, V. Beral, P. Burton, J. Danesh, P. Downey, P. Elliott, J. Green, M. Landray, et al. Uk biobank: an open access resource for identifying the causes of a wide range of complex diseases of middle and old age. *PLoS medicine*, 12(3):e1001779, 2015.

E. J. T. Tchetgen and I. Shpitser. Semiparametric theory for causal mediation analysis: efficiency bounds, multiple robustness, and sensitivity analysis. *Annals of statistics*, 40(3):1816, 2012.

J. Textor, B. Van der Zander, M. S. Gilthorpe, M. Liśkiewicz, and G. T. Ellison. Robust causal inference using directed acyclic graphs: the r package ‘dagitty’. *International journal of epidemiology*, 45(6):1887–1894, 2016.

A. Topiwala, K. P. Ebmeier, T. Maullin-Sapey, and T. E. Nichols. Alcohol consumption and mri markers of brain structure and function: Cohort study of 25,378 uk biobank participants. *NeuroImage: Clinical*, 35:103066, 2022.

M. J. Valente, J. J. Rijnhart, H. L. Smyth, F. B. Muniz, and D. P. MacKinnon. Causal mediation programs in r, m plus, sas, spss, and stata. *Structural equation modeling: a multidisciplinary journal*, 27(6):975–984, 2020.

T. VanderWeele. *Explanation in causal inference: methods for mediation and interaction*. Oxford University Press, 2015.

T. VanderWeele and S. Vansteelandt. Mediation analysis with multiple mediators. *Epidemiologic methods*, 2(1):95–115, 2014.

S. Vansteelandt and T. J. VanderWeele. Natural direct and indirect effects on the exposed: effect decomposition under weaker assumptions. *Biometrics*, 68(4):1019–1027, 2012.

B. Zadrozny and C. Elkan. Transforming classifier scores into accurate multiclass probability estimates. In *Proceedings of the eighth ACM SIGKDD international conference on Knowledge discovery and data mining*, pages 694–699, 2002.

H. Zenati, J. Abécassis, J. Josse, and B. Thirion. Double debiased machine learning for mediation analysis with continuous treatments. *arXiv preprint arXiv:2503.06156*, 2025.
H. Zhang, J. Chen, Y. Feng, C. Wang, H. Li, and L. Liu. Mediation effect selection in high-dimensional and compositional microbiome data. *Statistics in medicine*, 40(4):885–896, 2021.

Y. Zhao, M. A. Lindquist, and B. S. Caffo. Sparse principal component based high-dimensional mediation analysis. *Computational Statistics and Data Analysis*, 142:106835, 2020.

W. Zheng and M. J. van der Laan. Targeted maximum likelihood estimation of natural direct effects. *The international journal of biostatistics*, 8(1):1–40, 2012.
# S1 Identifiability of the total effect, and the natural direct and indirect effect

Let us first consider the potential outcomes $Y(t, M(t))$:

$$ 
\begin{aligned}
& \mathbb{E}[Y(t, M(t))] \\
&=\mathbb{E}[\mathbb{E}[Y(t, M(t))|X=x]] \\
&=\mathbb{E}[\mathbb{E}[Y(t, M(t))|T=t, X=x]] \\
&=\mathbb{E}[\mathbb{E}[Y|T=t, X=x]] \\
&=\mathbb{E}\left[\mathbb{E}\left[\begin{array}{l} Y \cdot I\{T=t\} \\ \mathbb{P}(T=t|X) \end{array} | X=x\right]\right] \\
&=\mathbb{E}\left[\begin{array}{l} Y \cdot I\{T=t\} \\ \mathbb{P}(T=t|X) \end{array}\right]
\end{aligned}
\quad (13) $$

And then the cross-world potential outcomes $Y(t, M(t'))$.

$$ 
\begin{aligned}
& \mathbb{E}[Y(t, M(t'))] \\
&=\mathbb{E}[\mathbb{E}[Y(t, M(t'))|X=x]] \\
&=\mathbb{E}[\mathbb{E}[Y(t, m)|X=x, M(t')=m]]] \\
&=\iint \mathbb{E}[Y(t, m)|M(t')=m, X=x] f_{M(t')=m|X=x} dm f_{X=x} dx \\
&=\iint \mathbb{E}[Y|T=t, M=m, X=x] f_{M(t')=m|X=x} f_{X=x} dm dx \\
&=\iint \mathbb{E}[Y|T=t, M=m, X=x] f_{M=m|T=t', X=x} f_{X=x} dm dx \\
&=\iint \mathbb{E}[Y|T=t, M=m, X=x] \cdot \frac{\mathbb{P}(T=t'|M=m, X=x)}{\mathbb{P}(T=t'|X=x)} f_{M=m|X=x} dm f_{X=x} dx \\
&=\mathbb{E}\left[\mathbb{E}\left[\mathbb{E}\left[\begin{array}{l} Y \cdot I\{T=t\} \\ \mathbb{P}(T=t|M, X) \end{array} | M, X\right] \cdot \frac{\mathbb{P}(T=t'|M, X)}{\mathbb{P}(T=t'|X)} | X\right]\right] \\
&=\mathbb{E}\left[\frac{Y \cdot I\{T=t\}}{\mathbb{P}(T=t|M, X)} \cdot \frac{\mathbb{P}(T=t'|M, X)}{\mathbb{P}(T=t'|X)}\right] \\
&=\mathbb{E}\left[\frac{Y \cdot I\{T=t\}}{\mathbb{P}(T=t|X)} \cdot \frac{f(M=m|T=t', X)}{f(M=m|T=t, X)}\right]
\end{aligned}
\quad (15) \quad (16) $$

# S2 More details about the causal mediation estimators derivation

## S2.1 G-computation without mediator density estimation

We recall the mediation formula

$$ 
\begin{aligned}
\theta(t) &= \iint \{\mathbb{E}[Y | T = 1, M = m, X = x] - \mathbb{E}[Y | T = 0, M = m, X = x]\} f_{M=m|T=t, X=x} dm f_{X=x} dx \\
\delta(t) &= \iint \mathbb{E}[Y | T = t, M = m, X = x] \{f_{M=m|T=1, X=x} - f_{M=m|T=0, X=x}\} dm f_{X=x} dx.
\end{aligned}
$$

Instead of doing the double integration explicitly in the estimation, we can integrate over the mediator in the mediation formula above, yielding:

$$ 
\begin{aligned}
\theta(t) &= \int \left( \mathbb{E}[\mu_Y(1, m, x)|T=t, X=x] - \mathbb{E}[\mu_Y(0, m, x)|T=t, X=x] \right) f_{X=x} dx \\
\delta(t) &= \int \left( \mathbb{E}[\mu_Y(t, m, x)|T=1, X=x] - \mathbb{E}[\mu_Y(t, m, x)|T=0, X=x] \right) f_{X=x} dx.
\end{aligned}
$$

with $\mu_Y(t, m, x) = \mathbb{E}[Y | T = t, M = m, X = x]$. Those terms involving two different values of the treatment are called cross-world conditional mean outcomes, $\omega_Y(t, t', x) = \mathbb{E}[\mu_Y(t, m, x)|T = t', X = x]$, following the notations of [Zenati et al., 2025], and represent the expected outcome for values of the treatment $t$ in the population that has actually received the treatment $t'$. It can be estimated by

1. fit a regression model to predict $Y$ from $(T, M, X)$ (model $\hat{\mu}$)

2. fit a second regression model on the predictions $\hat{Y}$ from $\hat{\mu}$ on $X$, in the population where $T = t'$ (model $\hat{v}_{t'}(\hat{\mu}(t, m, x), x)$)
3. take the empirical mean of those predictions from the second regression over the whole sample

This leads to the following for estimation: $\hat{\omega}_Y(t, t', x) = \hat{\nu}_{t'}(\hat{\mu}(t, M_i, X_i), X_i)$

$$ 
\begin{aligned}
\hat{\theta}(t) &= \frac{1}{n} \sum_{i=1}^{n} \hat{\omega}_Y(1, t, x) - \hat{\omega}_Y(0, t, x) \\
&= \frac{1}{n} \sum_{i=1}^{n} \hat{\nu}_t(\hat{\mu}(1, M_i, X_i), X_i) - \hat{\nu}_t(\hat{\mu}(0, M_i, X_i), X_i)
\end{aligned}
\qquad (17) $$

$$ 
\begin{aligned}
\hat{\delta}(t) &= \frac{1}{n} \sum_{i=1}^{n} \hat{\omega}_Y(t, 1, x) - \hat{\omega}_Y(t, 0, x) \\
&= \frac{1}{n} \sum_{i=1}^{n} \hat{\nu}_1(\hat{\mu}(t, M_i, X_i), X_i) - \hat{\nu}_0(\hat{\mu}(t, M_i, X_i), X_i)
\end{aligned}
$$

This new formula does not necessitate the estimation of the mediator density, but two nested regression steps.

## S3 More details on simulation settings

We describe the main parameters of each considered simulation setting in Table S1.

<table><thead><tr><th>setting_nb</th><th>n</th><th>dim_x</th><th>dim_m</th><th>type_m</th><th>wt_list</th><th>wm_list</th><th>m_misspec</th><th>y_misspec</th><th>mediated Property</th><th>total</th><th>direct_1</th><th>direct_0</th><th>indirect_1</th><th>indirect_0</th></tr></thead><tbody><tr><td>1</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>0.50</td><td>0.50</td><td>False</td><td>False</td><td>0.02</td><td>1.23</td><td>1.20</td><td>1.20</td><td>0.03</td><td>0.03</td></tr><tr><td>2</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>0.50</td><td>0.50</td><td>True</td><td>False</td><td>0.02</td><td>1.23</td><td>1.20</td><td>1.20</td><td>0.03</td><td>0.03</td></tr><tr><td>3</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>0.50</td><td>0.50</td><td>False</td><td>True</td><td>0.06</td><td>1.54</td><td>1.51</td><td>1.45</td><td>0.09</td><td>0.03</td></tr><tr><td>4</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>0.50</td><td>0.50</td><td>True</td><td>True</td><td>0.05</td><td>1.53</td><td>1.51</td><td>1.45</td><td>0.08</td><td>0.03</td></tr><tr><td>5</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.50</td><td>0.50</td><td>False</td><td>False</td><td>0.10</td><td>1.33</td><td>1.20</td><td>1.20</td><td>0.13</td><td>0.13</td></tr><tr><td>6</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.50</td><td>0.50</td><td>True</td><td>False</td><td>0.09</td><td>1.32</td><td>1.20</td><td>1.20</td><td>0.12</td><td>0.12</td></tr><tr><td>7</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.50</td><td>0.50</td><td>False</td><td>True</td><td>0.24</td><td>1.58</td><td>1.45</td><td>1.20</td><td>0.38</td><td>0.13</td></tr><tr><td>8</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.50</td><td>0.50</td><td>True</td><td>True</td><td>0.25</td><td>1.60</td><td>1.46</td><td>1.20</td><td>0.40</td><td>0.13</td></tr><tr><td>9</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.20</td><td>0.20</td><td>False</td><td>False</td><td>0.02</td><td>1.22</td><td>1.20</td><td>1.20</td><td>0.02</td><td>0.02</td></tr><tr><td>10</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.20</td><td>0.20</td><td>True</td><td>False</td><td>0.02</td><td>1.22</td><td>1.20</td><td>1.20</td><td>0.02</td><td>0.02</td></tr><tr><td>11</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.20</td><td>0.20</td><td>False</td><td>True</td><td>0.08</td><td>1.31</td><td>1.29</td><td>1.19</td><td>0.11</td><td>0.02</td></tr><tr><td>12</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.20</td><td>0.20</td><td>True</td><td>True</td><td>0.09</td><td>1.32</td><td>1.30</td><td>1.20</td><td>0.11</td><td>0.02</td></tr><tr><td>13</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>2.00</td><td>10.00</td><td>False</td><td>False</td><td>0.61</td><td>3.05</td><td>1.20</td><td>1.20</td><td>1.85</td><td>1.85</td></tr><tr><td>14</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>2.00</td><td>10.00</td><td>True</td><td>False</td><td>0.60</td><td>3.00</td><td>1.20</td><td>1.20</td><td>1.80</td><td>1.80</td></tr><tr><td>15</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>2.00</td><td>10.00</td><td>False</td><td>True</td><td>0.59</td><td>3.52</td><td>1.64</td><td>1.45</td><td>2.07</td><td>1.88</td></tr><tr><td>16</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>2.00</td><td>10.00</td><td>True</td><td>True</td><td>0.58</td><td>3.43</td><td>1.63</td><td>1.45</td><td>1.98</td><td>1.80</td></tr><tr><td>17</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.80</td><td>5.00</td><td>False</td><td>False</td><td>0.63</td><td>3.27</td><td>1.20</td><td>1.20</td><td>2.07</td><td>2.07</td></tr><tr><td>18</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.80</td><td>5.00</td><td>True</td><td>False</td><td>0.59</td><td>2.95</td><td>1.20</td><td>1.20</td><td>1.75</td><td>1.75</td></tr><tr><td>19</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.80</td><td>5.00</td><td>False</td><td>True</td><td>0.62</td><td>3.24</td><td>1.57</td><td>1.17</td><td>2.01</td><td>1.67</td></tr><tr><td>20</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>0.80</td><td>5.00</td><td>True</td><td>True</td><td>0.68</td><td>3.75</td><td>1.61</td><td>1.21</td><td>2.57</td><td>2.14</td></tr><tr><td>21</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.30</td><td>5.00</td><td>False</td><td>False</td><td>0.37</td><td>1.90</td><td>1.20</td><td>1.20</td><td>0.70</td><td>0.70</td></tr><tr><td>22</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.30</td><td>5.00</td><td>True</td><td>False</td><td>0.39</td><td>1.97</td><td>1.20</td><td>1.20</td><td>0.77</td><td>0.77</td></tr><tr><td>23</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.30</td><td>5.00</td><td>False</td><td>True</td><td>0.41</td><td>2.03</td><td>1.34</td><td>1.19</td><td>0.82</td><td>0.69</td></tr><tr><td>24</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>0.30</td><td>5.00</td><td>True</td><td>True</td><td>0.44</td><td>2.13</td><td>1.35</td><td>1.20</td><td>0.94</td><td>0.78</td></tr><tr><td>25</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>4.00</td><td>2.00</td><td>False</td><td>False</td><td>0.28</td><td>1.67</td><td>1.20</td><td>1.20</td><td>0.47</td><td>0.47</td></tr><tr><td>26</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>4.00</td><td>2.00</td><td>True</td><td>False</td><td>0.29</td><td>1.68</td><td>1.20</td><td>1.20</td><td>0.48</td><td>0.48</td></tr><tr><td>27</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>4.00</td><td>2.00</td><td>False</td><td>True</td><td>0.33</td><td>2.17</td><td>1.69</td><td>1.45</td><td>0.72</td><td>0.48</td></tr><tr><td>28</td><td>500</td><td>5</td><td>1</td><td>binary</td><td>4.00</td><td>2.00</td><td>True</td><td>True</td><td>0.33</td><td>2.16</td><td>1.69</td><td>1.45</td><td>0.71</td><td>0.47</td></tr><tr><td>29</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>2.00</td><td>1.00</td><td>False</td><td>False</td><td>0.47</td><td>2.26</td><td>1.20</td><td>1.20</td><td>1.06</td><td>1.06</td></tr><tr><td>30</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>2.00</td><td>1.00</td><td>True</td><td>False</td><td>0.45</td><td>2.18</td><td>1.20</td><td>1.20</td><td>0.98</td><td>0.98</td></tr><tr><td>31</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>2.00</td><td>1.00</td><td>False</td><td>True</td><td>0.63</td><td>3.20</td><td>2.20</td><td>1.20</td><td>2.01</td><td>1.00</td></tr><tr><td>32</td><td>500</td><td>5</td><td>1</td><td>continuous</td><td>2.00</td><td>1.00</td><td>True</td><td>True</td><td>0.62</td><td>3.20</td><td>2.20</td><td>1.20</td><td>2.00</td><td>1.00</td></tr><tr><td>33</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>1.00</td><td>1.00</td><td>False</td><td>False</td><td>0.29</td><td>1.69</td><td>1.20</td><td>1.20</td><td>0.49</td><td>0.49</td></tr><tr><td>34</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>1.00</td><td>1.00</td><td>True</td><td>False</td><td>0.30</td><td>1.71</td><td>1.20</td><td>1.20</td><td>0.51</td><td>0.51</td></tr><tr><td>35</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>1.00</td><td>1.00</td><td>False</td><td>True</td><td>0.46</td><td>2.22</td><td>1.71</td><td>1.21</td><td>1.02</td><td>0.51</td></tr><tr><td>36</td><td>500</td><td>5</td><td>5</td><td>continuous</td><td>1.00</td><td>1.00</td><td>True</td><td>True</td><td>0.45</td><td>2.20</td><td>1.70</td><td>1.20</td><td>1.00</td><td>0.50</td></tr></tbody></table>

Table S1: parameter settings for simulations. This table presents the different sets of parameters chosen for the simulations. The different color blocks represent modulations of the mediated proportion, with a low proportion (green), a high proportion but no overlap violation (orange) or a high proportion with a strong overlap violation (gray). Those proportions are adjusted either through $\omega_M$ which sets the strength of the relation between M and Y, or through $\omega_T$ which sets the strength of the relation between T and M. A value of $\omega_T$ too high can lead to the violation of the overlap assumption.

In Figure S1, we illustrate the respect of the overlap assumption 4 by representing the conditional probability of treatment given covariates and mediator(s), $\rho(M, X) = P(T = 1 | X, M)$ for the treated and the untreated in representative simulation settings for each of the three ($\omega_T, \omega_M$) value sets.

### S3.1 Theoretical effects

We are interested in the natural direct effect, $\theta$, and in the natural indirect effect, $\delta$. We provide here a computation of the theoretical value of those effects.
<figure><img src="image_10.png" /><figcaption>Figure S1: Propensity score for different simulation settings, with low mediated proportion (left column), high mediated proportion and no overlap violation (middle column) or high mediated proportion and strong overlap violation (right column), for a binary one-dimension mediator (first row), a continuous one-dimension mediator (second row) or a continuous five-dimension mediator (last row). As expected, we see the strongest overlap violations for the right column, with a high mediated proportion but driven by a stronger link between T and M (high $\omega_T$ coefficient).</figcaption></figure>

### S3.1.1 with a binary mediator

$$ 
\begin{aligned}
\theta(t) &= \mathbb{E}_X [\mathbb{E}[Y(1, M(t)) - Y(0, M(t)) | X = x]] \\
&= \mathbb{E}_X \left[ \mathbb{E} \left[ \begin{aligned} &\gamma_0 + x^T \gamma_X + \gamma_T + \omega_M \gamma_M M(t) + \gamma_{MT} M(t) \\ &-(\gamma_0 + x^T \gamma_X + \omega_M \gamma_M M(t)) | X = x \end{aligned} \right] \right] \\
&= \mathbb{E}_X [\mathbb{E}[\gamma_T + \gamma_{MT} M(t) | X = x]] \\
&= \gamma_T + \gamma_{MT} \mathbb{E}_X \left[ \text{expit}(\beta_0 + X^T \beta_X + (tX)^T \beta_{TX} + \omega_T \beta_T t) \right]
\end{aligned}
$$
$$
\begin{align*}
\delta(t) &= \mathbb{E}_X [\mathbb{E}[Y(t, M(1)) - Y(t, M(0)) | X = x]] \\
&= \mathbb{E}_X [\mathbb{E}[\gamma_0 + X^T \gamma_X + \gamma_T t + \omega_M \gamma_M M(1) + \gamma_{MT} M(1)t \\
&\quad -(\gamma_0 + X^T \gamma_X + \gamma_T t + \omega_M \gamma_M M(0) + \gamma_{MT} M(0)t)]] \\
&= \mathbb{E}_X [\mathbb{E}[(M(1) - M(0))(\omega_M \gamma_M + t \gamma_{MT})]] \\
&= \mathbb{E}_X [\mathbb{E}[(\expit(\beta_0 + X^T \beta_X + X^T \beta_{TX} + \omega_T \beta_T) - \\
&\quad \expit(\beta_0 + X^T \beta_X))(\omega_M \gamma_M + t \gamma_{MT})]]
\end{align*}
$$

### S3.1.2 with a continuous mediator

$$
\begin{align*}
\theta(t) &= \mathbb{E}_X [\mathbb{E}[Y(1, M(t)) - Y(0, M(t)) | X = x]] \\
&= \mathbb{E}_X [\mathbb{E}[\gamma_0 + x^T \gamma_X + \gamma_T + \omega_M \gamma_M M(t) + \gamma_{MT} M(t) \\
&\quad -(\gamma_0 + x^T \gamma_X + \omega_M \gamma_M M(t)) | X = x]] \\
&= \mathbb{E}_X [\mathbb{E}[\gamma_T + \gamma_{MT} M(t) | X = x]] \\
&= \gamma_T + \gamma_{MT} \mathbb{E}_X [\beta_0 + X^T \beta_X + (tX)^T \beta_{TX} + \omega_T \beta_T]
\end{align*}
$$

$$
\begin{align*}
\delta(t) &= \mathbb{E}_X [\mathbb{E}[Y(t, M(1)) - Y(t, M(0)) | X = x]] \\
&= \mathbb{E}_X [\mathbb{E}[\gamma_0 + X^T \gamma_X + \gamma_T t + \omega_M \gamma_M M(1) + \gamma_{MT} M(1)t \\
&\quad -(\gamma_0 + X^T \gamma_X + \gamma_T t + \omega_M \gamma_M M(0) + \gamma_{MT} M(0)t)]] \\
&= \mathbb{E}_X [\mathbb{E}[(M(1) - M(0))(\omega_M \gamma_M + t \gamma_{MT})]] \\
&= \mathbb{E}_X [\mathbb{E}[(\beta_0 + X^T \beta_X + (X)^T \beta_{TX} + \omega_T \beta_T) - \\
&\quad (\beta_0 + X^T \beta_X))(\omega_M \gamma_M + t \gamma_{MT})]]
\end{align*}
$$

## S4 How many bootstrap repetitions are required to obtain decent percentile confidence intervals?

To assess a reasonable number of bootstrap repetitions to assess the characteristics of estimators' convergence, we have conducted 1,000 bootstrap repetitions on 100 varied simulated datasets. We represent the mean, and the 2.5 and 97.5 percentiles for different number of bootstrap samples ranging from 1 to 1,000 in Supplementary Figure S2.

## S5 Extended results on simulations

In this section, we report more details on the simulation results, including results for the total and indirect effects, and the effect of calibration and cross-fitting for all algorithms for nuisance parameters estimation.

We consider the variant estimators listed in Table S2.

Supplementary Figure S4 represents the coverage, and Supplementary Figure S5 the width of 95% percentile bootstrap confidence intervals for the estimation of the different effects. We observe results that are very similar to what is obtained for the estimation error. A valuable insight is that the IPW estimator systematically has wider confidence intervals compared to the other methods, and that the doubly-robust estimators has slightly narrower intervals than the G-computation approach. This can constitute a discriminative criterion for the choice of the estimator as both estimators have very similar results for the estimation error.

In Supplementary Figure S3, we present the same results as Figure 3 with the continuous one-dimensional mediator (second row) and the multi-dimensional mediator (third row). The pattern of bias is similar to the pattern observed for the binary mediator, with an important bias of the IPW estimator when the mediator model is misspecified, and for the coefficient product when the outcome model is misspecified. In the case
Coefficient product
G-computation (forest)
G-computation (forest & cross-fitting)
G-computation (no regularization)
G-computation (regularization)
G-computation (regularization & cross-fitting)
G-computation (forest)
G-computation (forest & cross-fitting)
G-computation (no regularization)
G-computation (regularization)
G-computation (regularization & cross-fitting)
IPW (forest)
IPW (forest & cross-fitting)
IPW (no regularization)
IPW (regularization)
IPW (regularization & cross-fitting)
multiply robust (forest)
multiply robust (forest & cross-fitting)
multiply robust (no regularization)
multiply robust (regularization)
multiply robust (regularization & cross-fitting)
medDML (no regularization)
medDML (regularization)
medDML (regularization & cross-fitting)
medDML (forest)
medDML (forest & cross-fitting)

<caption>Table S2: List of considered estimators and their implementation variants</caption>

of a multi-dimensional mediator, the bias is less important for the IPW estimator when the mediator model is misspecified. The higher number of mediators may provide additional intrinsic flexibility to the propensity score model, as the mediators are used solely to predict the binary treatment and are not explicitly modeled themselves. The G-computation estimator does not exhibit a bias in the estimation when the mediator is continuous. This is related to our implementation for the case of the implicit integration for the mediator density involves two distinct regressions for the outcome model, one regression for the treated units, and one for the untreated units. This pattern is similar to the difference between the S-learner and the T-learner estimators in standard causal inference without mediation, and is known to be able to model properly interactions between the treatment and the covariates [Künzel et al., 2019]. This property explains why the G-computation in this implementation does not suffer from the outcome model misspecification. However, in theory, it would handle badly more complex non-linearities of the covariates.

In Supplementary Figure S6, we present the same results as Figure 4 with the absolute error, so that the reader can fully interpret the simulation errors, and include results for the continuous mediators. The IPW estimators exhibits an important error rate for continuous mediators and overlap violation even in the absence of misspecification of the mediator model.

We also consider the behavior of the confidence interval coverage and width over those different configurations in Supplementary Figures S7 and S8. In this case, the behavior of those additional performance metrics is very different from the estimation error. Indeed, the double machine learning estimator with multi-dimensional mediators exhibits a very important drop in coverage when there is an overlap violation, but only a modest estimation error, that does not appear statistically significant. For the estimators involving inverse-propensity-weighting (IPW, G-computation and) continuous mediators, we observe an important increase

In the following experiments, we focus on four estimators that we have re-implemented in Python for this study, and assess the impact of using machine learning for the nuisance functions, instead of plain parametric linear models. We consider the IPW estimator, the G-computation estimator, the multiply-robust estimator and the double-machine learning estimator. A first improvement we can apply is regularization, by imposing a penalty on the size of the coefficients. In our implementation, the hyperparameter setting the amount of shrinkage is set by cross-validation. Supplementary Figure S9 presents the results for the unregularized and the regularized versions of those three estimators in the "high mediated proportion without overlap violation" framework. Overall, the regularized estimators underperform their unregularized equivalent. Contrary to what we observed with the unregularized estimators (Figure 5, and Supplementary Figure S9), we see that the estimation error decreases with the number of samples, indicating a slow convergence. However, even with a large sample, the error is still
much larger for the regularized estimators. This could be explained by the fact that this is a well-posed regime, with not-so-high dimensional data and a lot of samples. Regularization becomes futile and may bias estimators when we compare different parameter settings.

We observe the same trend, and no improvement on the estimation accuracy when we replace the nuisance functions models by random forests [Breiman, 2001] (Supplementary Figure S10, even when the mediator or outcome models are misspecified. In the case of the G-computation, with a very large number of observations, the performance of the estimator with forest nuisance models seems to catch up with the linear model, indicating that it could eventually converge to an unbiased estimation for the one-dimensional binary or continuous mediator, however, the convergence is really slow for the multi-dimensional case. For the double machine learning estimator, the robustness property with misspecified nuisance function seems to be the best solution.

In Supplementary Figures S11 and S12, we explore the potential improvement obtained by using cross-fitting for the nuisance models. This is generally presented as a solution to the slow convergence of machine learning models for the nuisance parameters Chernozhukov et al. [2018]. However, we observe rather a slightly slower convergence, probably due to the smaller sample size.
<figure><img src="image_11.png" /><figcaption>**Figure S2: Exploration of an adequate number of bootstrap samples for uncertainty quantification**
We show the value of the bounds of the 95%-percentile confidence interval for different numbers of bootstrap samples. The bold curves represent the average over the 26 individual estimators, and the thin lines are the results for each estimator. Each panel represents a different simulation configuration: **a** 500 observations, with a one-dimensional continuous mediator, in the setting of a low mediated proportion without overlap violation, and a misspecification of the outcome model; **b** 500 observations, with a one-dimensional continuous mediator, in the setting of a high mediated proportion with overlap violation, and a misspecification of both the outcome and the mediator models; **c** 1,000 observations, with a five-dimensional continuous mediator, in the setting of a low mediated proportion without overlap violation, and a misspecification of the outcome model; **d** 1,000 observations, with a binary mediator, in the setting of a high mediated proportion with overlap violation, and a misspecification of the mediator model. This experiment shows that most estimators have reached a stable point with 100 bootstrap samples.</figcaption></figure>
<figure><img src="image_12.png" /><figcaption>Figure S3: **Total and natural direct and indirect effects obtained with unregularized estimators for all mediator types.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. Each dot represents the average relative error (i.e. $\frac{\hat{\tau}-\tau}{\tau}$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the *high mediated proportion without overlap violation* framework with $n = 1,000$ observations. The multiply-robust estimator only handles binary one-dimensional mediators, and has no results for the second and third rows. The total effect is generally well estimated in all situations, but not the direct and indirect effects. The indirect and direct effects have different value, leading to a lack of symmetry in their relative error values, even if their absolute values are equal, leading to no error for the total effect estimation. Model misspecifications lead to estimation errors for most estimators, especially when the outcome model is misspecified.</figcaption></figure>
<figure><img src="image_13.png" /></figure>

<figure><img src="image_14.png" /><figcaption>Figure S4: 95%-confidence-interval coverage for the total and natural direct and indirect effects obtained with unregularized estimators for all mediator types. We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. Each dot represents the average coverage obtained with 100 bootstrap samples, for example for the total effect τ) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the *high mediated proportion without overlap violation* framework with *n* = 1,000 observations.</figcaption></figure>
<figure><img src="image_15.png" /><figcaption>Figure S5: 95%-confidence-interval width for the total and natural direct and indirect effects obtained with unregularized estimators for all mediator types. We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. Each dot represents the average interval width obtained with 100 bootstrap samples, for example for the total effect τ) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the *high mediated proportion without overlap violation* framework with *n* = 1,000 observations.</figcaption></figure>
<figure><img src="image_16.png" /><figcaption>Figure S6: **Indirect absolute effect for different simulation frameworks.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The three sets of dots in each panel correspond to the three simulation frameworks, in that order: "low mediated proportion without overlap violation", "high mediated proportion without overlap violation" and "high mediated proportion with strong overlap violation". "MP" stands for "mediated proportion" and "OV" for "overlap violation". Each dot represents the average relative error (i.e. $(\hat{\tau} - \tau)/\tau$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the case where $n = 1,000$ observations. The multiply-robust estimator only handles binary one-dimensional mediators, and has no results for the second and third rows. The estimation error for most estimators is greater when there is a violation of the overlap assumption, including in robust estimators. The absolute value of the indirect effect in the "low mediated proportion without overlap violation" is often very low, leading to very high relative errors compared to other settings. We found however that the representation of the relative error in Figure 4 is informative. We represent here the same results as Figure 4 with the absolute error (and not relative).</figcaption></figure>
<figure><img src="image_17.png" /><figcaption>Figure S7: Coverage for the indirect absolute effect for different simulation frameworks. We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The three sets of dots in each panel correspond to the three simulation frameworks, in that order: "low mediated proportion without overlap violation", "high mediated proportion without overlap violation" and "high mediated proportion with strong overlap violation". "MP" stands for "mediated proportion" and "OV" for "overlap violation". Each dot represents the average coverage over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the case where $n = 1,000$ observations. The multiply-robust estimator only handles binary one-dimensional mediators, and has no results for the second and third rows.</figcaption></figure>
<figure><img src="image_18.png" /><figcaption>**Figure S8: Confidence interval width for the indirect absolute effect for different simulation frameworks.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The three sets of dots in each panel correspond to the three simulation frameworks, in that order: "low mediated proportion without overlap violation", "high mediated proportion without overlap violation" and "high mediated proportion with strong overlap violation". "MP" stands for "mediated proportion" and "OV" for "overlap violation". Each dot represents the average interval width over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the case where *n* = 1,000 observations. The multiply-robust estimator only handles binary one-dimensional mediators, and has no results for the second and third rows.</figcaption></figure>
<figure><img src="image_19.png" /><figcaption>Figure S9: **Indirect effect relative error with regularized and unregularized linear models for plug-in nuisance parameters estimation.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The four sets of dots in each panel correspond to the different number of observations tested in our set of simulations. Each dot represents the average relative error (i.e. $(\hat{\tau}-\tau)/\tau$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the "high mediated proportion without overlap violation" framework. We focus on four estimators that were re-implemented in Python for this study, and assess the impact of using regularized models for the nuisance functions. In all simulated cases, it appears preferable to use unregularized models.</figcaption></figure>
<figure><img src="image_20.png" /><figcaption>Figure S10: **Indirect effect relative error with random forests for plug-in nuisance parameters estimation.** We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The three sets of dots in each panel correspond to the different number of observations tested in our set of simulations. Each dot represents the average relative error (i.e. $(\hat{\tau} - \tau)/\tau$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the "high mediated proportion without overlap violation" framework.</figcaption></figure>
<figure><img src="image_21.png" /><figcaption>Figure S11: Indirect effect relative error with linear models with and without cross-fitting for plug-in nuisance parameters estimation. We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The four sets of dots in each panel correspond to the different number of observations tested in our set of simulations. Each dot represents the average relative error (i.e. $\hat{\tau} - \tau/\tau$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the "high mediated proportion without overlap violation" framework.</figcaption></figure>
<figure><img src="image_22.png" /><figcaption>Figure S12: Indirect effect relative error with random forests models with and without cross-fitting for plug-in nuisance parameters estimation. We show results for four scenarios of generative model specification, violating or not the parametric linear nuisance models of some estimators. Each column corresponds to a distinct specification of simulated models. The rows correspond to different mediator types, labeled on the right. The four sets of dots in each panel correspond to the different number of observations tested in our set of simulations. Each dot represents the average relative error (i.e. $(\hat{\tau}-\tau)/\tau$, for example for the total effect $\tau$) over 200 repetitions, and the error bars are the asymptotic normal 95% confidence intervals from the distribution over the 200 repetitions. All simulations are in the "high mediated proportion without overlap violation" framework.</figcaption></figure>
<figure><img src="image_23.png" /><figcaption>Figure S13: Explained variance of PCA components of sMRI and dMRI IDPs (Image Derived Phenotypes). This barplot shows the percentage of the dataset variation that is explained by each component of a PCA applied to the 311 retained IDPs variables from the raw brain MRI data. We retained 6 components after visual inspection.</figcaption></figure>
<table><caption>Table S3: **Description of considered exposures.** This table describes how several fields from the raw UKBB data are combined together to define binary exposures.</caption><thead><tr><th>exposure</th><th>UBKK fields</th><th>aggregation rationale</th></tr></thead><tbody><tr><td>college or university degree</td><td>6138 (Qualifications)</td><td>equal to 'College or University degree'</td></tr><tr><td>diabetic</td><td>fields 20002 (Non-cancer illness code, self-reported) and 6177 (Medication for cholesterol, blood pressure or diabetes) and 6153 (Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones) at the imaging visit</td><td>self-declared diabetes or medication for diabetes, inspired from Newby and Garfield [2022]</td></tr><tr><td>hypercholesterol</td><td>fields 20002 (Non-cancer illness code, self-reported) and 6177 (Medication for cholesterol, blood pressure or diabetes) and 6153 (Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones) at the imaging visit</td><td>self-declared hypercholesterol or medication for hypercholesterol, inspired from Newby and Garfield [2022]</td></tr><tr><td>hypertension</td><td>fields 20002 (Non-cancer illness code, self-reported) and 6177 (Medication for cholesterol, blood pressure or diabetes) and 6153 (Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones) or 6150 (Vascular/heart problems diagnosed by doctor) at the imaging visit</td><td>self-declared hypertension or medication for hypertension, or diagnosed by a medical doctor, inspired from Newby and Garfield [2022]</td></tr><tr><td>Current MDD (Major depressive disorder)</td><td>fields 2050 (Frequency of depressed mood in last 2 weeks), 2060 (Frequency of unenthusiasm disinterest in last 2 weeks), 4526 (Happiness), 1930 (Miserableness), 1960 (Fed-up feelings), 1170 (Getting up in morning), 1200 (Sleeplessness insomnia), 2070 (Frequency of tenseness restlessness in last 2 weeks), 2080 (Frequency of tiredness lethargy in last 2 weeks), 1940 (Irritability), 1950 (Sensitivity hurt feelings), 2020 (Loneliness, isolation), 2030 (Guilty feelings) at the imaging visit</td><td>combination criterion inspired from Stolicyn et al. [2020]</td></tr><tr><td>Lifetime MDD</td><td>fields 20441 (Ever had prolonged loss of interest in normal activities), 20446 (Ever had prolonged feelings of sadness or depression), 20532 (Did your sleep change?), 20435 (Difficulty concentrating during worst depression), 20449 (Feelings of tiredness during worst episode of depression), 20450 (Feelings of worthlessness during worst period of depression), 20437 (Thoughts of death during worst depression), 20536 (Weight change during worst episode of depression), 20436 (Fraction of day affected during worst episode of depression), 20439 (Frequency of depressed days during worst episode of depression), 20440 (Impact on normal roles during worst period of depression) at the initial assessment</td><td>combination criterion inspired from Stolicyn et al. [2020]</td></tr><tr><td>social support</td><td>field 2110 (Able to confide) at the imaging visit</td><td>threshold similar to Schurz et al. [2021]</td></tr><tr><td>inflammation</td><td>field 30710 (C-reactive protein) at the initial visit</td><td>Based on the expected range, we took a cutoff of 3 mg/L as a marker of potential chronic inflammation [Pepys et al., 2003, Pearson et al., 2003].</td></tr><tr><td>current smoking</td><td>fields 1239 (Current tobacco smoking) and 1249 (Past tobacco smoking) at imaging visit</td><td>self declaration</td></tr><tr><td>alcohol consumption</td><td>fields 1568 (Average weekly red wine intake), 1578 (Average weekly champagne plus white wine intake), 1588 (Average weekly beer plus cider intake), 1598 (Average weekly spirits intake), 1608 (Average weekly fortified wine intake), 5364 (Average weekly intake of other alcoholic drinks) at imaging visit</td><td>the different alcoholic drinks were converted to standard units as done in the work of Topiwala et al. [2022]. We set a cutoff at the recommended level by the National Health Service (NHS) of less than 14 units per week.</td></tr><tr><td>obesity</td><td>21001 (Body mass index BMI) at imaging visit</td><td>the standard cutoff of the BMI, that is greater than 30 kg/m² was used.</td></tr></tbody></table>
<table><caption>Table S4: Baseline characteristics of for the included participants, according to their higher education degree. Adequate statistical tests depending on the variable type assess whether each variable has a distinct distributions between the "exposed" and the "unexposed" group (with exposure being graduating a College or University degree). We also report the Standardized mean difference (SMD) for each variable.</caption><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No College or University degree</th><th>College or University degree</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="15">Sample size<br>Outcome<br>Mediators</td><td>n</td><td></td><td>32498</td><td>16295</td><td>16203</td><td></td><td></td><td></td></tr><tr><td>G factor, mean (SD)</td><td></td><td>-0.0 (1.1)</td><td>0.2 (1.2)</td><td>-0.3 (1.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.470</td></tr><tr><td>Dmri pc 0, mean (SD)</td><td></td><td>-0.3 (10.2)</td><td>0.1 (10.3)</td><td>-0.7 (10.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.085</td></tr><tr><td>Dmri pc 1, mean (SD)</td><td></td><td>0.1 (5.2)</td><td>0.3 (5.2)</td><td>-0.2 (5.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.091</td></tr><tr><td>Dmri pc 2, mean (SD)</td><td></td><td>-0.1 (5.0)</td><td>0.2 (5.1)</td><td>-0.4 (4.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.111</td></tr><tr><td>Dmri pc 3, mean (SD)</td><td></td><td>0.0 (4.4)</td><td>0.2 (4.4)</td><td>-0.2 (4.4)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.096</td></tr><tr><td>Dmri pc 4, mean (SD)</td><td></td><td>0.0 (4.2)</td><td>0.0 (4.3)</td><td>0.0 (4.1)</td><td>0.880</td><td>Two Sample T-test</td><td>0.002</td></tr><tr><td>Dmri pc 5, mean (SD)</td><td></td><td>0.0 (3.4)</td><td>-0.1 (3.5)</td><td>0.1 (3.4)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.081</td></tr><tr><td>Smri dmri pc 0, mean (SD)</td><td></td><td>-0.4 (10.5)</td><td>0.3 (10.6)</td><td>-1.0 (10.4)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.120</td></tr><tr><td>Smri dmri pc 1, mean (SD)</td><td></td><td>-0.2 (7.4)</td><td>0.6 (7.4)</td><td>-0.9 (7.3)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.203</td></tr><tr><td>Smri dmri pc 2, mean (SD)</td><td></td><td>0.1 (5.6)</td><td>0.2 (5.5)</td><td>0.1 (5.6)</td><td>0.015</td><td>Two Sample T-test</td><td>-0.027</td></tr><tr><td>Smri dmri pc 3, mean (SD)</td><td></td><td>-0.0 (4.7)</td><td>0.1 (4.8)</td><td>-0.1 (4.6)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.060</td></tr><tr><td>Smri dmri pc 4, mean (SD)</td><td></td><td>-0.0 (4.3)</td><td>0.3 (4.3)</td><td>-0.3 (4.3)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.132</td></tr><tr><td>Smri dmri pc 5, mean (SD)</td><td></td><td>0.0 (4.3)</td><td>-0.0 (4.4)</td><td>0.1 (4.2)</td><td>0.036</td><td>Two Sample T-test</td><td>0.023</td></tr><tr><td>Smri pc 0, mean (SD)</td><td></td><td>0.3 (7.2)</td><td>-0.5 (7.2)</td><td>1.1 (7.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.227</td></tr><tr><td>Smri pc 1, mean (SD)</td><td></td><td>-0.0 (3.3)</td><td>0.1 (3.4)</td><td>-0.1 (3.3)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.055</td></tr><tr><td>Smri pc 2, mean (SD)</td><td></td><td>-0.1 (2.8)</td><td>-0.2 (2.8)</td><td>0.0 (2.8)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.063</td></tr><tr><td>Smri pc 3, mean (SD)</td><td></td><td>0.0 (2.1)</td><td>0.0 (2.0)</td><td>-0.0 (2.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.045</td></tr><tr><td rowspan="15">Confounders (alphabetic order)</td><td>Adopted as a child - visit 0, n (%)</td><td>No</td><td>32469 (99.9)</td><td>16274 (99.9)</td><td>16195 (100.0)</td><td>0.052</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.027</td></tr><tr><td>Yes</td><td></td><td>9 (0.0)</td><td>7 (0.0)</td><td>2 (0.0)</td><td></td><td></td><td></td></tr><tr><td>other</td><td></td><td>20 (0.1)</td><td>14 (0.1)</td><td>6 (0.0)</td><td></td><td></td><td></td></tr><tr><td>Age when attended assessment centre - visit 2, mean (SD)</td><td></td><td>63.7 (7.6)</td><td>64.1 (7.6)</td><td>63.3 (7.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.107</td></tr><tr><td>Alcohol above nhs reco, n (%)</td><td>0</td><td>21256 (65.4)</td><td>10746 (65.9)</td><td>10510 (64.9)</td><td>0.041</td><td>Chi-squared</td><td>0.023</td></tr><tr><td rowspan="5">Alcohol intake frequency. - visit 2, n (%)</td><td>1</td><td>11242 (34.6)</td><td>5549 (34.1)</td><td>5693 (35.1)</td><td></td><td></td><td></td></tr><tr><td>Daily or almost daily</td><td>5540 (17.0)</td><td>2454 (15.1)</td><td>3086 (19.0)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.189</td></tr><tr><td>Never</td><td>2032 (6.3)</td><td>1104 (6.8)</td><td>928 (5.7)</td><td></td><td></td><td></td></tr><tr><td>Once or twice a week</td><td>8640 (26.6)</td><td>4628 (28.4)</td><td>4012 (24.8)</td><td></td><td></td><td></td></tr><tr><td>One to three times a month</td><td>3788 (11.7)</td><td>2054 (12.6)</td><td>1734 (10.7)</td><td></td><td></td><td></td></tr><tr><td rowspan="4">Average total household income before tax - visit 2, n (%)</td><td>Special occasions only</td><td>3262 (10.0)</td><td>1845 (11.3)</td><td>1417 (8.7)</td><td></td><td></td><td></td></tr><tr><td>Three or four times a week</td><td>9236 (28.4)</td><td>4210 (25.8)</td><td>5026 (31.0)</td><td></td><td></td><td></td></tr><tr><td>18,000 to 30,999</td><td>7813 (24.0)</td><td>4630 (28.4)</td><td>3183 (19.6)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.544</td></tr><tr><td>31,000 to 51,999</td><td>9156 (28.2)</td><td>4302 (26.4)</td><td>4854 (30.0)</td><td></td><td></td><td></td></tr><tr><td rowspan="5">Body mass index (bmi) - visit 2, mean (SD)</td><td>52,000 to 100,000</td><td>7028 (21.6)</td><td>2615 (16.0)</td><td>4413 (27.2)</td><td></td><td></td><td></td></tr><tr><td>Do not know</td><td>961 (3.0)</td><td>653 (4.0)</td><td>308 (1.9)</td><td></td><td></td><td></td></tr><tr><td>Greater than 100,000</td><td>2277 (7.0)</td><td>519 (3.2)</td><td>1758 (10.8)</td><td></td><td></td><td></td></tr><tr><td>Less than 18,000</td><td>3402 (10.5)</td><td>2325 (14.3)</td><td>1077 (6.6)</td><td></td><td></td><td></td></tr><tr><td>Prefer not to answer</td><td>1861 (5.7)</td><td>1251 (7.7)</td><td>610 (3.8)</td><td></td><td></td><td></td></tr><tr><td>Breastfed as a baby - visit 0, n (%)</td><td>Do not know</td><td>6175 (19.0)</td><td>3492 (21.4)</td><td>2683 (16.6)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.135</td></tr><tr><td rowspan="3">Cmdd final, n (%)</td><td>No</td><td>7174 (22.1)</td><td>3660 (22.5)</td><td>3514 (21.7)</td><td></td><td></td><td></td></tr><tr><td>Yes</td><td>19136 (58.9)</td><td>9137 (56.1)</td><td>9999 (61.7)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>13 (0.0)</td><td>6 (0.0)</td><td>7 (0.0)</td><td></td><td></td><td></td></tr><tr><td rowspan="3">Comparative body size at age 10 - visit 0, n (%)</td><td>False</td><td>23413 (72.0)</td><td>11540 (70.8)</td><td>11873 (73.3)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.055</td></tr><tr><td>True</td><td>9085 (28.0)</td><td>4755 (29.2)</td><td>4330 (26.7)</td><td></td><td></td><td></td></tr><tr><td>About average</td><td>16637 (51.2)</td><td>8379 (51.4)</td><td>8258 (51.0)</td><td>0.013</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.039</td></tr><tr><td rowspan="4">Comparative height size at age 10 - visit 0, n (%)</td><td>Do not know</td><td>347 (1.1)</td><td>203 (1.2)</td><td>144 (0.9)</td><td></td><td></td><td></td></tr><tr><td>Plumper</td><td>4922 (15.1)</td><td>2412 (14.8)</td><td>2510 (15.5)</td><td></td><td></td><td></td></tr><tr><td>Thinner</td><td>10584 (32.6)</td><td>5297 (32.5)</td><td>5287 (32.6)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>8 (0.0)</td><td>4 (0.0)</td><td>4 (0.0)</td><td></td><td></td><td></td></tr><tr><td></td><td>About average</td><td>17039 (52.4)</td><td>8958 (55.0)</td><td>8081 (49.9)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.128</td></tr></tbody></table>
...continued

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No College or University degree</th><th>College or University degree</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="10">Country of birth (uk/elsewhere) - visit 0, n (%)</td><td>Do not know</td><td>Do not know</td><td>293 (0.9)</td><td>177 (1.1)</td><td>116 (0.7)</td><td rowspan="10">&lt;0.001</td><td rowspan="10">Chi-squared</td><td rowspan="10">0.252</td></tr><tr><td>Shorter</td><td>Shorter</td><td>6569 (20.2)</td><td>3259 (20.0)</td><td>3310 (20.4)</td></tr><tr><td>Taller</td><td>Taller</td><td>8589 (26.4)</td><td>3897 (23.9)</td><td>4692 (29.0)</td></tr><tr><td>other</td><td>other</td><td>8 (0.0)</td><td>4 (0.0)</td><td>4 (0.0)</td></tr><tr><td>Elsewhere</td><td>Elsewhere</td><td>1778 (5.5)</td><td>560 (3.4)</td><td>1218 (7.5)</td></tr><tr><td>England</td><td>England</td><td>27360 (84.2)</td><td>14431 (88.6)</td><td>12929 (79.8)</td></tr><tr><td>Northern Ireland</td><td>Northern Ireland</td><td>234 (0.7)</td><td>78 (0.5)</td><td>156 (1.0)</td></tr><tr><td>Republic of Ireland</td><td>Republic of Ireland</td><td>217 (0.7)</td><td>103 (0.6)</td><td>114 (0.7)</td></tr><tr><td>Scotland</td><td>Scotland</td><td>2296 (7.1)</td><td>882 (5.4)</td><td>1414 (8.7)</td></tr><tr><td>Wales</td><td>Wales</td><td>600 (1.8)</td><td>232 (1.4)</td><td>368 (2.3)</td></tr><tr><td>other</td><td>other</td><td>13 (0.0)</td><td>9 (0.1)</td><td>4 (0.0)</td></tr><tr><td rowspan="2">Current employment status - visit 2, n (%)</td><td>In paid employment or self-employed</td><td>In paid employment or self-employed</td><td>12978 (39.9)</td><td>6175 (37.9)</td><td>6803 (42.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.084</td></tr><tr><td>Retired</td><td>Retired</td><td>18302 (56.3)</td><td>9505 (58.3)</td><td>8797 (54.3)</td></tr><tr><td>Current smoker, n (%)</td><td>other</td><td>1218 (3.7)</td><td>615 (3.8)</td><td>603 (3.7)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.064</td></tr><tr><td rowspan="2">Current tobacco smoking - visit 2, n (%)</td><td>0</td><td>31893 (98.1)</td><td>15921 (97.7)</td><td>15972 (98.6)</td></tr><tr><td>1</td><td>605 (1.9)</td><td>374 (2.3)</td><td>231 (1.4)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.065</td></tr><tr><td rowspan="2">Diabetic, n (%)</td><td>No</td><td>31431 (96.7)</td><td>15696 (96.3)</td><td>15735 (97.1)</td></tr><tr><td>Yes, on most or all days other</td><td>other</td><td>605 (1.9)</td><td>374 (2.3)</td><td>231 (1.4)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.071</td></tr><tr><td rowspan="2">Ethnic background - visit 2, n (%)</td><td>0</td><td>31154 (95.9)</td><td>15507 (95.2)</td><td>15647 (96.6)</td></tr><tr><td>1</td><td>1344 (4.1)</td><td>788 (4.8)</td><td>556 (3.4)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.102</td></tr><tr><td rowspan="2">Ever smoked - visit 2, n (%)</td><td>British</td><td>7408 (22.8)</td><td>4061 (24.9)</td><td>3347 (20.7)</td></tr><tr><td>other</td><td>other</td><td>25090 (77.2)</td><td>12234 (75.1)</td><td>12856 (79.3)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.076</td></tr><tr><td rowspan="2">Handedness (chirality/laterality) - visit 0, n (%)</td><td>No</td><td>15217 (46.8)</td><td>7452 (45.7)</td><td>7765 (47.9)</td></tr><tr><td>Yes</td><td>Yes</td><td>17196 (52.9)</td><td>8774 (53.8)</td><td>8422 (52.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.014</td></tr><tr><td rowspan="2">Right-handed</td><td>other</td><td>85 (0.3)</td><td>69 (0.4)</td><td>16 (0.1)</td></tr><tr><td>Use both right and left hands equally</td><td>equally</td><td>486 (1.5)</td><td>235 (1.4)</td><td>251 (1.5)</td><td rowspan="2">0.663</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.014</td></tr><tr><td>Hypercholesterol, n (%)</td><td>other</td><td>12 (0.0)</td><td>6 (0.0)</td><td>6 (0.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.115</td></tr><tr><td rowspan="2">Hypertensive, n (%)</td><td>0</td><td>24538 (75.5)</td><td>11902 (73.0)</td><td>12636 (78.0)</td></tr><tr><td>1</td><td>7960 (24.5)</td><td>4393 (27.0)</td><td>3567 (22.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.120</td></tr><tr><td rowspan="2">Inflammation, n (%)</td><td>0</td><td>23962 (73.7)</td><td>11586 (71.1)</td><td>12376 (76.4)</td></tr><tr><td>1</td><td>8536 (26.3)</td><td>4709 (28.9)</td><td>3827 (23.6)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.119</td></tr><tr><td rowspan="4">Job involves shift work - visit 2, n (%)</td><td>False</td><td>27267 (83.9)</td><td>13316 (81.7)</td><td>13951 (86.1)</td></tr><tr><td>True</td><td>5231 (16.1)</td><td>2979 (18.3)</td><td>2252 (13.9)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.213</td></tr><tr><td>Always</td><td>795 (2.4)</td><td>596 (3.7)</td><td>199 (1.2)</td></tr><tr><td>Never/rarely</td><td>11077 (34.1)</td><td>4947 (30.4)</td><td>6130 (37.8)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.213</td></tr><tr><td rowspan="2">Length of time at current address - visit 2, mean (SD)</td><td>Sometimes</td><td>855 (2.6)</td><td>470 (2.9)</td><td>385 (2.4)</td></tr><tr><td>other</td><td>19771 (60.8)</td><td>10282 (63.1)</td><td>9489 (58.6)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.107</td></tr><tr><td>Life long depression, n (%)</td><td>other</td><td>21.0 (13.9)</td><td>21.7 (14.5)</td><td>20.3 (13.2)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.052</td></tr><tr><td rowspan="2">Ls pc dim.1, mean (SD)</td><td>False</td><td>27461 (84.5)</td><td>13923 (85.4)</td><td>13538 (83.6)</td></tr><tr><td>True</td><td>5037 (15.5)</td><td>2372 (14.6)</td><td>2665 (16.4)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.130</td></tr><tr><td rowspan="2">Ls pc dim.2, mean (SD)</td><td>0.6 (2.0)</td><td>0.5 (2.1)</td><td>0.7 (1.9)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.126</td></tr><tr><td>-0.4 (2.0)</td><td>-0.3 (2.1)</td><td>-0.6 (2.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.188</td></tr><tr><td rowspan="2">Maternal smoking around birth - visit 0, n (%)</td><td>Do not know</td><td>3388 (10.4)</td><td>1914 (11.7)</td><td>1474 (9.1)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.188</td></tr><tr><td>No</td><td>20344 (62.6)</td><td>9465 (58.1)</td><td>10879 (67.1)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.046</td></tr><tr><td rowspan="2">Mh pc dim.1, mean (SD)</td><td>Yes</td><td>8749 (26.9)</td><td>4905 (30.1)</td><td>3844 (23.7)</td></tr><tr><td>other</td><td>17 (0.1)</td><td>11 (0.1)</td><td>6 (0.0)</td><td rowspan="2">0.076</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.020</td></tr><tr><td>Mh pc dim.2, mean (SD)</td><td>0.5 (3.3)</td><td>0.4 (3.3)</td><td>0.5 (3.2)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.073</td></tr><tr><td>Number in household - visit 2, mean (SD)</td><td>2.2 (1.0)</td><td>2.1 (1.0)</td><td>2.2 (1.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.106</td></tr><tr><td>Number of full brothers - visit 2, mean (SD)</td><td>1.0 (1.1)</td><td>1.1 (1.2)</td><td>1.0 (1.1)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.111</td></tr><tr><td>Number of full sisters - visit 2, mean (SD)</td><td>1.0 (1.1)</td><td>1.0 (1.2)</td><td>0.9 (1.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.068</td></tr><tr><td>Number of vehicles in household - visit 2, n (%)</td><td>Four or more</td><td>922 (2.8)</td><td>514 (3.2)</td><td>408 (2.5)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.068</td></tr></tbody></table>
...continued

<table><caption>Table S5: Baseline characteristics of for the included participants, according to their higher diabetes status. Adequate statistical tests depending on the variable type assess whether each variable has a distinct distributions between the "exposed" and the "unexposed" group (with exposure being diagnosed with diabetes). We also report the Standardized mean difference (SMD) for each variable.</caption><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No College or University degree</th><th>College or University degree</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="15"></td><td rowspan="15">Obesity, n (%)<br>Part of a multiple birth - visit 0, n (%)<br>Past tobacco smoking - visit 2, n (%)<br>Scanner lateral (x) brain position - visit 2, mean (SD)<br>Scanner longitudinal (z) brain position - visit 2, mean (SD)<br>Scanner table position - visit 2, mean (SD)<br>Scanner transverse (y) brain position - visit 2, mean (SD)<br>Self declared mental exclusion visit 2, mean (SD)<br>Sex - visit 0, n (%)<br>Smoking status - visit 2, n (%)<br>Social support, n (%)<br>Total alcohol weekly units 2, mean (SD)<br>Townsend deprivation index at recruitment - visit 0, mean (SD)<br>Uk biobank assessment centre - visit 2, n (%)<br>Volumetric scaling from t1 head image to standard space - visit 2, mean (SD)</td><td>None</td><td>1265 (3.9)</td><td>592 (3.6)</td><td>673 (4.2)</td><td></td><td></td><td></td></tr><tr><td>One</td><td>13770 (42.4)</td><td>7061 (43.3)</td><td>6709 (41.4)</td><td></td><td></td><td></td></tr><tr><td>Three</td><td>3034 (9.3)</td><td>1552 (9.5)</td><td>1482 (9.1)</td><td></td><td></td><td></td></tr><tr><td>Two</td><td>13471 (41.5)</td><td>6557 (40.2)</td><td>6914 (42.7)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>36 (0.1)</td><td>19 (0.1)</td><td>17 (0.1)</td><td></td><td></td><td></td></tr><tr><td>0</td><td>26781 (82.4)</td><td>12931 (79.4)</td><td>13850 (85.5)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.161</td></tr><tr><td>1</td><td>5717 (17.6)</td><td>3364 (20.6)</td><td>2353 (14.5)</td><td></td><td></td><td></td></tr><tr><td>No</td><td>31809 (97.9)</td><td>15960 (97.9)</td><td>15849 (97.8)</td><td>0.208</td><td>Chi-squared</td><td>0.020</td></tr><tr><td>Yes</td><td>644 (2.0)</td><td>308 (1.9)</td><td>336 (2.1)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>45 (0.1)</td><td>27 (0.2)</td><td>18 (0.1)</td><td></td><td></td><td></td></tr><tr><td>I have never smoked</td><td>15218 (46.8)</td><td>7453 (45.7)</td><td>7765 (47.9)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.196</td></tr><tr><td>Just tried once or twice</td><td>5296 (16.3)</td><td>2270 (13.9)</td><td>3026 (18.7)</td><td></td><td></td><td></td></tr><tr><td>Smoked occasionally</td><td>4008 (12.3)</td><td>1980 (12.2)</td><td>2028 (12.5)</td><td></td><td></td><td></td></tr><tr><td>Smoked on most or all days</td><td>7287 (22.4)</td><td>4150 (25.5)</td><td>3137 (19.4)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>689 (2.1)</td><td>442 (2.7)</td><td>247 (1.5)</td><td></td><td></td><td></td></tr><tr><td></td><td>0.7 (3.0)</td><td>0.7 (3.0)</td><td>0.7 (3.0)</td><td>0.857</td><td>Two Sample T-test</td><td>0.002</td></tr><tr><td></td><td>-28.1 (26.8)</td><td>-28.0 (27.2)</td><td>-28.2 (26.3)</td><td>0.530</td><td>Two Sample T-test</td><td>-0.007</td></tr><tr><td></td><td>-1054.2 (25.1)</td><td>-1055.0 (25.6)</td><td>-1053.5 (24.6)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.058</td></tr><tr><td></td><td>66.4 (5.9)</td><td>66.3 (5.9)</td><td>66.5 (5.9)</td><td>0.001</td><td>Two Sample T-test</td><td>0.036</td></tr><tr><td></td><td>0.0 (0.2)</td><td>0.0 (0.2)</td><td>0.0 (0.2)</td><td>0.200</td><td>Two Sample T-test</td><td>-0.014</td></tr><tr><td rowspan="15"></td><td rowspan="15">Female</td><td>17195 (52.9)</td><td>8794 (54.0)</td><td>8401 (51.8)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.042</td></tr><tr><td>15303 (47.1)</td><td>7501 (46.0)</td><td>7802 (48.2)</td><td></td><td></td><td></td></tr><tr><td>1065 (3.3)</td><td>597 (3.7)</td><td>468 (2.9)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.154</td></tr><tr><td>20503 (63.1)</td><td>9718 (59.6)</td><td>10785 (66.6)</td><td></td><td></td><td></td></tr><tr><td>10846 (33.4)</td><td>5912 (36.3)</td><td>4934 (30.5)</td><td></td><td></td><td></td></tr><tr><td>84 (0.3)</td><td>68 (0.4)</td><td>16 (0.1)</td><td></td><td></td><td></td></tr><tr><td>12720 (39.1)</td><td>6616 (40.6)</td><td>6104 (37.7)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.060</td></tr><tr><td>19778 (60.9)</td><td>9679 (59.4)</td><td>10099 (62.3)</td><td></td><td></td><td></td></tr><tr><td>13.1 (14.4)</td><td>13.0 (14.9)</td><td>13.2 (13.9)</td><td>0.395</td><td>Two Sample T-test</td><td>0.009</td></tr><tr><td>-1.9 (2.7)</td><td>-1.9 (2.7)</td><td>-1.9 (2.7)</td><td>0.631</td><td>Two Sample T-test</td><td>-0.005</td></tr><tr><td>18991 (58.4)</td><td>10010 (61.4)</td><td>8981 (55.4)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.179</td></tr><tr><td>8436 (26.0)</td><td>4251 (26.1)</td><td>4185 (25.8)</td><td></td><td></td><td></td></tr><tr><td>5028 (15.5)</td><td>2010 (12.3)</td><td>3018 (18.6)</td><td></td><td></td><td></td></tr><tr><td>43 (0.1)</td><td>24 (0.1)</td><td>19 (0.1)</td><td></td><td></td><td></td></tr><tr><td>1.3 (0.1)</td><td>1.3 (0.1)</td><td>1.3 (0.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.219</td></tr><tr><td rowspan="15"></td><td rowspan="15">Male</td><td>31154</td><td>1344</td><td>1344</td><td></td><td></td><td></td></tr><tr><td>-0.0 (1.1)</td><td>-0.0 (1.1)</td><td>0.2 (1.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.202</td></tr><tr><td>-0.3 (10.2)</td><td>-0.4 (10.1)</td><td>3.4 (11.7)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.356</td></tr><tr><td>0.1 (5.2)</td><td>0.1 (5.2)</td><td>-1.2 (6.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.231</td></tr><tr><td>-0.1 (5.0)</td><td>-0.2 (4.8)</td><td>1.9 (7.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.330</td></tr><tr><td>0.0 (4.4)</td><td>-0.0 (4.4)</td><td>0.6 (4.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.139</td></tr><tr><td>0.0 (4.2)</td><td>0.0 (4.2)</td><td>0.4 (4.6)</td><td>0.001</td><td>Two Sample T-test</td><td>0.098</td></tr><tr><td>0.0 (3.4)</td><td>0.0 (3.4)</td><td>-0.4 (3.8)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.110</td></tr><tr><td>-0.4 (10.5)</td><td>-0.5 (10.4)</td><td>4.0 (12.0)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.402</td></tr><tr><td>-0.2 (7.4)</td><td>-0.2 (7.4)</td><td>0.6 (8.0)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.111</td></tr><tr><td>0.1 (5.6)</td><td>0.2 (5.5)</td><td>-2.2 (5.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.423</td></tr></tbody></table>

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No diabetes</th><th>Diabetes</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="15">Sample size<br>Outcome<br>Mediators</td><td rowspan="15">n</td><td>G factor, mean (SD)</td><td>32498</td><td>31154</td><td>1344</td><td></td><td></td><td></td></tr><tr><td>Dmri pc 0, mean (SD)</td><td>-0.0 (1.1)</td><td>-0.0 (1.1)</td><td>0.2 (1.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.202</td></tr><tr><td>Dmri pc 1, mean (SD)</td><td>-0.3 (10.2)</td><td>-0.4 (10.1)</td><td>3.4 (11.7)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.356</td></tr><tr><td>Dmri pc 2, mean (SD)</td><td>0.1 (5.2)</td><td>0.1 (5.2)</td><td>-1.2 (6.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.231</td></tr><tr><td>Dmri pc 3, mean (SD)</td><td>-0.1 (5.0)</td><td>-0.2 (4.8)</td><td>1.9 (7.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.330</td></tr><tr><td>Dmri pc 4, mean (SD)</td><td>0.0 (4.4)</td><td>-0.0 (4.4)</td><td>0.6 (4.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.139</td></tr><tr><td>Dmri pc 5, mean (SD)</td><td>0.0 (4.2)</td><td>0.0 (4.2)</td><td>0.4 (4.6)</td><td>0.001</td><td>Two Sample T-test</td><td>0.098</td></tr><tr><td>Smri dmri pc 0, mean (SD)</td><td>0.0 (3.4)</td><td>0.0 (3.4)</td><td>-0.4 (3.8)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.110</td></tr><tr><td>Smri dmri pc 1, mean (SD)</td><td>-0.4 (10.5)</td><td>-0.5 (10.4)</td><td>4.0 (12.0)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.402</td></tr><tr><td>Smri dmri pc 2, mean (SD)</td><td>-0.2 (7.4)</td><td>-0.2 (7.4)</td><td>0.6 (8.0)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.111</td></tr><tr><td></td><td>0.1 (5.6)</td><td>0.2 (5.5)</td><td>-2.2 (5.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.423</td></tr></tbody></table>
...continued

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No diabetes</th><th>Diabetes</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="12">Confounders (alphabetic order)</td><td>Smri dmri pc 3, mean (SD)</td><td rowspan="12">No</td><td>-0.0 (4.7)</td><td>-0.0 (4.5)</td><td>0.9 (7.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.139</td></tr><tr><td>Smri dmri pc 4, mean (SD)</td><td>-0.0 (4.3)</td><td>-0.1 (4.3)</td><td>0.8 (4.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.196</td></tr><tr><td>Smri dmri pc 5, mean (SD)</td><td>0.0 (4.3)</td><td>0.0 (4.3)</td><td>0.4 (4.5)</td><td>0.001</td><td>Two Sample T-test</td><td>0.094</td></tr><tr><td>Smri pc 0, mean (SD)</td><td>0.3 (7.2)</td><td>0.3 (7.1)</td><td>-1.5 (7.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.260</td></tr><tr><td>Smri pc 1, mean (SD)</td><td>-0.0 (3.3)</td><td>-0.1 (3.3)</td><td>1.6 (3.6)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.480</td></tr><tr><td>Smri pc 2, mean (SD)</td><td>-0.1 (2.8)</td><td>-0.1 (2.8)</td><td>0.9 (3.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.340</td></tr><tr><td>Smri pc 3, mean (SD)</td><td>0.0 (2.1)</td><td>-0.0 (2.1)</td><td>0.2 (2.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.109</td></tr><tr><td>Adopted as a child - visit 0, n (%)</td><td>32469 (99.9)</td><td>31126 (99.9)</td><td>1343 (99.9)</td><td>0.374</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>nan</td></tr><tr><td>Yes<br/>other</td><td>9 (0.0)<br/>20 (0.1)<br/>63.7 (7.6)</td><td>8 (0.0)<br/>20 (0.1)<br/>63.6 (7.6)</td><td>1 (0.1)<br/>65.6 (7.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.274</td></tr><tr><td>Age when attended assessment centre - visit 2, mean (SD)</td><td>0<br/>1</td><td>21256 (65.4)<br/>11242 (34.6)</td><td>20335 (65.3)<br/>10819 (34.7)</td><td>921 (68.5)<br/>423 (31.5)</td><td>0.015</td><td>Chi-squared</td><td>0.069</td></tr><tr><td>Alcohol above nhs reco, n (%)</td><td>0<br/>1</td><td>5540 (17.0)<br/>2032 (6.3)</td><td>5340 (17.1)<br/>1901 (6.1)</td><td>200 (14.9)<br/>131 (9.7)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.282</td></tr><tr><td>Alcohol intake frequency. - visit 2, n (%)</td><td>Daily or almost daily<br/>Never<br/>Once or twice a week<br/>One to three times a month<br/>Special occasions only<br/>Three or four times a week</td><td>8640 (26.6)<br/>3788 (11.7)<br/>3262 (10.0)<br/>9236 (28.4)<br/>18,000 to 30,999</td><td>8293 (26.6)<br/>3604 (11.6)<br/>3054 (9.8)<br/>8962 (28.8)<br/>7813 (24.0)</td><td>347 (25.8)<br/>184 (13.7)<br/>208 (15.5)<br/>274 (20.4)<br/>380 (28.3)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.226</td></tr><tr><td>Average total household income before tax - visit 2, n (%)</td><td>31,000 to 51,999<br/>52,000 to 100,000<br/>Do not know<br/>Greater than 100,000<br/>Less than 18,000<br/>Prefer not to answer</td><td>9156 (28.2)<br/>7028 (21.6)<br/>961 (3.0)<br/>2277 (7.0)<br/>3402 (10.5)<br/>1861 (5.7)<br/>26.4 (4.3)</td><td>8798 (28.2)<br/>6800 (21.8)<br/>910 (2.9)<br/>2218 (7.1)<br/>3207 (10.3)<br/>1788 (5.7)<br/>26.3 (4.2)</td><td>358 (26.6)<br/>228 (17.0)<br/>51 (3.8)<br/>59 (4.4)<br/>195 (14.5)<br/>73 (5.4)<br/>29.6 (5.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.711</td></tr><tr><td>Body mass index (bmi) - visit 2, mean (SD)</td><td>Do not know</td><td>6175 (19.0)</td><td>5882 (18.9)</td><td>293 (21.8)</td><td>0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>nan</td></tr><tr><td>Breastfed as a baby - visit 0, n (%)</td><td>Do not know</td><td>7174 (22.1)<br/>19136 (58.9)<br/>13 (0.0)</td><td>6930 (22.2)<br/>18329 (58.8)<br/>13 (0.0)</td><td>244 (18.2)<br/>807 (60.0)</td><td></td><td></td><td></td></tr><tr><td>Cmdd final, n (%)</td><td>No<br/>Yes<br/>other<br/>False<br/>True</td><td>23413 (72.0)<br/>9085 (28.0)<br/>16637 (51.2)</td><td>22509 (72.3)<br/>8645 (27.7)<br/>16059 (51.5)</td><td>904 (67.3)<br/>440 (32.7)<br/>578 (43.0)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.109</td></tr><tr><td>Comparative body size at age 10 - visit 0, n (%)</td><td>About average</td><td>347 (1.1)<br/>4922 (15.1)<br/>10584 (32.6)<br/>8 (0.0)</td><td>323 (1.0)<br/>4639 (14.9)<br/>10125 (32.5)<br/>8 (0.0)</td><td>24 (1.8)<br/>283 (21.1)<br/>459 (34.2)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>nan</td></tr><tr><td>Comparative height size at age 10 - visit 0, n (%)</td><td>About average</td><td>17039 (52.4)</td><td>16339 (52.4)</td><td>700 (52.1)</td><td>0.481</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>nan</td></tr><tr><td rowspan="5">Country of birth (uk/elsewhere) - visit 0, n (%)</td><td>Do not know</td><td>293 (0.9)</td><td>275 (0.9)</td><td>18 (1.3)</td><td></td><td></td><td></td></tr><tr><td>Shorter</td><td>6569 (20.2)</td><td>6302 (20.2)</td><td>267 (19.9)</td><td></td><td></td><td></td></tr><tr><td>Taller<br/>other</td><td>8589 (26.4)<br/>8 (0.0)</td><td>8230 (26.4)<br/>8 (0.0)</td><td>359 (26.7)</td><td></td><td></td><td></td></tr><tr><td>Elsewhere</td><td>1778 (5.5)</td><td>1671 (5.4)</td><td>107 (8.0)</td><td>0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.126</td></tr><tr><td>England<br/>Northern Ireland<br/>Republic of Ireland<br/>Scotland<br/>Wales<br/>other</td><td>27360 (84.2)<br/>234 (0.7)<br/>217 (0.7)<br/>2296 (7.1)<br/>600 (1.8)<br/>13 (0.0)</td><td>26251 (84.3)<br/>229 (0.7)<br/>212 (0.7)<br/>2208 (7.1)<br/>571 (1.8)<br/>12 (0.0)</td><td>1109 (82.5)<br/>5 (0.4)<br/>5 (0.4)<br/>88 (6.5)<br/>29 (2.2)<br/>1 (0.1)</td><td></td><td></td><td></td></tr></tbody></table>
...continued

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No diabetes</th><th>Diabetes</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="10"></td><td rowspan="10">Current employment status - visit 2, n (%)</td><td>In paid employment or self-employed</td><td>12978 (39.9)</td><td>12554 (40.3)</td><td>424 (31.5)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.184</td></tr><tr><td>Retired</td><td>18302 (56.3)</td><td>17445 (56.0)</td><td>857 (63.8)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>1218 (3.7)</td><td>1155 (3.7)</td><td>63 (4.7)</td><td></td><td></td><td></td></tr><tr><td>0</td><td>31893 (98.1)</td><td>30589 (98.2)</td><td>1304 (97.0)</td><td>0.003</td><td>Chi-squared</td><td>0.076</td></tr><tr><td>1</td><td>605 (1.9)</td><td>565 (1.8)</td><td>40 (3.0)</td><td></td><td></td><td></td></tr><tr><td>No</td><td>31431 (96.7)</td><td>30145 (96.8)</td><td>1286 (95.7)</td><td>0.008</td><td>Chi-squared</td><td>0.076</td></tr><tr><td>Yes, on most or all days</td><td>605 (1.9)</td><td>565 (1.8)</td><td>40 (3.0)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>462 (1.4)</td><td>444 (1.4)</td><td>18 (1.3)</td><td></td><td></td><td></td></tr><tr><td>British</td><td>7408 (22.8)</td><td>7079 (22.7)</td><td>329 (24.5)</td><td>0.142</td><td>Chi-squared</td><td>0.041</td></tr><tr><td>other</td><td>25090 (77.2)</td><td>24075 (77.3)</td><td>1015 (75.5)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Ever smoked - visit 2, n (%)</td><td>No</td><td>15217 (46.8)</td><td>14671 (47.1)</td><td>546 (40.6)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.131</td></tr><tr><td>Yes</td><td>17196 (52.9)</td><td>16402 (52.6)</td><td>794 (59.1)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Handedness (chirality/laterality) - visit 0, n (%)</td><td>other</td><td>85 (0.3)</td><td>81 (0.3)</td><td>4 (0.3)</td><td></td><td></td><td></td></tr><tr><td>Left-handed</td><td>3043 (9.4)</td><td>2911 (9.3)</td><td>132 (9.8)</td><td>0.425</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.043</td></tr><tr><td rowspan="10"></td><td rowspan="10">Hypercholesterol, n (%)</td><td>Right-handed</td><td>28957 (89.1)</td><td>27772 (89.1)</td><td>1185 (88.2)</td><td></td><td></td><td></td></tr><tr><td>Use both right and left hands</td><td>486 (1.5)</td><td>460 (1.5)</td><td>26 (1.9)</td><td></td><td></td><td></td></tr><tr><td>equally</td><td>12 (0.0)</td><td>11 (0.0)</td><td>1 (0.1)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>24538 (75.5)</td><td>24204 (77.7)</td><td>334 (24.9)</td><td>&lt;0.001</td><td>Chi-squared</td><td>1.245</td></tr><tr><td>0</td><td>7960 (24.5)</td><td>6950 (22.3)</td><td>1010 (75.1)</td><td></td><td></td><td></td></tr><tr><td>1</td><td>23962 (73.7)</td><td>23462 (75.3)</td><td>500 (37.2)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.832</td></tr><tr><td>0</td><td>8536 (26.3)</td><td>7692 (24.7)</td><td>844 (62.8)</td><td></td><td></td><td></td></tr><tr><td>1</td><td>27267 (83.9)</td><td>26325 (84.5)</td><td>942 (70.1)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.349</td></tr><tr><td>False</td><td>5231 (16.1)</td><td>4829 (15.5)</td><td>402 (29.9)</td><td></td><td></td><td></td></tr><tr><td>True</td><td>795 (2.4)</td><td>753 (2.4)</td><td>42 (3.1)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.202</td></tr><tr><td rowspan="3">Job involves shift work - visit 2, n (%)</td><td>Always</td><td>11077 (34.1)</td><td>10733 (34.5)</td><td>344 (25.6)</td><td></td><td></td><td></td></tr><tr><td>Never/rarely</td><td>855 (2.6)</td><td>826 (2.7)</td><td>29 (2.2)</td><td></td><td></td><td></td></tr><tr><td>Sometimes</td><td>19771 (60.8)</td><td>18842 (60.5)</td><td>929 (69.1)</td><td></td><td></td><td></td></tr><tr><td>Length of time at current address - visit 2, mean (SD)</td><td></td><td>21.0 (13.9)</td><td>21.0 (13.9)</td><td>21.9 (14.0)</td><td>0.021</td><td>Two Sample T-test</td><td>0.065</td></tr><tr><td rowspan="2">Life long depression, n (%)</td><td>False</td><td>27461 (84.5)</td><td>26318 (84.5)</td><td>1143 (85.0)</td><td>0.600</td><td>Chi-squared</td><td>0.016</td></tr><tr><td>True</td><td>5037 (15.5)</td><td>4836 (15.5)</td><td>201 (15.0)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Ls pc dim.1, mean (SD)</td><td></td><td>0.6 (2.0)</td><td>0.6 (2.0)</td><td>-0.1 (2.3)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.345</td></tr><tr><td></td><td>-0.4 (2.0)</td><td>-0.4 (2.0)</td><td>-0.8 (2.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.174</td></tr><tr><td rowspan="2">Ls pc dim.2, mean (SD)</td><td></td><td>3388 (10.4)</td><td>3228 (10.4)</td><td>160 (11.9)</td><td>0.031</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.082</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="10"></td><td rowspan="10">Maternal smoking around birth - visit 0, n (%)</td><td>No</td><td>20344 (62.6)</td><td>19553 (62.8)</td><td>791 (58.9)</td><td></td><td></td><td></td></tr><tr><td>Yes</td><td>8749 (26.9)</td><td>8357 (26.8)</td><td>392 (29.2)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>17 (0.1)</td><td>16 (0.1)</td><td>1 (0.1)</td><td></td><td></td><td></td></tr><tr><td>Mh pc dim.1, mean (SD)</td><td>1.0 (6.5)</td><td>1.0 (6.5)</td><td>0.2 (6.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.126</td></tr><tr><td>Mh pc dim.2, mean (SD)</td><td>0.5 (3.3)</td><td>0.5 (3.3)</td><td>-0.1 (3.4)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.171</td></tr><tr><td>Number in household - visit 2, mean (SD)</td><td>2.2 (1.0)</td><td>2.2 (1.0)</td><td>2.1 (1.4)</td><td>0.233</td><td>Two Sample T-test</td><td>-0.038</td></tr><tr><td>Number of full brothers - visit 2, mean (SD)</td><td>1.0 (1.1)</td><td>1.0 (1.1)</td><td>1.1 (1.3)</td><td>0.008</td><td>Two Sample T-test</td><td>0.078</td></tr><tr><td>Number of full sisters - visit 2, mean (SD)</td><td>1.0 (1.1)</td><td>1.0 (1.1)</td><td>1.0 (1.2)</td><td>0.379</td><td>Two Sample T-test</td><td>0.025</td></tr><tr><td>Number of vehicles in household - visit 2, n (%)</td><td>Four or more</td><td>922 (2.8)</td><td>889 (2.9)</td><td>33 (2.5)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.177</td></tr><tr><td rowspan="5">Obesity, n (%)</td><td>None</td><td>1265 (3.9)</td><td>1181 (3.8)</td><td>84 (6.2)</td><td></td><td></td><td></td></tr><tr><td>One</td><td>13770 (42.4)</td><td>13134 (42.2)</td><td>636 (47.3)</td><td></td><td></td><td></td></tr><tr><td>Three</td><td>3034 (9.3)</td><td>2938 (9.4)</td><td>96 (7.1)</td><td></td><td></td><td></td></tr><tr><td>Two</td><td>13471 (41.5)</td><td>12977 (41.7)</td><td>494 (36.8)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>36 (0.1)</td><td>35 (0.1)</td><td>1 (0.1)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Part of a multiple birth - visit 0, n (%)</td><td>0</td><td>26781 (82.4)</td><td>25986 (83.4)</td><td>795 (59.2)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.557</td></tr><tr><td>1</td><td>5717 (17.6)</td><td>5168 (16.6)</td><td>549 (40.8)</td><td></td><td></td><td></td></tr><tr><td></td><td>No</td><td>31809 (97.9)</td><td>30501 (97.9)</td><td>1308 (97.3)</td><td>0.307</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.040</td></tr></tbody></table>
...continued

<table><caption>Table S6: Baseline characteristics of the included participants, according to their higher hypercholesterol status. Adequate statistical tests depending on the variable type assess whether each variable has a distinct distributions between the "exposed" and the "unexposed" group (with exposure having hypercholesterol). We also report the Standardized mean difference (SMD) for each variable.</caption><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No diabetes</th><th>Diabetes</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="2">Past tobacco smoking - visit 2, n (%)</td><td>Yes</td><td></td><td>644 (2.0)</td><td>611 (2.0)</td><td>33 (2.5)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.283</td></tr><tr><td>other</td><td></td><td>45 (0.1)</td><td>42 (0.1)</td><td>3 (0.2)</td></tr><tr><td rowspan="7">Qualifications - visit 2, n (%)</td><td>I have never smoked</td><td></td><td>15218 (46.8)</td><td>14672 (47.1)</td><td>546 (40.6)</td><td rowspan="7">&lt;0.001</td><td rowspan="7">Chi-squared (warning: expected count &lt; 5)</td><td rowspan="7">0.234</td></tr><tr><td>Just tried once or twice</td><td></td><td>5296 (16.3)</td><td>5129 (16.5)</td><td>167 (12.4)</td></tr><tr><td>Smoked occasionally</td><td></td><td>4008 (12.3)</td><td>3871 (12.4)</td><td>137 (10.2)</td></tr><tr><td>Smoked on most or all days</td><td></td><td>7287 (22.4)</td><td>6837 (21.9)</td><td>450 (33.5)</td></tr><tr><td>other</td><td></td><td>689 (2.1)</td><td>645 (2.1)</td><td>44 (3.3)</td></tr><tr><td>A levels/AS levels or equivalent</td><td></td><td>4013 (12.3)</td><td>3849 (12.4)</td><td>164 (12.2)</td></tr><tr><td>CSEs or equivalent</td><td></td><td>1205 (3.7)</td><td>1146 (3.7)</td><td>59 (4.4)</td></tr><tr><td rowspan="5">Scanner lateral (x) brain position - visit 2, mean (SD)</td><td>College or University degree</td><td></td><td>16203 (49.9)</td><td>15647 (50.2)</td><td>556 (41.4)</td><td rowspan="5">0.721</td><td rowspan="5">Two Sample T-test</td><td rowspan="5">0.010</td></tr><tr><td>NVQ or HND or HNC or equivalent</td><td></td><td>1901 (5.8)</td><td>1779 (5.7)</td><td>122 (9.1)</td></tr><tr><td>None of the above</td><td></td><td>1762 (5.4)</td><td>1644 (5.3)</td><td>118 (8.8)</td></tr><tr><td>O levels/GCSEs or equivalent</td><td></td><td>5717 (17.6)</td><td>5466 (17.5)</td><td>251 (18.7)</td></tr><tr><td>Other professional qualifications eg: nursing, teaching other</td><td></td><td>1596 (4.9)</td><td>1530 (4.9)</td><td>66 (4.9)</td></tr><tr><td>Scanner longitudinal (z) brain position - visit 2, mean (SD)</td><td></td><td></td><td>101 (0.3)</td><td>93 (0.3)</td><td>8 (0.6)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.132</td></tr><tr><td>Scanner table position - visit 2, mean (SD)</td><td></td><td></td><td>0.7 (3.0)</td><td>0.7 (3.0)</td><td>0.7 (3.0)</td></tr><tr><td>Scanner transverse (y) brain position - visit 2, mean (SD)</td><td></td><td></td><td>-28.1 (26.8)</td><td>-27.9 (26.7)</td><td>-31.6 (28.1)</td><td rowspan="2">0.037</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.059</td></tr><tr><td>Self declared mental exclusion visit 2, mean (SD)</td><td></td><td></td><td>-1054.2 (25.1)</td><td>-1054.2 (25.0)</td><td>-1055.7 (26.0)</td></tr><tr><td>Sex - visit 0, n (%)</td><td>Female</td><td></td><td>17195 (52.9)</td><td>16742 (53.7)</td><td>453 (33.7)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.412</td></tr><tr><td>Male</td><td></td><td></td><td>15303 (47.1)</td><td>14412 (46.3)</td><td>891 (66.3)</td></tr><tr><td>Smoking status - visit 2, n (%)</td><td>Current</td><td></td><td>1065 (3.3)</td><td>1007 (3.2)</td><td>58 (4.3)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared (warning: expected count &lt; 5)</td><td rowspan="2">0.215</td></tr><tr><td>Never</td><td></td><td></td><td>20503 (63.1)</td><td>19791 (63.5)</td><td>712 (53.0)</td></tr><tr><td rowspan="3">Social support, n (%)</td><td>Previous</td><td></td><td>10846 (33.4)</td><td>10276 (33.0)</td><td>570 (42.4)</td><td rowspan="3">&lt;0.001</td><td rowspan="3">Chi-squared</td><td rowspan="3">0.113</td></tr><tr><td>other</td><td></td><td>84 (0.3)</td><td>80 (0.3)</td><td>4 (0.3)</td></tr><tr><td>False</td><td></td><td>12720 (39.1)</td><td>12122 (38.9)</td><td>598 (44.5)</td></tr><tr><td rowspan="2">Total alcohol weekly units 2, mean (SD)</td><td>True</td><td></td><td>19778 (60.9)</td><td>19032 (61.1)</td><td>746 (55.5)</td><td rowspan="2">0.049</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.057</td></tr><tr><td></td><td></td><td>13.1 (14.4)</td><td>13.1 (14.4)</td><td>12.3 (15.5)</td></tr><tr><td>Townsend deprivation index at recruitment - visit 0, mean (SD)</td><td></td><td></td><td>-1.9 (2.7)</td><td>-1.9 (2.7)</td><td>-1.6 (2.8)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.121</td></tr><tr><td>Uk biobank assessment centre - visit 2, n (%)</td><td>Cheadle</td><td></td><td>18991 (58.4)</td><td>18143 (58.2)</td><td>848 (63.1)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.122</td></tr><tr><td rowspan="3">Volumetric scaling from t1 head image to standard space - visit 2, mean (SD)</td><td>Newcastle</td><td></td><td>8436 (26.0)</td><td>8113 (26.0)</td><td>323 (24.0)</td><td rowspan="3">&lt;0.001</td><td rowspan="3">Two Sample T-test</td><td rowspan="3">-0.131</td></tr><tr><td>Reading</td><td></td><td>5028 (15.5)</td><td>4860 (15.6)</td><td>168 (12.5)</td></tr><tr><td>other</td><td></td><td>43 (0.1)</td><td>38 (0.1)</td><td>5 (0.4)</td></tr><tr><td></td><td></td><td></td><td>1.3 (0.1)</td><td>1.3 (0.1)</td><td>1.3 (0.1)</td><td></td><td></td><td></td></tr></tbody></table>

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No hypercholesterol</th><th>Hypercholesterol</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td>Sample size</td><td>n</td><td></td><td>32498</td><td>24538</td><td>7960</td><td></td><td>Two Sample T-test</td><td>0.230</td></tr><tr><td>Outcome</td><td>G factor, mean (SD)</td><td></td><td>-0.0 (1.1)</td><td>-0.1 (1.1)</td><td>0.2 (1.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.418</td></tr><tr><td rowspan="2">Mediators</td><td>Dmri pc 0, mean (SD)</td><td></td><td>-0.3 (10.2)</td><td>-1.4 (9.6)</td><td>3.0 (11.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.308</td></tr><tr><td>Dmri pc 1, mean (SD)</td><td></td><td>0.1 (5.2)</td><td>0.5 (5.0)</td><td>-1.2 (5.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.288</td></tr><tr><td></td><td>Dmri pc 2, mean (SD)</td><td></td><td>-0.1 (5.0)</td><td>-0.5 (4.7)</td><td>1.0 (5.7)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td></td></tr></tbody></table>
...continued

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No hypercholesterol</th><th>Hypercholesterol</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="20">Confounders (alphabetic order)</td><td>Dmri pc 3, mean (SD)</td><td rowspan="20">No</td><td>0.0 (4.4)</td><td>-0.2 (4.3)</td><td>0.5 (4.6)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.159</td></tr><tr><td>Dmri pc 4, mean (SD)</td><td>0.0 (4.2)</td><td>0.1 (4.1)</td><td>-0.3 (4.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.093</td></tr><tr><td>Dmri pc 5, mean (SD)</td><td>0.0 (3.4)</td><td>0.1 (3.4)</td><td>-0.2 (3.6)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.075</td></tr><tr><td>Smri dmri pc 0, mean (SD)</td><td>-0.4 (10.5)</td><td>-1.5 (9.9)</td><td>3.3 (11.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.447</td></tr><tr><td>Smri dmri pc 1, mean (SD)</td><td>-0.2 (7.4)</td><td>-0.2 (7.4)</td><td>-0.2 (7.6)</td><td>0.371</td><td>Two Sample T-test</td><td>-0.012</td></tr><tr><td>Smri dmri pc 2, mean (SD)</td><td>0.1 (5.6)</td><td>0.7 (5.4)</td><td>-1.6 (5.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.400</td></tr><tr><td>Smri dmri pc 3, mean (SD)</td><td>-0.0 (4.7)</td><td>-0.2 (4.4)</td><td>0.5 (5.4)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.127</td></tr><tr><td>Smri dmri pc 4, mean (SD)</td><td>-0.0 (4.3)</td><td>-0.2 (4.3)</td><td>0.6 (4.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.174</td></tr><tr><td>Smri dmri pc 5, mean (SD)</td><td>0.0 (4.3)</td><td>0.2 (4.2)</td><td>-0.4 (4.6)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.123</td></tr><tr><td>Smri pc 0, mean (SD)</td><td>0.3 (7.2)</td><td>0.6 (7.2)</td><td>-0.7 (7.1)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>-0.177</td></tr><tr><td>Smri pc 1, mean (SD)</td><td>-0.0 (3.3)</td><td>-0.3 (3.2)</td><td>0.8 (3.5)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.328</td></tr><tr><td>Smri pc 2, mean (SD)</td><td>-0.1 (2.8)</td><td>-0.4 (2.7)</td><td>1.0 (2.9)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.503</td></tr><tr><td>Smri pc 3, mean (SD)</td><td>0.0 (2.1)</td><td>-0.0 (2.0)</td><td>0.1 (2.2)</td><td>&lt;0.001</td><td>Two Sample T-test</td><td>0.081</td></tr><tr><td>Adopted as a child - visit 0, n (%)</td><td>32469 (99.9)</td><td>24513 (99.9)</td><td>7956 (99.9)</td><td>0.317</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.022</td></tr><tr><td>Age when attended assessment centre - visit 2, mean (SD)</td><td>Yes</td><td>9 (0.0)</td><td>7 (0.0)</td><td>2 (0.0)</td><td></td><td>Two Sample T-test</td><td>0.739</td></tr><tr><td>Alcohol above nhs reco, n (%)</td><td>other</td><td>20 (0.1)</td><td>18 (0.1)</td><td>2 (0.0)</td><td></td><td>Chi-squared</td><td>0.101</td></tr><tr><td rowspan="5">Alcohol intake frequency. - visit 2, n (%)</td><td>0</td><td>21256 (65.4)</td><td>16341 (66.6)</td><td>4915 (61.7)</td><td>&lt;0.001</td><td>Chi-squared</td><td>0.098</td></tr><tr><td>1</td><td>11242 (34.6)</td><td>8197 (33.4)</td><td>3045 (38.3)</td><td></td><td></td><td></td></tr><tr><td>Daily or almost daily</td><td>5540 (17.0)</td><td>3984 (16.2)</td><td>1556 (19.5)</td><td></td><td></td><td></td></tr><tr><td>Never</td><td>2032 (6.3)</td><td>1501 (6.1)</td><td>531 (6.7)</td><td></td><td></td><td></td></tr><tr><td>Once or twice a week</td><td>8640 (26.6)</td><td>6628 (27.0)</td><td>2012 (25.3)</td><td></td><td></td><td></td></tr><tr><td rowspan="4">Average total household income before tax - visit 2, n (%)</td><td>One to three times a month</td><td>3788 (11.7)</td><td>2938 (12.0)</td><td>850 (10.7)</td><td></td><td>Chi-squared</td><td>0.201</td></tr><tr><td>Special occasions only</td><td>3262 (10.0)</td><td>2452 (10.0)</td><td>810 (10.2)</td><td></td><td></td><td></td></tr><tr><td>Three or four times a week</td><td>9236 (28.4)</td><td>7035 (28.7)</td><td>2201 (27.7)</td><td></td><td></td><td></td></tr><tr><td>18,000 to 30,999</td><td>7813 (24.0)</td><td>5621 (22.9)</td><td>2192 (27.5)</td><td>&lt;0.001</td><td></td><td></td></tr><tr><td rowspan="5">Body mass index (bmi) - visit 2, mean (SD)</td><td>31,000 to 51,999</td><td>9156 (28.2)</td><td>6845 (27.9)</td><td>2311 (29.0)</td><td></td><td>Two Sample T-test</td><td>0.359</td></tr><tr><td>52,000 to 100,000</td><td>7028 (21.6)</td><td>5650 (23.0)</td><td>1378 (17.3)</td><td></td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.201</td></tr><tr><td>Do not know</td><td>961 (3.0)</td><td>718 (2.9)</td><td>243 (3.1)</td><td></td><td></td><td></td></tr><tr><td>Greater than 100,000</td><td>2277 (7.0)</td><td>1873 (7.6)</td><td>404 (5.1)</td><td></td><td></td><td></td></tr><tr><td>Less than 18,000</td><td>3402 (10.5)</td><td>2436 (9.9)</td><td>966 (12.1)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Breastfed as a baby - visit 0, n (%)</td><td>Prefer not to answer</td><td>1861 (5.7)</td><td>1395 (5.7)</td><td>466 (5.9)</td><td></td><td>Chi-squared</td><td>0.037</td></tr><tr><td>Do not know</td><td>26.4 (4.3)</td><td>26.0 (4.3)</td><td>27.6 (4.3)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.045</td></tr><tr><td rowspan="4">Cmdd final, n (%)</td><td>No</td><td>7174 (22.1)</td><td>5747 (23.4)</td><td>1427 (17.9)</td><td></td><td>Chi-squared</td><td>0.078</td></tr><tr><td>Yes</td><td>19136 (58.9)</td><td>14548 (59.3)</td><td>4588 (57.6)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>13 (0.0)</td><td>11 (0.0)</td><td>2 (0.0)</td><td>0.005</td><td></td><td></td></tr><tr><td>False</td><td>23413 (72.0)</td><td>17579 (71.6)</td><td>5834 (73.3)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">Comparative body size at age 10 - visit 0, n (%)</td><td>True</td><td>9085 (28.0)</td><td>6959 (28.4)</td><td>2126 (26.7)</td><td>0.016</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.051</td></tr><tr><td>About average</td><td>16637 (51.2)</td><td>12661 (51.6)</td><td>3976 (49.9)</td><td></td><td></td><td></td></tr><tr><td rowspan="4">Comparative height size at age 10 - visit 0, n (%)</td><td>Do not know</td><td>347 (1.1)</td><td>256 (1.0)</td><td>91 (1.1)</td><td></td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.078</td></tr><tr><td>Plumper</td><td>4922 (15.1)</td><td>3741 (15.2)</td><td>1181 (14.8)</td><td></td><td></td><td></td></tr><tr><td>Thinner</td><td>10584 (32.6)</td><td>7873 (32.1)</td><td>2711 (34.1)</td><td></td><td></td><td></td></tr><tr><td>other</td><td>8 (0.0)</td><td>7 (0.0)</td><td>1 (0.0)</td><td></td><td></td><td></td></tr><tr><td rowspan="4">Country of birth (uk/elsewhere) - visit 0, n (%)</td><td>About average</td><td>17039 (52.4)</td><td>12779 (52.1)</td><td>4260 (53.5)</td><td>&lt;0.001</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.051</td></tr><tr><td>Do not know</td><td>293 (0.9)</td><td>218 (0.9)</td><td>75 (0.9)</td><td></td><td></td><td></td></tr><tr><td>Shorter</td><td>6569 (20.2)</td><td>4856 (19.8)</td><td>1713 (21.5)</td><td></td><td></td><td></td></tr><tr><td>Taller</td><td>8589 (26.4)</td><td>6678 (27.2)</td><td>1911 (24.0)</td><td></td><td></td><td></td></tr><tr><td rowspan="2">England</td><td>other</td><td>8 (0.0)</td><td>7 (0.0)</td><td>1 (0.0)</td><td></td><td></td><td></td></tr><tr><td>Elsewhere</td><td>1778 (5.5)</td><td>1385 (5.6)</td><td>393 (4.9)</td><td>0.017</td><td>Chi-squared (warning: expected count &lt; 5)</td><td>0.051</td></tr><tr><td></td><td>England</td><td>27360 (84.2)</td><td>20599 (83.9)</td><td>6761 (84.9)</td><td></td><td></td><td></td></tr></tbody></table>
...continued

<table><thead><tr><th>variable role</th><th>variable name</th><th>variable modalities</th><th>Overall</th><th>No hypercholesterol</th><th>Hypercholesterol</th><th>P-Value</th><th>Test</th><th>SMD (0,1)</th></tr></thead><tbody><tr><td rowspan="10"></td><td rowspan="10">Current employment status - visit 2, n (%)</td><td>Northern Ireland</td><td>234 (0.7)</td><td>173 (0.7)</td><td>61 (0.8)</td><td rowspan="10">&lt;0.001</td><td rowspan="10">Chi-squared</td><td rowspan="10">0.513</td></tr><tr><td>Republic of Ireland</td><td>217 (0.7)</td><td>173 (0.7)</td><td>44 (0.6)</td></tr><tr><td>Scotland</td><td>2296 (7.1)</td><td>1765 (7.2)</td><td>531 (6.7)</td></tr><tr><td>Wales</td><td>600 (1.8)</td><td>432 (1.8)</td><td>168 (2.1)</td></tr><tr><td>other</td><td>13 (0.0)</td><td>11 (0.0)</td><td>2 (0.0)</td></tr><tr><td>In paid employment or self-employed</td><td>12978 (39.9)</td><td>11156 (45.5)</td><td>1822 (22.9)</td></tr><tr><td>Retired</td><td>18302 (56.3)</td><td>12379 (50.4)</td><td>5923 (74.4)</td></tr><tr><td>other</td><td>1218 (3.7)</td><td>1003 (4.1)</td><td>215 (2.7)</td></tr><tr><td>0</td><td>31893 (98.1)</td><td>24089 (98.2)</td><td>7804 (98.0)</td></tr><tr><td>1</td><td>605 (1.9)</td><td>449 (1.8)</td><td>156 (2.0)</td></tr><tr><td rowspan="3">Current smoker, n (%)</td><td>No</td><td>31431 (96.7)</td><td>23728 (96.7)</td><td>7703 (96.8)</td><td rowspan="3">0.485</td><td rowspan="3">Chi-squared</td><td rowspan="3">0.010</td></tr><tr><td>Yes, on most or all days</td><td>605 (1.9)</td><td>449 (1.8)</td><td>156 (2.0)</td></tr><tr><td>other</td><td>462 (1.4)</td><td>361 (1.5)</td><td>101 (1.3)</td></tr><tr><td rowspan="2">Current tobacco smoking - visit 2, n (%)</td><td>0</td><td>31154 (95.9)</td><td>24204 (98.6)</td><td>6950 (87.3)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.455</td></tr><tr><td>1</td><td>1344 (4.1)</td><td>334 (1.4)</td><td>1010 (12.7)</td></tr><tr><td rowspan="2">Diabetic, n (%)</td><td>0</td><td>7408 (22.8)</td><td>5722 (23.3)</td><td>1686 (21.2)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.051</td></tr><tr><td>1</td><td>25090 (77.2)</td><td>18816 (76.7)</td><td>6274 (78.8)</td></tr><tr><td rowspan="2">Ethnic background - visit 2, n (%)</td><td>British</td><td>15217 (46.8)</td><td>11864 (48.3)</td><td>3353 (42.1)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.127</td></tr><tr><td>other</td><td>17196 (52.9)</td><td>12618 (51.4)</td><td>4578 (57.5)</td></tr><tr><td rowspan="2">Ever smoked - visit 2, n (%)</td><td>No</td><td>85 (0.3)</td><td>56 (0.2)</td><td>29 (0.4)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.127</td></tr><tr><td>Yes</td><td>3043 (9.4)</td><td>2275 (9.3)</td><td>768 (9.6)</td></tr><tr><td rowspan="2">Handedness (chirality/laterality) - visit 0, n (%)</td><td>Left-handed</td><td>28957 (89.1)</td><td>21888 (89.2)</td><td>7069 (88.8)</td><td rowspan="2">0.794</td><td rowspan="2">Chi-squared (warning: expected count &lt; 5)</td><td rowspan="2">0.013</td></tr><tr><td>Right-handed</td><td>486 (1.5)</td><td>366 (1.5)</td><td>120 (1.5)</td></tr><tr><td rowspan="2">Hypertensive, n (%)</td><td>0</td><td>12 (0.0)</td><td>9 (0.0)</td><td>3 (0.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.862</td></tr><tr><td>1</td><td>23962 (73.7)</td><td>20377 (83.0)</td><td>3585 (45.0)</td></tr><tr><td rowspan="2">Inflammation, n (%)</td><td>0</td><td>8536 (26.3)</td><td>4161 (17.0)</td><td>4375 (55.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.115</td></tr><tr><td>1</td><td>27267 (83.9)</td><td>20848 (85.0)</td><td>6419 (80.6)</td></tr><tr><td rowspan="3">Job involves shift work - visit 2, n (%)</td><td>False</td><td>5231 (16.1)</td><td>3690 (15.0)</td><td>1541 (19.4)</td><td rowspan="3">&lt;0.001</td><td rowspan="3">Chi-squared</td><td rowspan="3">0.486</td></tr><tr><td>True</td><td>795 (2.4)</td><td>668 (2.7)</td><td>127 (1.6)</td></tr><tr><td>Always</td><td>11077 (34.1)</td><td>9548 (38.9)</td><td>1529 (19.2)</td></tr><tr><td rowspan="2">Length of time at current address - visit 2, mean (SD)</td><td>Never/rarely</td><td>855 (2.6)</td><td>731 (3.0)</td><td>124 (1.6)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.226</td></tr><tr><td>Sometimes</td><td>19771 (60.8)</td><td>13591 (55.4)</td><td>6180 (77.6)</td></tr><tr><td rowspan="2">Life long depression, n (%)</td><td>other</td><td>21.0 (13.9)</td><td>20.2 (13.5)</td><td>23.4 (14.8)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.059</td></tr><tr><td>False</td><td>27461 (84.5)</td><td>20609 (84.0)</td><td>6852 (86.1)</td></tr><tr><td rowspan="2">Ls pc dim.1, mean (SD)</td><td>True</td><td>5037 (15.5)</td><td>3929 (16.0)</td><td>1108 (13.9)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.149</td></tr><tr><td>0</td><td>0.6 (2.0)</td><td>0.7 (2.0)</td><td>0.4 (2.1)</td></tr><tr><td rowspan="2">Ls pc dim.2, mean (SD)</td><td>0</td><td>-0.4 (2.0)</td><td>-0.5 (2.0)</td><td>-0.4 (2.0)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.060</td></tr><tr><td>1</td><td>3388 (10.4)</td><td>2482 (10.1)</td><td>906 (11.4)</td></tr><tr><td rowspan="2">Maternal smoking around birth - visit 0, n (%)</td><td>Do not know</td><td>20344 (62.6)</td><td>15552 (63.4)</td><td>4792 (60.2)</td><td rowspan="2">&lt;0.001</td><td rowspan="2">Chi-squared (warning: expected count &lt; 5)</td><td rowspan="2">0.068</td></tr><tr><td>No</td><td>8749 (26.9)</td><td>6490 (26.4)</td><td>2259 (28.4)</td></tr><tr><td rowspan="2">Mh pc dim.1, mean (SD)</td><td>Yes</td><td>17 (0.1)</td><td>14 (0.1)</td><td>3 (0.0)</td><td rowspan="2">0.010</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">0.033</td></tr><tr><td>other</td><td>1.0 (6.5)</td><td>1.0 (6.5)</td><td>1.2 (6.5)</td></tr><tr><td rowspan="2">Mh pc dim.2, mean (SD)</td><td>0</td><td>0.5 (3.3)</td><td>0.5 (3.3)</td><td>0.4 (3.2)</td><td rowspan="2">0.464</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.009</td></tr><tr><td>1</td><td>2.2 (1.0)</td><td>2.2 (1.0)</td><td>2.0 (0.9)</td></tr><tr><td rowspan="2">Number in household - visit 2, mean (SD)</td><td>0</td><td>1.0 (1.1)</td><td>1.1 (1.1)</td><td>1.0 (1.1)</td><td rowspan="2">0.029</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.177</td></tr><tr><td>1</td><td>1.0 (1.1)</td><td>1.1 (1.1)</td><td>1.0 (1.1)</td></tr><tr><td rowspan="2">Number of full brothers - visit 2, mean (SD)</td><td>Four or more</td><td>1.0 (1.1)</td><td>1.0 (1.1)</td><td>1.0 (1.1)</td><td rowspan="2">0.168</td><td rowspan="2">Two Sample T-test</td><td rowspan="2">-0.028</td></tr><tr><td>No</td><td>922 (2.8)</td><td>754 (3.1)</td><td>168 (2.1)</td></tr><tr><td rowspan="4">Obesity, n (%)</td><td>None</td><td>1265 (3.9)</td><td>940 (3.8)</td><td>325 (4.1)</td><td rowspan="4">&lt;0.001</td><td rowspan="4">Chi-squared</td><td rowspan="4">0.231</td></tr><tr><td>One</td><td>13770 (42.4)</td><td>10034 (40.9)</td><td>3736 (46.9)</td></tr><tr><td>Three</td><td>3034 (9.3)</td><td>2516 (10.3)</td><td>518 (6.5)</td></tr><tr><td>Two</td><td>13471 (41.5)</td><td>10267 (41.8)</td><td>3204 (40.3)</td></tr><tr><td rowspan="2">Part of a multiple birth - visit 0, n (%)</td><td>other</td><td>36 (0.1)</td><td>27 (0.1)</td><td>9 (0.1)</td><td rowspan="2">0.745</td><td rowspan="2">Chi-squared</td><td rowspan="2">0.010</td></tr><tr><td>0</td><td>26781 (82.4)</td><td>20772 (84.7)</td><td>6009 (75.5)</td></tr><tr><td rowspan="2"></td><td>1</td><td>5717 (17.6)</td><td>3766 (15.3)</td><td>1951 (24.5)</td><td rowspan="2"></td><td rowspan="2"></td><td rowspan="2"></td></tr><tr><td>No</td><td>31809 (97.9)</td><td>24016 (97.9)</td><td>7793 (97.9)</td></tr></tbody></table>