Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2026 Oct 6.
Published in final edited form as: Biom J. 2026 Apr;68(2):e70133. doi: 10.1002/bimj.70133

Estimate Time-Varying Exposure Effects via Ensemble Learning-Based Marginal Structural Model With Application to Adolescent Cognitive Development Study

Zhiwei Zhao 1, Chixiang Chen 2, Shuo Chen 2
PMCID: PMC13638232  NIHMSID: NIHMS2207029  PMID: 41987497

Abstract

Evaluating the effects of time-varying exposures is essential for longitudinal studies. The effect estimation becomes increasingly challenging when dealing with hundreds of time-dependent confounders. We propose a Marginal Structure Ensemble Learning Model (MASE) to provide a marginal structural model (MSM)-based robust estimator under the longitudinal setting. The proposed model integrates multiple machine learning algorithms to model propensity scores and a sequence of conditional outcome means such that it becomes less sensitive to model misspecification due to any single algorithm and allows many confounders with potential nonlinear confounding effects to reduce the risk of inconsistent estimation. Extensive simulation analysis demonstrates the superiority of MASE over benchmark methods (e.g., MSM, G-computation, and Targeted maximum likelihood), yielding smaller estimation bias and improved inference accuracy. We apply MASE to the adolescent cognitive development study to investigate the time-varying effects of sleep insufficiency on cognitive performance. The results reveal an aggregated negative impact of insufficient sleep on cognitive development among youth.

Keywords: causal machine learning, ensemble learning, marginal structure model, sleep insufficiency

1 |. Introduction

Recent large-scale longitudinal observational studies have collected extensive data, including time-varying exposures, multiple longitudinal outcomes, and hundreds of important time-dependent covariates. For instance, our current research is inspired by an investigation into the influence of insufficient sleep on adolescent cognitive development, utilizing data from the Adolescent Brain Cognitive Development (ABCD) study (Yang et al. 2022). The ABCD study collects data from 11,868 adolescent participants at ages 10, 12, and 14. During each visit, various measures are recorded, including sleep patterns, cognitive performance, and a range of psychographic variables. Insufficient sleep is a modifiable and health-related factor that may adversely affect the cognitive development of young individuals (De Bruin et al. 2017). A previous cross-sectional study revealed association between insufficient sleep and resultant differences in brain functions and structures (Dutil et al. 2018). Recent studies researched on the longitudinal ABCD data and revealed the relationship between insufficient sleep and psychiatric problem (Cheng et al. 2021), and neurocognitive development (Yang et al. 2022). However, those findings are mostly based on association-based analysis, which lacks causal interpretation, and did not consider time-varying trajectory effects. Therefore, we aim to re-evaluate the longitudinal (potentially causal) impact of insufficient sleep on cognitive outcomes among adolescent participants. The findings from this study can provide critical evidence to address sleep insufficiency, such as promoting strategies to reduce prolonged use of electronic devices as individuals age, ultimately helping to mitigate the risk of cognitive decline in young individuals. To consistently study the impact of insufficient sleep over the time using an observational data, it is important to control time-varying covariates (e.g., environmental factors, nutrition, and socioeconomic status) serving as potential confounders. Analyzing such a data requires advanced causal inference tools.

The current literature offers methods to address limited number of confounders with linear confounding effects, including inverse probability weighting (Horvitz and Thompson 1952; Robins et al. 1994), conditional mean imputation (Robins 1999), and matching (Rubin 1973). To estimate the effects of time-varying exposures in the presence of time-varying confounders, the Marginal Structural Model (MSM, Robins et al. 2000; Robins 2000; Babino et al. 2019) has become a popular tool in longitudinal causal inference. This method constructs a pseudo-population and incorporates both confounders and time-varying exposures into weights. However, correctly modeling propensity scores (PS) is crucial and can be challenging when dealing with high-dimensional confounders or nonlinear effects. On the other hand, Bang and Robins (2005) used a g-computation formula to estimate the longitudinal causal effect. However, accurately estimating the longitudinal outcome model and making a valid statistical inference when using machine learning are also crucial. To address these challenges, Doubly Robust (DR) methods, including augmented inverse probability weighting and targeted maximum likelihood estimation, have been introduced (Babino et al. 2019; Kreif et al. 2017; van der Laan and Rose 2011). DR estimators are derived by subtracting the projection onto Hilbert space and generally involve two nuisance parameters: treatment estimator (e.g., PS) and outcome estimator (e.g., iterative conditional mean) (Yu and van der Laan 2006). They are “doubly robust” in the sense that if either the treatment model or the outcome model is correct, the final estimate will be consistent. A widely used DR estimation method for longitudinal data is longitudinal targeted maximum likelihood estimation (lTMLE; Gruber and van der Laan 2010; Lendle et al. 2017).

More recently, machine learning-assisted causal inference methods have demonstrated effectiveness in handling high-dimensional covariates with complex, nonlinear effects when estimating causal effects (Chen et al. 2025; Chernozhukov et al. 2018; Künzel et al. 2019; Yang et al. 2023). However, most of these approaches are designed for studies with a single time point and are not well-suited for analyzing time-varying exposures in longitudinal settings. Notably, Bodory et al. (2022) developed a double machine learning method and provided theoretical foundation to evaluate dynamic treatment effects. This approach innovatively integrates DR estimation with machine learning algorithms, providing a data-driven solution to address time-varying confounding in longitudinal analyses. The underlying rationale for using machine learning in this context is that a DR estimator achieves faster convergence rates when all nuisance functions are consistently estimated. This property enables the application of machine learning in causal settings, as the estimation bias and uncertainty from machine learning becomes negligible under mild conditions (Bodory et al. 2022; Chernozhukov et al. 2018; Hernán and Robins 2010). Despite these advancements, the developed method remains sensitive to the selection of a single machine learning algorithm. In practice, more complex algorithms do not always yield optimal results (Chen et al. 2025). One potential solution to address this limitation is the adoption of ensemble learning (Chen et al. 2025; van der Laan et al. 2007), which has gained popularity for its robust and superior performance achieved by integrating multiple machine learning algorithms. However, a comprehensive approach that combines causal machine learning with ensemble learning in longitudinal settings remains unexplored.

To bridge the gap, we propose a Marginal Structure Ensemble Learning Model (MASE). MASE is developed based on the MSM solved by an efficient score, with the estimation of PS and iterative conditional means as nuisance parameters. There are two major contributions in this paper: (1) from methodology perspective, we develop and evaluate a computationally efficient ensemble learning algorithm to integrate multiple machine learning algorithms to model nuisance functions, including time-varying PS and a sequence of iterative outcome mean functions. We also evaluate the Neyman orthogonality condition and provide the analytical solution for the inference of estimated causal parameters. In numerical evaluations, we observe that our method effectively handles high-dimensional confounders, appropriately accounts for the longitudinal data structure, and outperforms existing methods in terms of estimation bias. (2) From an application perspective, MASE contributes to bridging gaps in our understanding of the long-term relationship between insufficient sleep and cognitive outcomes using ABCD data, compared to existing methods. Our findings indicate that sleep insufficiency can lead to cumulative declines in cognitive performance, providing complementary evidence to existing conclusions (Beebe 2011).

The rest of the paper is organized as follows. Section 2 describes the proposed model, including the estimation process and inference method. Section 3 showcases the application of our method to the ABCD study, outlining the effect estimation and presenting the inference results. Section 4 implements simulations to demonstrate the empirical performance of our method with finite sample sizes. We conclude the paper with a discussion in Section 5. Technical details and extra application results can be found in the Supporting Information.

2 |. Methods

2.1 |. MSM With Time-Varying Exposure

We consider a longitudinal study featuring a single binary exposure, multiple continuous outcomes, and high-dimensional confounders encompassing various data types. For i=1,…,n, let Di=Ait,Zit,Yit represent the independent identically distributed data for subject i across visit t=1,…,T. Specifically, Ait=ait∈{0,1} denotes a univariate binary exposure variable, Zit=Zit1,…,ZitptT is a pt-dimensional vector of observed confounders, with the number of covariates not necessarily being uniform at each visit. Furthermore, Yit=Yit1,…,YitqT represents q outcomes, which can be either continuous or categorical. For any variable vt1≤t≤T, we denote vt¯=v1,…,vt, t=1,…,T as the historical measurements of variable v up to the 𝑡th visit. We define the counterfactual outcome (Rubin 2005) for the 𝑗th outcome at time T as YijA¯iT=ai1,…,aiT for subject i.

The population mean of the counterfactual outcome is given by EYjA¯T=a1,…,aT∣Z0, where Z0∈ℝn×p0 is the baseline covariates matrix, and At∈ℝn is the exposure vector.

Figure 1 illustrates the directed acyclic graph (DAG) of our model, with all variables repeatedly measured at two timepoint (using a single outcome for demonstration purposes). Because both high-dimensional confounders and exposures are longitudinally measured and time-varying, estimating the aggregated causal effect is challenging. Classic methods, such as MSM, estimate the causal effect by leveraging PS weighting. Inspired by our data analysis, which suggests that previous cognitive outcomes can affect subsequent results (e.g., the crystallized composite score), we propose the following PS model that incorporates the effects of all time-varying confounders along with past outcomes:

πi1ai1,zi1=PAi1=ai1∣Zi1=zi1πita¯it,z¯it,y¯i(t−1)=PAit=ait∣A¯i(t−1)=a¯i(t−1),Z¯it=z¯it,Y¯i(t−1)=y¯i(t−1),2≤t≤T. (1)

FIGURE 1 |.

FIGURE 1 |

ABCD tabulates data structure. The solid lines represent the impact of variables to the others, the dashed line represents possible impact of previous measurements on the later ones. Notations 𝐀, 𝐙, and 𝐘 are defined in Section 2.1.

To ease the notation, we redefine Z¯it=Z¯it,Y¯i(t−1, t=2,…,T. Then, the second PS function in (1) can be simplified as πita¯it,z¯it.

To ensure the identifiability of average causal effect τa¯t, we adopt the commonly used assumptions consistent with MSM. Specifically, in addition to the Stable Unit Treatment Value Assumption (SUTVA, Rubin 1980), we assume that, for each individual i and each outcome j, the following hold: (1) consistency: Yija¯iT=YiTj if A¯iT=a¯iT; (2) no unmeasured confounding (NUC): for all a¯iT and t, Yija¯iT⊥Ait∣Z¯it, A¯i(t−1)=a¯i(t−1); and (3) positivity: for all t and a¯it, πita¯it,z¯it>0. Throughout the paper, we refer to these assumptions as the Multivariate Longitudinal Sequential (MLS) assumptions. We then provide the MSM for the 𝑗th outcome as

EYja¯T∣Z0=τa¯T,Z0;θj,∀j, (2)

where τ(⋅,⋅;⋅) is a known function that models the 𝑗th outcome based on exposures and covariates at baseline, and θj is the vector of estimands. For example, we have τa¯2,Z0;θj=β0j+β1ja1+β2ja2 as a linear function with θj=β0j,β1j,β2j′, where a1, a2 correspond to the adolescent sleep time measured at visits one and two. Moreover, with effect modification, we can have τa¯2,Z0;θj=β0j+βz0jz0+β1ja1+β2ja2+βz1jz0∗a1+βz2jz0∗a2. We will focus on the previous model with a simple linear form, and we are interested in estimating the average treatment effect (ATE) for population getting sufficient sleep all the time (treatment regime (0,0)) versus population not having sufficient sleep at all (treatment regime (1,1)) as:ATE:=θATEj=β1j+β2j,∀j.

2.2 |. DR Estimator

PS weighting is a common approach for estimating the MSM equation (2). The weights can be calculated as wit=1/Πt=1Tπita¯it,z¯it. However, when massive time-varying confounders are present with potentially nonlinear confounding effects, a PS model based on a single machine learning algorithm could be incorrect due to numerical challenges. These incorrect modeling can lead to inconsistent estimates of causal effects within the MSM framework. Therefore, we are motivated from the DR estimator (Babino et al. 2019) and aim to develop a causal machine and ensemble learning-based estimator to mitigate the issue of model misspecification and machine learning algorithm selection.

The DR estimator combines the estimates of conditional means and PS weights, ensuring consistent estimates of causal effects within the MSM framework when either the estimate of conditional means or PS is correctly specified. We first introduce an Iterative Conditional Mean Estimation (ICE) procedure:

ηTja¯T,z¯T=EYTj∣A¯T=a¯T,Z¯T=z¯Tηtja¯T,z¯t=Eηt+1ja¯T,Z¯t+1∣A¯t=a¯t,Z¯t=z¯t,t=T−1,T−2,…,1η0ja¯T,z0=Eη1ja¯T,Z1∣Z0=z0 (3)

for any j=1,…,q.

For simplicity, in the rest of this paper, we will eliminate the superscript j for η’s. The DR estimator for MSM is derived from the following estimating equation. Without loss of generality, we demonstrate the estimator with two timepoints. The estimating equation integrates the information from both conditional means and PS (Babino et al. 2019):

ES0+S1+S2=0, (4)

where

S2=dA¯2,Z0π1A1,Z1π2A¯2,Z¯2Y2−η2A¯2,Z¯2S1=∑a2∈A2dA1,a2,Z0π1A1,Z1η2A1,a2,Z¯2−η1A1,a2,Z1S0=∑a1∈A1∑a2∈A2da¯2,Z0η1a¯2,Z1−τa¯2,Z0;θj. (5)

Here, τa¯2,Z0;θj is given in (2), At, t=1, 2 represents the exposure set, for example,A2=a1={0,1},a2={0,1}. In addition, d(⋅) is any function with the same dimension as the parameter of interest θj. A simple example is to take d(⋅)=∂τa¯2,Z0;θj/∂θj. When τ⋅,⋅;θj is a linear function, a closed-form solution for the estimating equation is available (see the Supporting Information Section A ). For a nonlinear τ⋅,⋅;θj, we can solve equation (4) using the Newton–Raphson algorithm.

In Equation (4), the estimate θ^j of θj is consistent if either the estimates of π1, π2 or η1, η2 are correctly specified. Furthermore, Equation (4) satisfies the Neyman Orthogonality condition (Neyman 1959 ), which ensures fast convergence rate under correctly specified models for treatments (PS) and outcomes (ICEs) and justifies the use of machine learning methods in causal inference (Chernozhukov et al. 2018). We provide the formal theoretical definition in Lemma 1.

2.3 |. Ensemble Learning for Time-Varying PS and ICEs

Due to the high dimensionality of the time-varying confounders, which may have potential complex confounding effects in practical applications, the models for estimating both conditional means and PS could be both incorrect if the machine learning algorithm is arbitrarily chosen. Since various machine learning algorithms can yield different performances under diverse scenarios, ensemble learning offers a more robust and generally more accurate solution. Besides, unlike the PS model, a compatible parametric model for iterative conditional mean may not be available in MSM under a generic setting (Babino et al. 2019). In response to these challenges, we introduce a more flexible and computationally powerful ensemble learning-based procedure for the estimation of PS and ICEs.

Ensemble procedure:

Ensemble learning is a technique that combines several models to achieve improved generalization performance (Ganaie et al. 2022). Let M1 denote a set of candidate machine learning algorithms (e.g., logistic regression, Random Forest, and gradient boosting) used in the ensemble learning procedure. The estimates of PS for the M1 candidate algorithms are πt(1),…,π^tM1, where t=1,…,T denotes the timepoints. Similarly, we define η^t(1),…,η^tM2 as the fitted models of the ICEs for M2 candidate algorithms. Given all fitted models (for details, see the estimation procedure in Model Fitting), we aggregate them using the following weighted estimators:

π^EnL,ta¯t=gEnL,t−1∑m1=1M1ωm1(1)ℏtm1a¯tη^EnL,ta¯t=∑m2=1M2ω^m2(2)η^tm2a¯t, (6)

where ω^(1) and ω^(2) are the weights of the ensemble model for the PS and iterative conditional means, respectively. The function gEnL,t−1(⋅) bounds the weighted sum between [0,1] (e.g., using the logit function). The weights can be determined by minimizing selected metrics that quantify the dissimilarity between the estimates and the data. For example, we can use the coefficients from logistic and linear regressions as weights to combine the candidate estimates.

We further adopt a cross-fitting approach to avoid the potential overfitting issue associated with the ensemble learning procedure (Chen et al. 2025; Chernozhukov et al. 2018). First, we split the data into training and testing data sets. Throughout the model building procedure, we train the base models using training data while constructing the ensemble models by leveraging testing data. We then repeat the model building procedure by exchanging the roles of training and testing data sets. Last, we estimate the parameter of interest (ATE) by solving:

EtsΨθ,η^tr,π^tr+EtrΨθ,η^ts,π^ts=0, (7)

where Ψ(θ,η,π)=S0+S1+S2 is the score function as defined in (4). η^tr,π^tr and η^ts, π^ts are nuisance parameter models estimated based upon training and testing data, respectively. Ets, Etr denote the expectations for testing and training data.

Model fitting:

We remark here that learning iterative conditional means requires nontrivial effort. Unlike PS, where compatible models can be specified by T models as in (1) over the time course, the ICE procedure relies on a sequence of predicted values of ηtt=1T. Identifying a unified compatible model for this sequence is not straightforward in general (Babino et al. 2019). To alleviate this issue, we further extend the ensemble learning approach to facilitate sequential predictions, without imposing a unified model across the time course. As illustrated in (3), our goal is to estimate ηta¯T,z¯t, t=1,…,T within a specific combination of

ALGORITHM 1 |.

MASE

Input data D
Split data into Dtr, Dts
Propensity Score Step
for t from T to 1 do
Estimate πt in (1) by:
Tune the candidate base models ℏtm1, m1=1,…,M1
using Dtr
 Build ensemble model π^EnL,t,tr as in (6) using Dts
Swap Dts as training and Dtr as testing and repeat (1) – (2), let π^EnL,t,ts be the trained ensemble model
end for
ICE Step
For ∀j=1,…,q:
Estimate ηT with the similar procedure as in Propensity
Score Step, define η^EnL,T,tr as the ensemble model built by
using Dtr as training; η^EnL,T,ts as the ensemble model built by
using Dts as training
for t from T−1 to 1 do
 (I) For training data Dtr, predict
η^EnL,t+1,tsAT,…,At+1∈A¯t+1,at,…,a1,z¯t+1
 (II) For testing data Dts, predict
η^EnL,t+1,trAT,…,At+1∈A¯t+1,at,…,a1,z¯t+1
 (III) Let η^EnL,t+1=η^EnL,t+1,ts,η^EnL,t+1,tr be the outcomes, build η^EnL,t,tr with (6) with
Dtr as training; and η^EnL,t,ts with Dts as training
end for
Solve Equation (7) using the models fitted above for θ^ATE
return θ^ATE

treatments a¯T with:

ηtAT,…,At∈A¯t,At−1=at−1,…,A1=a1,z¯t, (8)

where A¯t=⊗k=tT{0,1}k represents all possible combination of {0, 1} treatment regimes from timepoint t to T. Consequently, we have 2T−t+1 predictions for (8). For the cross-fitting procedure of 𝜂’s, we estimate the sequences of (8) on training and testing separately. Specifically, for each time point, we construct the models for 𝜂’s based on training data, and then apply the estimated 𝜂’s to predict (8) for testing data. We then repeat this procedure by exchanging training and testing data set and iteratively construct 𝜂’s as in (3). In each iteration, we predict ηt+1AT,…,At+1∈A¯t+1,At=at,…,A1=a1,z¯t+1  as the outcome for the next iteration to estimate ηta¯T,z¯t. The nuisance parameters related to 𝜂’s in (5) can be straightforwardly estimated using η^t(⋅) at each timepoint t. Lastly, we follow the aforementioned cross-fitting procedure to estimate the ATEs. We summarize the above procedure in Algorithm 1 with illustration in Figure 2. The split of counterfactual outcomes distinguishes our method with Super Learner method (van der Laan et al. 2007) and aligns with the theoretical results in Bodory et al. (2022).

FIGURE 2 |.

FIGURE 2 |

Overview of MASE: the left top box is the procedure for estimating propensity scores (PS), the right box is the procedure for estimating the outcome regressions (ICE); The left bottom box is the illustration of estimating the ATE θ^. We illustrate the stratification estimate for ICE within the right box (orange box).

Theoretical results:

In Lemma 1, we show that our estimating equation satisfy the Neyman Orthogonality condition (Neyman 1959). This lemma implies that our proposed framework is robust to nuisance parameter estimation, and validates the use of machine learning in our framework with valid inference results (Chernozhukov et al. 2017). The proof is provided in the Supporting Information Section A.

Lemma 1.

Let ηt*, πt* be the true values of ηt, πt, t=1, 2 . Suppose T is a convex set such that (η,π)∈T and TN is a nuisance realization set which the estimators of nuisance parameters take values in this set with high probability. Assume the score function Ψ(θ,η,π)=S0+S1+S2 is measurable with Borel σ-fields for θ and (η,π) . Then, Ψ(θ,η,π)satisfies

  1. EΨθ,η*,π*=0

  2. ∂∂rEΨθ,η*,π*+rδη,δπ exists for all r ε [0,1)

  3. ∂∂rr=0EΨθ,η*,π*+rδη,δπ=0

with respect to nuisance realization set TN⊂T, where δη=η−η*, δπ=π−π*.

Following Chernozhukov et al. (2018, 2017), we derive the statistical inference procedure for MASE. We first calculate the plug-in estimator:

Jn(θ^)=1n∑i=1n∂∂θΨi(θ^,η^,π^)Fn(θ^)=1n∑i=1nΨi(θ^,η^,π)Ψi(θ^,η^,π)TVn(θ^)=Jn(θ^)−1Fn(θ^)Jn(θ^)−1T. (9)

Then, the (1−α)×100 confidence interval can be calculated by

CI:=θ^ATE±Φ−1(1−α/2)σ^ATE/n, (10)

with σ^ATE2=∑i=2T+1vn,ii+2∑i=2<j∑j=2T+1vn,ij, where vn,ij, i, j=1,…,T+1 are the {i,j}th element in Vn(θ^) matrix. η^ and π^ are the ensemble learning estimated nuisance parameters from combining the estimates for training and testing data sets.

3 |. Results

We applied MASE to the ABCD study to investigate the effect of sleep insufficiency on cognitive development in adolescents. The exposure variable was adolescent sleep insufficiency, defined as a binarized measure of sleeping time with a cutoff of 9 h. The outcomes were cognitive function scores measured at baseline and at two follow-up timepoints during the second and fourth-year visits. The age-corrected measures from the National Institutes of Health (NIH) cognitive toolbox were used, including the Picture Vocabulary Test (picvocab), Flanker Test (flanker), Pattern Comparison Processing Speed Test (pattern), Picture Sequence Memory Test (picture), Oral Reading Recognition Test (reading), and the Crystallized Composite Scores (cryst).

The ABCD data version 5.0 initially recruited 11,868 participants at the first visit, 10,973 at the 2-year follow-up, and 4754 at the 4-year follow-up. Our study includes 7070 participants with comprehensive cognitive function measures at the first two visits. We considered demographic variables including age, sex at birth, race, ethnicity, family income, the youth’s education, parent education, a general latent factor of economic, social, and physiological well-being, a latent factor for youth perceived social support, and a latent factor for perinatal health. In addition, we explored potential confounders from nutrition intake (breakfast and diet nutrition), neighborhood, parent behavior inventory, and genetic data (principle component of genetic ancestry). We selected the confounders using the sure screening method (Fan and Lv 2008) and included those related to both exposures and outcomes. The final list of potential confounders included the seven demographic variables, 104 nutrition variables from breakfast, and eight variables from parent behavior inventory. The list of confounders and baseline demographics were summarized in the Supporting Information Section B.

We implemented the ensemble learning by cross-fitting using candidate algorithms included linear (logistic) regression, elastic net, XGboosting, and Random Forest. The meta learners (ensemble models) employed were simple linear (logistic) regressions. We utilized models from sklearn library in Python 3.9 and tuned basic parameters such as maximum depth, learning rate, and number of estimators for tree models (boosting), as well as penalty parameters for regression-based models (e.g., elastic net).

To avoid potential positivity violation issue, we trimmed the PS to lie within the range of 0.01 and 0.99 (Schomaker et al. 2019). Furthermore, we compared MASE with MSM with PS estimated by logistic regression (MSM-lm), ICE with linear regression (ICE-lm), and longitudinal targeted maximum likelihood combining with super learner (base learners are: linear (logistic) regression, Random Forest, XGboosting, and elastic net). The standard error estimates for MSM-lm and ICE-lm were calculated by bootstrap method, whereas those of MASE and lTMLE were from analytic solutions.

We summarized the long-term effect results for the age-corrected outcomes in Figure 3. The estimated values along with their confidence intervals are in Table 1. We observed significantly negative effects of insufficient sleep on the cognitive development in several measurements. This included the Oral Reading Recog- nition Test (−1. 90[−3.41, −0.39]), the Picture Vocabulary Test (−2.81[−4.11, −1.51]), the Pattern Comparison Processing Speed Test (−2.40[−4.50, −0.30]), and the Crystallized Composite Score (−2.59[−3.98, −1.20]). Notably, the Crystallized Composite Score, which is expected to develop significantly during adolescence (Heaton et al. 2014), showed substantial negative impacts.

FIGURE 3 |.

FIGURE 3 |

Forest plots for long-term effects estimates of insufficient sleep on cognitive development on ABCD data. The reference level is sufficient sleep. Estimates from different methods are represented using different types of points.

TABLE 1 |.

Causal effect estimation (insufficient sleep vs. sufficient sleep) and 95% confidence interval (in parentheses) for age-corrected outcomes in ABCD study.

NIH toolbox
MASE MSM-lm ICE-lm lTMLE
Age-corrected
reading −1.90 −1.58 −2.57 −1.70
[−3.41, −0.39] * [−3.84, 0.69] [−3.76, −1.38] * [−2.82, - 0.57] *
picvocab −2.81 −2.46 −2.80 −1.87
[−4.11, −1.51] * [−4.48, −0.44] * [ −3.84, −1.76] * [−2.86, −0.89] *
picture −1.37 0.23 −2.07 −0.06
[−3.07, 0.32] [−2.13, 2.58] [−3.30, −0.83] * [−1.52, 1.40]
pattern −2.40 −3.48 −2.70 −2.81
[−4.50, −0.30] * [−6.10, −0.86] * [−4.34, −1.06] * [−4.45, −1.18] *
flanker −1.32 −1.27 −1.48 −0.98
[−2.83, 0.19] [−3.30, 0.76] [−2.55, −0.40] * [−2.15, 0.18]
cryst −2.59 −2.27 −3.04 −1.91
[−3.98, −1.20] * [ −4.53, −0.002] * [−4.17, −1.92] * [−2.98, −0.84] *
*

represents the significant CIs.

In summary, our results demonstrate statistically significant (adverse) effects of long-term insufficient sleep on cognitive development. These findings provide insights for developing intervention strategies to address delayed cognitive development. In comparison, MSM has wider confidence intervals. All the other methods performed relatively consistent. As part of the additional sensitivity analyses, we have included the results based on age-uncorrected results and the analysis for three timepoint measurements (for both age-corrected and age-uncorrected). We summarized such results in the Supporting Information Section B. We also checked the positivity assumption with PS calculated using the ensemble methods, there is no severe violation (Supporting Information Section B).

4 |. Simulation

We evaluated the performance of our method and compared it with comparable methods in simulation studies. We generated data sets with various numbers of time-varying confounders (e.g., 50 and 100) and different causal effect sizes. We considered a sample size of n=1000 to mimic our motivation data sets. Without loss of generality, we considered two timepoints T=2.

Specifically, we simulated the data for t=1, 2 by sampling:

Zt~N0,Σtπt∣Z¯t=1+expμπtZ¯t−1At∣Z¯t~BinomialπtYt∣Z¯t,A¯t~NμtA¯t,Z¯t,ΣY, (11)

where Σ1, Σ2∈ℝp×p were covariance matrices for confounders with prespecified correlation structures, and ΣY was the covariance matrix for the outcome; μπ1Z1, μπ2Z2 were the mean structures for PS (line 2); and μ1A¯1,Z¯1, μ2A¯2,Z¯2 were the mean structures for conditional means (line 4). We generated Yit based on the counterfactual outcomes sequence of the treatments form all previous timepoint Ait, Ai(t−1),…,Ai1. For example, for t=2, the outcome would be Yi2=Ai1Ai2Y(1,1)+Ai11−Ai2Y(1,0)+1−Ai1Ai2Y(0,1)+1−Ai11−Ai2Y(0,0).

To reflect the nonlinear effects of the time-varying confounders, we specified μπtZt=sπtZ¯t,γπ1, t=1, 2, where sπtZ¯t,γπt was a nonlinear function. For example, sπt included cosine functions of Z¯t and their inner interactions. Similarly, we set nonlinear functions for μtA¯t,Z¯t=stA¯t,Z¯t,γt, t=1, 2 with a known parameter γt. We repeated each setting for 500 Monte Carlo simulations.

We applied the MASE and various benchmark methods to the simulated data sets and summarized the results in Table 2. The benchmark methods included the MSM with logistic estimated PS (MSM-lm), ICE with linear regression (ICE-lm), and commonly used longitudinal targeted maximum likelihood estimator along with super learner (lTMLE, Lendle et al. 2017; Schomaker et al. 2019). Specifically, we adopted multiple base learners for both MASE and lTMLE, including linear (logistic) regression, XGboosting, Random Forest, and elastic net. The parameter of interest, θ^, can be calculated by contrasting the expected values of counterfactual outcomes between treatments for each simulation iteration. We evaluated the performance using the estimated relative bias, which is calculated as (θ^−θ)/θ, and compared the empirical standard deviation of θ^ with the standard error estimated by MASE. For standard error estimation, analytical estimators were used for MASE and lTMLE, while bootstrap estimates were used for MSM-lm and ICE-lm.

TABLE 2 |.

Results for 500 Monte Carlo simulations. We compared the performance of all methods with sample size 𝑛 = 1000, different dimensions of confoudners (𝑝), and various effect sizes. The estimated SEs are the averages of standard error estimates for the 500 simulations.

p = 50 , Effect size: 5 p = 100 Effect size: 5
Estimation Monte Carlo SD Relative bias Estimated
SE
Estimation Monte Carlo SD Relative bias Estimated
SE

Monte Carlo 5.024 0.049 5.022 0.054
MASE 4.821 0.427 −0.040 0.331 5.221 0.455 −0.040 0.334
ICE-lm 5.959 0.446 0.186 0.425 5.906 0.457 0.176 0.455
MSM-lm 5.673 0.589 0.129 0.736 5.636 0.861 0.122 1.616
ltlme 5.466 0.407 0.088 0.306 5.491 0.406 0.093 0.220
p = 50, Effect size: 3 p = 100 Effect size: 3
Monte Carlo 2.999 0.048 2.987 0.054
MASE 3.199 0.428 0.067 0.374 3.139 0.468 0.051 0.3349
ICE-lm 3.926 0.439 0.309 0.419 3.873 0.450 0.297 0.447
MSM-lm 3.635 0.584 0.212 0.729 3.597 0.818 0.204 1.585
lTMLE 3.415 0.390 0.139 0.299 3.437 0.390 0.151 0.211
p = 50, Effect size: 1 p = 100 Effect size: 1
Monte Carlo 1.152 0.048 1.151 0.053
MASE 1.364 0.397 0.184 0.341 1.467 0.435 0.275 0.390
ICE-lm 2.094 0.429 0.818 0.412 2.036 0.440 0.769 0.440
MSM-lm 1.798 0.572 0.561 0.719 1.730 0.844 0.503 1.569
lTMLE 1.589 0.337 0.379 0.293 1.618 0.368 0.406 0.204

In general, MASE outperformed the competitive methods, exhibiting lower relative bias across all settings. The analytic standard error estimates from our method approximated the Monte Carlo standard deviations, suggesting the validity of the proposed estimate.

5 |. Discussion

We have developed a new tool MASE, to estimate the causal effects of time-varying exposures on multiple outcomes in longitudinal studies in the presence of high-dimensional confounders with complicated confounding mechanism. This method is tailored to handle numerous potential confounders with nonlinear confounding effects by integrating various machine learning algorithms in estimating time-varying PS and ICEs. In addition, we have explored its theoretical properties for validating the use of machine learning and provided a computationally efficient algorithm for implementing MASE. Simulation studies have demonstrated the validity of MASE in terms of less estimation bias compared to existing methods. The proposed time-varying ensemble and cross-fitting procedure in MASE addresses the compatibility issue in the estimation of sequential expectations, thereby improving performance compared to lTMLE.

In our ABCD analysis, the results revealed that sleep insufficiency can lead to aggregated declines in cognitive performances. These findings align more neurobiologically with existing literature (see Beebe 2011) compared to previous findings (Figure 2 in Yang et al. 2022), which suggested that sleep insufficiency “improves” pattern-related cognition by using cross-sectional causal inference tools in the longitudinal ABCD study. Our findings clarify the long-term causal effects of sleep insufficiency on specific cognitive functions, which may further guide effective prevention strategies (e.g., restricting electronic device usage time at night) for modifiable risk factors of jeopardized cognitive function development in youth. Furthermore, our work can be extended to investigate the heterogeneity of treatment effects. A potential consideration is a second-stage machine learning regression method on unentered influence function of potential outcomes (Takatsu et al. 2024). The package for MASE is available at https://github.com/zhuivv/DR-MASE.

Supplementary Material

Supplement.1

Supporting Information

Additional supporting information can be found online in the Supporting Information section.

Supporting Information Supporting Information

Acknowledgments

The data used in the preparation of this article were obtained from the Adolescent Brain Cognitive Development (ABCD) Study, accessible through the NIMH Data Archive (NDA) at https://abcdstudy.org. Chen’s work was supported by the National Institutes of Health Grants R01 AG089377, P30 AG028747, and by the Johns Hopkins Institute for Clinical and Translational Research (ICTR) funded under Grant 1UM1TR004926 from the National Center for Advancing Translational Sciences (NCATS) a component of the National Institutes of Health (NIH), and NIH Roadmap for Medical Research. The content of this paper is solely the responsibility of the authors and do not necessarily represent the official view of the Johns Hopkins ICTR, NCATS, or NIH.

Footnotes

Open Research Badges

This article has earned an Open Data badge for making publicly available the digitally-shareable data necessary to reproduce the reported results. The data is available in the Supporting Information section.

This article has earned an open data badge “Reproducible Research” for making publicly available the code necessary to reproduce the reported results. “The results reported in this article were reproduced partially due to numerical instability.”

Conflicts of Interest

The authors declare no conflicts of interest.

Data Availability Statement

The data that support the findings of this study are available on request from the corresponding author. The data are not publicly available due to privacy or ethical restrictions.

References

  1. Babino L, Rotnitzky A, and Robins J 2019. “Multiple Robust Estimation of Marginal Structural Mean Models for Unconstrained Outcomes.” Biometrics 75, no. 1: 90–99. [DOI] [PubMed] [Google Scholar]
  2. Bang H, and Robins JM 2005. “Doubly Robust Estimation in Missing Data and Causal Inference Models.” Biometrics 61, no. 4: 962–973. [DOI] [PubMed] [Google Scholar]
  3. Beebe DW 2011. “Cognitive, Behavioral, and Functional Consequences of Inadequate Sleep in Children and Adolescents.” Pediatric Clinics 58, no. 3: 649–665. [DOI] [PMC free article] [PubMed] [Google Scholar]
  4. Bodory H, Huber M, and Lafférs L 2022. “Evaluating (Weighted) Dynamic Treatment Effects by Double Machine Learning.” Econometrics Journal 25, no. 3: 628–648. [Google Scholar]
  5. Chen C, Chen S, Ye Z, Shi X, Ma T, and Shardell M 2025. “The Effect of Alcohol Intake on Brain White Matter Microstructural Integrity: A New Causal Inference Framework for Incompltete Phenomic Data.” Journal of the American Statistical Association 1–13. [DOI] [PMC free article] [PubMed] [Google Scholar]
  6. Cheng W, Rolls E, Gong W, et al. 2021. “Sleep Duration, Brain Structure, and Psychiatric and Cognitive Problems in Children.” Molecular Psychiatry 26, no. 8: 3992–4003. [DOI] [PMC free article] [PubMed] [Google Scholar]
  7. Chernozhukov V, Chetverikov D, Demirer M, Duflo E, Hansen C, and Newey W 2017. “Double/Debiased/Neyman Machine Learning of Treatment Effects.” American Economic Review 107, no. 5: 261–265. [Google Scholar]
  8. Chernozhukov V, Chetverikov D, Demirer M, et al. 2018. “Double/Debiased Machine Learning for Treatment and Structural Parameters.” The Econometrics Journal 21, no. 1: C1–C68. [Google Scholar]
  9. De Bruin EJ, van Run C, Staaks J, and Meijer AM 2017. “Effects of Sleep Manipulation on Cognitive Functioning of Adolescents: A Systematic Review.” Sleep Medicine Reviews 32: 45–57. [DOI] [PubMed] [Google Scholar]
  10. Dutil C, Walsh JJ, Featherstone RB, et al. 2018. “Influence of Sleep on Developing Brain Functions and Structures in Children and Adolescents: A Systematic Review.” Sleep Medicine Reviews 42: 184–201. [DOI] [PubMed] [Google Scholar]
  11. Fan J, and Lv J 2008. “Sure Independence Screening for Ultrahigh Dimensional Feature Space.” Journal of the Royal Statistical Society: Series B (Statistical Methodology) 70, no. 5: 849–911. [DOI] [PMC free article] [PubMed] [Google Scholar]
  12. Ganaie MA, Hu M, Malik A, Tanveer M, and Suganthan P 2022. “Ensemble Deep Learning: A Review.” Engineering Applications of Artificial Intelligence 115: 105151. [Google Scholar]
  13. Gruber S, and van der Laan MJ 2010. “A Targeted Maximum Likelihood Estimator of a Causal Effect on a Bounded Continuous Outcome.” International Journal of Biostatistics 6, no. 1: 26. [DOI] [PMC free article] [PubMed] [Google Scholar]
  14. Heaton RK, Akshoomoff N, Tulsky D, et al. 2014. “Reliability and Validity of Composite Scores from the NIH Toolbox Cognition Battery in Adults.” Journal of the International Neuropsychological Society 20, no. 6: 588–598. [DOI] [PMC free article] [PubMed] [Google Scholar]
  15. Hernán MA, and Robins JM 2020. “Causal Inference.”, Springer Nature. [Google Scholar]
  16. Horvitz DG, and Thompson DJ 1952. “A Generalization of Sampling Without Replacement From a Finite Universe.” Journal of the American statistical Association 47, no. 260: 663–685. [Google Scholar]
  17. Kreif N, Tran L, Grieve R, De Stavola B, Tasker RC, and Petersen M 2017. “Estimating the Comparative Effectiveness of Feeding Interventions in the Pediatric Intensive Care Unit: A Demonstration of Longitudinal Targeted Maximum Likelihood Estimation.” American Journal of Epidemiology 186, no. 12: 1370–1379. [DOI] [PMC free article] [PubMed] [Google Scholar]
  18. Künzel SR, Sekhon JS, Bickel PJ, and Yu B 2019. “Metalearners for Estimating Heterogeneous Treatment Effects Using Machine Learning.” Proceedings of the National Academy of Sciences 116, no. 10: 4156–4165. [DOI] [PMC free article] [PubMed] [Google Scholar]
  19. Lendle SD, Schwab J, Petersen ML, and van der Laan MJ 2017. “ltmle: An R Package Implementing Targeted Minimum Loss-Based Estimation for Longitudinal Data.” Journal of Statistical Software 81: 1–21. [Google Scholar]
  20. Neyman J 1959. “Optimal Asymptotic Tests of Composite Statistical Hypotheses.” In Probability and Statistics, 9–1200. John Wiley and Sons. New York. 4. [Google Scholar]
  21. Robins JM 1999. “Testing and Estimation of Direct Effects by Reparameterizing Directed Acyclic Graphs With Structural Nested Models.” In Computation, Causation, and Discovery, 349–405. [Google Scholar]
  22. Robins JM 2000. “Marginal Structural Models Versus Structural Nested Models as Tools for Causal Inference.” In Statistical Models in Epidemiology, the Environment, and Clinical Trials, 95–133. Springer. [Google Scholar]
  23. Robins JM, Hernan MA, and Brumback B 2000. “Marginal Structural Models and Causal Inference in Epidemiology.” Epidemiology 11, no. 5: 550–560. [DOI] [PubMed] [Google Scholar]
  24. Robins JM, Rotnitzky A, and Zhao LP 1994. “Estimation of Regression Coefficients When Some Regressors are not Always Observed.” Journal of the American Statistical Association 89, no. 427: 846–866. [Google Scholar]
  25. Rubi DB. 1973. “Matching to Remove Bias in Observational Studies.” Biometrics 29, no. 1: 159–183. [Google Scholar]
  26. Rubin DB 1980. “Randomization Analysis of Experimental Data: The Fisher Randomization Test Comment.” Journal of the American Statistical Association 75, no. 371: 591–593. [Google Scholar]
  27. Rubin DB 2005. “Causal Inference Using Potential Outcomes: Design, Modeling, Decisions.” Journal of the American Statistical Association 100, no. 469: 322–331. [Google Scholar]
  28. Schomaker M, Luque-Fernandez MA, Leroy V, and Davies M-A 2019. “Using Longitudinal Targeted Maximum Likelihood Estimation in Complex Settings with Dynamic Interventions.” Statistics in Medicine 38, no. 24: 4888–4911. [DOI] [PMC free article] [PubMed] [Google Scholar]
  29. Takatsu K, Levis AW, Kennedy E, Kelz R, and Keele L 2024. “Doubly Robust Machine Learning-Based Estimation Methods for Instrumental Variables With an Application to Surgical Care for Cholecystitis.” Journal of the Royal Statistical Society Series A: Statistics in Society 188, no. 4: 1003–1028. [DOI] [PMC free article] [PubMed] [Google Scholar]
  30. van der Laan MJ, Polley EC, and Hubbard AE 2007. “Super Learner.” Statistical Applications in Genetics and Molecular Biology 6, no. 1: 25. [DOI] [PubMed] [Google Scholar]
  31. van der Laan MJ, and Rose S 2011. Targeted Learning: Causal Inference for Observational and Experimental Data, Vol. 4. Springer. [Google Scholar]
  32. Yang FN, Xie W, and Wang Z 2022. “Effects of Sleep Duration on Neurocognitive Development in Early Adolescents in the USA: A Propensity Score Matched, Longitudinal, Observational Study.” Lancet Child & Adolescent Health 6, no. 10: 705–712. [DOI] [PMC free article] [PubMed] [Google Scholar]
  33. Yang S, Gao C, Zeng D, and Wang X 2023. “Elastic Integrative Analysis of Randomised Trial and Real-World Data for Treatment Heterogeneity Estimation.” Journal of the Royal Statistical Society Series B: Statistical Methodology 85, no. 3: 575–596. [DOI] [PMC free article] [PubMed] [Google Scholar]
  34. Yu Z, and van der Laan M 2006. “Double Robust Estimation in Longitudinal Marginal Structural Models.” Journal of Statistical Planning and Inference 136, no. 3: 1061–1089. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supplement.1

Data Availability Statement

The data that support the findings of this study are available on request from the corresponding author. The data are not publicly available due to privacy or ethical restrictions.

RESOURCES