Temporal Causal Mediation through a Point Process: Direct and Indirect Effects of Healthcare Interventions
Authors: Çağlar Hızlı
S. T. John
Anne Tuulikki Juuti
Tuure Tapani Saarinen
Kirsi Hannele Pietiläinen
Pekka Marttinen
Venue: NeurIPS 2023 poster (2023)
Keywords: Machine learning for healthcare
Causal mediation
Gaussian process
Point Process

Abstract: Deciding on an appropriate intervention requires a causal model of a treatment, the outcome, and potential mediators. Causal mediation analysis lets us distinguish between direct and indirect effects of the intervention, but has mostly been studied in a static setting. In healthcare, data come in the form of complex, irregularly sampled time-series, with dynamic interdependencies between a treatment, outcomes, and mediators across time. Existing approaches to dynamic causal mediation analysis are limited to regular measurement intervals, simple parametric models, and disregard long-range mediator--outcome interactions. To address these limitations, we propose a non-parametric mediator--outcome model where the mediator is assumed to be a temporal point process that interacts with the outcome process. With this model, we estimate the direct and indirect effects of an external intervention on the outcome, showing how each of these affects the whole future trajectory. We demonstrate on semi-synthetic data that our method can accurately estimate direct and indirect effects. On real-world healthcare data, our model infers clinically  meaningful direct and indirect effect trajectories for blood glucose after a surgery.

Temporal Causal Mediation through a Point Process:
Direct and Indirect Effects of Healthcare Interventions
Caglar Hizh"
ST John Dept. of Computer Science
Anne Juuti Helsinki University Hospital and University of Helsinki
Dept. of Computer Science
Aalto University
Aalto University
Tuure Saarinen
Kirsi Pietiläinen
Pekka Marttinen
Helsinki University Hospital and University of Helsinki
Helsinki University Hospital and University of Helsinki
Dept. of Computer Science Aalto University
Abstract
Deciding on an appropriate intervention requires a causal model of a treatment, the outcome, and potential mediators. Causal mediation analysis lets us distinguish be- tween direct and indirect effects of the intervention, but has mostly been studied in a static setting. In healthcare, data come in the form of complex, irregularly sampled time-series, with dynamic interdependencies between a treatment, outcomes, and mediators across time. Existing approaches to dynamic causal mediation analysis are limited to regular measurement intervals, simple parametric models, and disre- gard long-ran range mediator-outcom interactions. To address these limitations, we propose non-parametric
model where the mediator is assumed to be a temporal point process that interacts with the outcome process. With this model, we estimate the direct and indirect effects of an external intervention on the outcome, showing how each of these affects the whole future trajectory. We demonstrate on semi-synthetic data that our method can accurately estimate direct and indirect effects. On real-world healthcare data, our model infers clinically meaningful direct and indirect effect trajectories for blood glucose after a surgery.
Introduction
In healthcare, a key challenge is to design interventions that effectively control a target outcome Vamathevan et al. 2019, Ghassemi al., 2020]. To design an efficient intervention, decision-makers need not only to estimate the total effect of the intervention, but also understand the underlying causal mechanisms driving this effect. To this end, causal mediation analysis decomposes the total effect into: (i) an indirect effect flowing through intermediate variable (mediator). and (ii) a direct effect repre- senting the rest of the effect. The statistical question then to estimate the direct and indirect effects.
As running example, we consider the effect of bariatric surgery (treatment) on meal-blood glucose (mediator-outcome dynamics. In Fig. [ we show how blood glucose changes after the surgery. This change is partly mediated by the changes diet before and after the surgery (alterations meal size and frequency). However, the surgery can also directly impact blood glucose levels (via metabolic processes, regardless of meal size). To efficiently control glucose, we need to estimate to what extent the effect of surgery is due the post-surgery diet (indirect) or other metabolic processes (direct).
Causal mediation has been studied extensively in a static setting with three variables: a treatment A. 2003 Vander
mediator M, and an outcome Y [Robins and Greenland 1992 Pearl 2001 Robins
Weele 2009 Imai et al. 2010alb
Tchetgen and Shpitser
2012 However, as the running example
"Correspondence: caglar hizli0aalto.fii
37th Conference on Neural Information Processing Systems (NcurIPS 2023).

---

PRE-SURGERY
INTERVENTION
POST-SURGERY
8.0
Carb. intake (g). m
Glucose (mmol I
7.0-
0.0-
50.0
30.0
-0.0
5.0
12.0
24.0 Time, 7
T+6.0 T+112.0
T+18.0
T+24.0
Glucose.
Meals,
fn
Figure 1: Comparison of the meal-blood glucose dynamics of one patient for the pre- and post-surgery periods: meals (carbohydrate intake, cyan bars), glucose (black crosses), predicted glucose baseline f (red dashed line) and predicted glucose progression f (blue dashed line). For blood glucose, we see, after the surgery, (i) the baseline fü declines (red dashed line, pre-surgery post-surgery), and (ii) the glucose response of a meal has a steeper rise and a steeper decline (blue peaks, pre-surgery - post-surgery). For meals, we see, after the surgery, the patient eats (i) more frequently and (ii) less carbohydrates (cyan bars, pre-surgery + post-surgery). A relevant research question is: how much of the surgery effect is due the post-surgery diet (indirect) other biological processes (direct)?
illustrates, many real-world healthcare problems dynamic, i.e., the variables evolve over time and are measured at multiple time points, e.g., a patient's state observed through electronic health records Schulam and Saria 2017]. tumour growth under 2017 Bica et al. [0200] Seedat et al., [0022]. and continu- ous monitoring of blood glucose under meal and insulin events [errry et al. 2020 Wyatt et al.! [202]] Hizh ct al. 2023). Hence, instead of observing a single mediator and a single outcome after an inter- vention, in many situations the intervention is followed by (i) sequences of mediators and outcomes that vary over time. To complicate the matters further, these sequences may be complex, e.g., (ii) sparse and urrgullrly-samplle. as in EHR, or (iii) with long-range mediator mediator-outcome outcome dependencies.
(EHR) [Saeed al. 2011 Soleimani al. 2017|
chemotherapy and radiotherapy [Geng et al.
Some existing works have addressed dynamic causal mediation for (i) sequence of mediators and outcomes VanderWeele and Tchetgen Tchetgen) 2017 [in al. 2017 Zheng and van der Laan Vansteelnl et al. Aalen et al.] 2020): however, they are limited to measurements at regular time intervals. Furthermore, they are based on the parametric g-formula [Robins] 1986) and marginal structural models [Robins et al. [2000a). which can handle time-varying confounding but rely on simple linear models. A recent work by Zeng et al. [202T] (Fig. 2a studied causal mediation for (ūi) sparse and irregular longitudinal data, but considered neither (ini) long-range ceddiator-outconee
dependencies nor the interaction between past outcomes and future mediators (-->, Fig. 2cp.
We address these limitations in dynamic causal mediation by introducing a method where both the mediator as well the outcome stochastic processes (as opposed to single variables in the static case). In this setup, we provide the estimated direct and indirect effects as longitudinal counterfactual trajectories, and theoretically, we present causal assumptions required to identify them. We model the mediator sequence as a marked point process (MPP). and the outcome sequence valued stochastic process, building on non- parmmaraecttic model [Hizh al. 2023). This allows for sregularly-sampled measurements of mediator and outcome processes, while capturing non-linear, manggangge interactions between them. Recently, different line of research investigated causal inference for MPPs [Gao et al. 2021 Zhang et al. 2022 Noorbakhsh and Rodriguez) 2022 but they have not considered causal mediation setting. Compared the existing literature (Hizh et al.)
continuous-
2023). our model enables the estimation of the direct and indirect effects separately by incorporating an external intervention that jointly affects both mediator and outcome processes (Fig. vs. Fig 2c
Our contributions are as follows:
Dynamic causal mediation with point process mediator. We generalize the dynamic causal mediation problem by modeling the mediator point process, which can have ran-

---

Outcome
Outcome
Outcome
Mediator
Mediator
Mediator
Time
Time
Time
Intervention
Intervention
Intervention
(a) Direct and indirect effects with non-interacting longitudinal medi- ators Zeng et al. 2021).
(b) Fully-mediated policy effect with interacting point process me- diators [Hizh et al. 2023).
(c) Direct and indirect effects with interacting point process media- tors (Our work).
Figure 2: Comparison of available implementations for dynamic causal mediation. (a) Zeng et al. [202]] studied dynamic causal mediation for a sparse and irregularly sequence; their counterfactual formulation allows for only uni-directional effects from mediator to outcome (--->), while their implementation assumes the effects are instantaneous.
mediator-outcome
(b) Hizh et al.
[2023] considered the long-range interaction between mediator and outcome processes (.... + +....> +>),
but did not allow the intervention to directly affect the outcome. (c) While capturing long-range dependencies, our work allows for an intervention that affects both processes jointly (--+).
dom number of occurrences at random times and complex interactions with the outcome. Fur- thermore, we provide causal assumptions required to identify the direct and indirect effects.
A mediator-outcome model with external intervention. We extend previous non-parametric model for mediators and outcomes [Hzh et al.) 2023) to include an external intervention that affects the joint dynamics of these two processes.
In a real-world experiment, we study in data-driven manner the effect of bariatric surgery for treatment of obesity on blood glucose dynamics, and separately estimate the direct effect from the indirect effect whereby surgery affects blood glucose through changed diet.
2 Dynamic Causal Mediation
In this section, we formulate the dynamic causal mediation problem for a treatment process A, mediator process M and an outcome process Y, and contrast this with the static causal mediation definition for single variables A, .M and Y. Our formulation builds on structural causal models [SCM, Pearl 2009] and an interventionist approach causal mediation [Robins et al. 2022
Structural Causal Model. An ScM M (S, p(U)) of set of variables X [Xx K k=1 is defined as pair of (i) struc-
Y
tural equations S = [X+ = (paap(appaaaaa (Xx). Uv { K and (ii)
[==1 noise distribution U = [U+ 1 p(U) (Pearl 2009 Peters al.] 2017]. The ScM entails an observational distribution
M
M
X p(X). J. To see this, consider sampling noise U ~ p(U) and then performing forward pass through the structural equa- tions S. In the SCM, an intervention do(X, = &x) is defined as an operation that removes the structural equation fx(-.-) corresponding to X2 and sets Xş to the value IR, yielding an interventional distribution p(X do(X, i.)).
(a) Classical.
(b) Interventionist.
Figure 3: Graphical models for causal mediation. Mediation is de- fined in (a) using nested counter- factuals, while in (b) using path- specific treatments A and A.Y.
Interventionist Approach to Causal Mediation. Consider an SCM of treatment A, a mediator M and an outcome Y (Fig. 3a For brevity, we focus on the indirect path, but the same reasoning applies for the direct path. To estimate the indirect effect, we want to intervene only on the indirect path (A-*M+X while keeping the direct path (A (A+Y)) its natural value. To achieve this, we follow an interventionist approach [Robins et al. 2022 We hypothetically duplicate the treatment A into an indirect-path treatment A., and direct-path treatment A.,. v so that each of these affects only its target path (Fig. (3b). For instance, in the Enngery-diet-guune example (rreatment-ment mediator- the indirect-path treatment

---

A-M corresponds to changing only the diet, without changing how the surgery affects blood glucose through other metabolic processes. Using path-speciff interventions, we follow Pearl [000]] and define the natural indirect effect (NTF) as
M = NIE(ā) y 2, -M
2, A,
Ø]. (1)
where we use the short-hand notation for an intervention [āı, āب] = do(A_. A, u2).
and [[, äه] the potential outcome after setting the direct-path treatment (first argument) to á and the indirect-path treatment to 0g. The value Ø means that the corresponding pathwise treatment is set to its natural value, i.e., the value the variable would have attained without our doing any intervention. Hence. the indirect effect is intuitivell defined in Eq. ( as the difference of the outcome Y when the direct-path treatment is fixed Ø while the indirect-path treatment is either or Ø.
The natural direct effect (NDE) is similarly defined as Pearl 2001 Robins et al. 2022
NDE(ā)= = Y y ā, A..M M a] Y = = Y [ā, al Y[, ā], (2)
0,
However, these definitions are limited to the static case with single variables A, M and Y. Hence, they are not applicable as such to complex, real-world dynamics of healthcare data sets, where a treatment typically followed by sequences of irregularly-sampler mediator and outcome measurements.
2.1 Direct and Indirect Effects Stochastic Processes
We extend the static definitions of natural direct and indirect effects by formulating them as stochastic processes. In the following, we assume single patient is observed over a period [0, T7. The formulation trivially generalizes to multiple patients, assuming exchangeability.
For each patient, we define mediator process M and outcome process Y. We assume the treatment A represents a single intervention occurring once at time t, E [0, T7, a surgery. For completeness, we define also the treatment stochastic process A corresponding to binary counting process NA [o, 7] {0, 1} that specifies the pre- and post-intervention periods. The treatment is applied to control outcome of interest over time, e.g. continuously-moniiae
blood glucose, which is defined as the outcome process Y : [0, 7 + IR. We assume the treatment affects the outcome process Y via two separate causal paths, where the indirect path (...>, Fig. 2ch that goes through mediators occurring at non-deterministic times, e.g., meals, is of special interest. Hence, we define this causal path explicitly through the mediator process M [0, T] - N {RU {2)), such that M(T) = (k, m.), where k is the number of occurrences of the mediating event up until time and m the value of the mediator at time т. Occurrences follow a counting process Nas [] - N and values m follow dosage process D [0, 2 + (R U { [0] all the information about the mediator process on the period [0, TJ. At occurrence times, the mediator gets a value m E IR and at other times m = Ø3 The rest of the possible causal paths are not modeled explicitly but instead their effect is jointly represented as the direct path A Y (-->, Fig. 2ch.
such that these two processes contain
We define direct and indirect treatment effects formally analogously to the static case, and assume that the treatment process (T) hypothetically duplicated into the direct-path treatment (T) and the indirect-path treatment (T) [Robins and Richardson 2010 Didelez 2019]. The indirect- path treatment A (7) affects the outcome only through the mediator process M. Similarly, the direct-path treatment A (T) affects the outcome through processes other than the mediator.
In practice, assume that we observe the mediator process M time points: (L)= where &; is the occurrence time of the 7t mediator event and m, the corresponding value. Similarly, we observe the outcome process Y as {tt,, b;)} We observe A(T) as the occurrence of a single treatment event at time ta E [0. In the 'factual' world, treatments A, A., and A.M occur at the same time, i.c., their respective counting processes coincide:
Na(7) = ( ())
1 tn).
For instance, in the surgery ceneery--ie---e diet-blood glucose (reeament-mediator-on starts affect both the diet and the other metabolic processes immediately after it has occurred at time t.. To measure how the surgery affects the blood glucose (indirectly) through diet or (directly) through other metabolic processes, we consider a hypothetical intervention that changes either the diet or the other metabolic processes, but not both at the same time. Formally, we devise these hypothetical interventions that activate only the direct or the indirect causal path by setting treatment times t and t - to distinct values.
example, the surgery

---

Using these hypothetical interventions, we formulate two causal queries to understand how the treatment affects the outcome process direct and indirect casual mechanisms. The natural indirect effect (NIE) is defined as
NIE(fA) = YY, 1 = A = [a] Si, L = M Ø
= =YSi, -
A close comparison with the static case in Eq. 4 reveals that the outcome is here defined stochastic process Ys,, which describes its entire future trajectory; i.c., a sample from this process corresponds to an entire sequence of values representing the continuation of the outcome after the intervention at time la- For example, Eq. (4) can quantify the contribution of the change of diet at time la on the blood glucose progression, while other metabolic processes fixed their natural state, 20 before the surgery. Similarly, we estimate the natural direct effect (NDE) using
NDE((,) Si,
A M in] Y li Ø, A. ia]
= Fu, lo,
(5)
which quantifies the contribution of the changes in other metabolic processes on the blood glucose progression, while the diet fixed at its natural state after the surgery. The total effect of the intervention (ta La] is equal to the sum of the NDE and the NIE:
TE((a) NDE((.) + NIB((a) Y Bay [a] >E, 10,0].
(6)
Causal Assumptions and Identifiability
In this section, first develop a mathematical formulation of the causal assumptions required to identify direct and indirect effect trajectories NDB(fa) and NIE(fa). Under these assumptions, we next represent the causal queries in the form of statistical terms, which we can estimate using outtiee
mediator outcome model. The proofs and further details are presented in Appendix A
To identify the direct, indirect and total effects, make the following Assumptions (A1, A2, A3):
(A1): p(- do(A NA)) p(: = NA),
(A2): A IL M(T) A M,, Her, T E [0, TJ.
(A3): A. II ((7) ,,, T [0,
where Her is the history up to time т. including both mediators and outcomes. (A1) is continuous- time version of the Nuc, (Scullam and Saria 2017]. (A2, A3) ensure that path-specific treatments A.M and A., causally affect only their target path, conditioned on the past. Accordingly, they imply no unobserved confounding between mediator and outcome processes (M, Y). (A1, A2, A3) might not hold in observational studies and they are not statistically testable. We discuss their applicability in the running example in Section 5.1
Cethobserved-Confoundee
assumption for process pairs (A, M)) and (A, Y)
[continuous-iee
For the total effect, need to estimate the trajectories Ys,, Fa, and Ys,, (8,0) Ø). which identifiable under (A1). For direct and indirect effects, we further need to estimate the counterfactual trajectory Y [2, La], i.e., the outcome process under hypothetical intervention, which is identi- fiable under (A1, A2, A3). We consider counterfactual trajectory Ysi, under a paired intervention, e.g. [e, at R ordered query points = {qr ) q. > f.: 12 Eu] = (g [Ø, 1) Provided that (A1, A2, A3) hold, the interventional distribution of the counterfactual trajectory Yg [0 La]
is given by
R-1
Σ Myf.
II 0=0
P(Yam |M (Mgr to = Ø, Hean) ((Mg)-9r-1)l Tor H Hea.):
outcome term
modiator term
where M,i, = - M .- The two terms in Eq. can be estimated by an interacting mediator-outcome
mediator outcome model, discussed in Section In addition, the definitions of the NIE(Fa) and the NDF((.) ( in Eqs. (4) and (5) under single treatment at time T,2 can be extended to direct and indirect effects under sequence of healthcare interventions, if necessary. We further illustrate this extension in Appendix A.3 and provide identifiability analysis in such multiple treatment setups.
5

---

Interacting Mediator-Outcome Model
To model the interacting mediator outcome processes, extend non-parametric model for me- diators and outcomes (Hizh et al. [0233 to include an external intervention that affects the joint dynamics of these processes. Similary, we combine marked point process [MPP, Daley and
Vere-Jones) 2003) and a conditional Gaussian process [GP, Williams and Rasmussen 2006]. For background MPP, GP, and details model definitions, inference and scalability, see Appendix B
Each patient is observed in two regimes: D = (a (0.1). Within each regime {0,
the data set D(a) contains the measurements of mediator M and outcome Y at irregular times:
{(t(") :mm)) ) >= and {(t) .y )) For the full data set D, the joint distribution
(a) (o))))))
plu) ( (ts,
rla)
P(D)= = II cxp((-A (a) aE(0.1)
(ts, mi Her.
II
(ys &g. Hee,)
(8)
mediator intensity
where we denote the conditional intensity function of the mediator MPP by ((a)(t, mi Hee,), and the point process integral term by ((a) =J¹ A() Her) dr.
4.1 Mediator Intensity (0)
The mediator intensity X(t2, my H.rr.) is defined as a combination of the mediator time intensity X(4: Her,,) and the mediator mark or dosage density p(m; lú. Hccr;): X(4i, my H.r.)) = A(4 Her,) (pmm))(( 4,, H.r.). Similar (Hizh al. 2023], model the time intensity A(4i Hcr,) ) as the squared sum of three components {50, Im JoJ. to ensure non-negativity:
A(r HHc)) = Bo
Im (T; go((T:)
Pe
baseline
effect
offect
where m contains past mediators (meal times and sizes) and o contains past outcomes (glucose).
The constant Bo serves basic Poisson process baseline. The mediator-effect function 9m and the outcome-effect function model how the intensity depends on the past mediators and outcomes, respectively. The components Jm and go are time-dependent functions with GP priors: Jm Go GP. The mediator dosage density p(m, t4, Her,) is also modeled with an independent GP prior: mt(t:) GP.
4.2 Outcome Model
We model the outcome process Y sum of three independent functions
(T Her) [0. } as a conditional GP prior, that is, [Schulam and Saria 2017 Hizh et al. 2023
(T Her) fo(T) fm ( (T:m)
Fuy(1
(T)
(10)
baseline
mediator response
noise
where the baseline and the mediator response have GP priors, for f' ~ GP, similar to Hizh et al. 2023], while the noise is sampled independently from zero-mean Gaussian variable uy (T)
(0, o The mediator response function fm models the dependence of the future outcomes on the past mediators. We assume that the effects of nearby mediators simply sum up: (m m) = Ex,, <t (( t4), where fo ~ GP describes a shared shape function and the magnitude of the effect depends on the mark m, through a function ((m4).
5 Experiments
In this section, we validate the ability of our method separate direct and indirect effects of healthcare intervention on interacting mediator-outcomm processes, First, we show that our model can support clinical decision-making in real-world data from randomized controlled trial (RCT) about the effect of gastric bypass surgery (rreatment) on meal-blood glucose seeeiaatoroutccmme dynamics. Second, as the true causal effects are unknown the real-world data, we set up a realistic, semi-synthettc simulation siudy, where we evaluate the performance of our model on two causal tasks: estimating direct and indirect effect trajectories. Our implementation and code to reproduce the study can be found at https: //gi //gtttub.... com/ com/caglar www.hiiihhhhcc wwwpii/yyaamiiioaaeea causal-mediation

---

5.1
Weal-World Study
We first show on data from a real-world RCT [Saarinen et al. 2019 Ashrah et al. [021] that our model can learn
direct and indirect effects of bariatric surgery on blood glucose, by analyzing how surgery affects glucose through changed diet (indirectly) or other metabolic processes (directly). For further details, see Appendix C
Dataset. For 15 nondiabetic obesity patients (body mass index, BMT 2 35 kg/mm undergoing gastric bypass surgery, a continuous-monitoring monitoring device measured the blood glucose of each patient at 15-minute intervals. Patients recorded their meals in food diary, and the nutrient information was processed into total carbohydrates (sugar + starch) for each meal. Data was collected over two 3-day long periods: (i) pre-surgery and (ii) post-surgery.
Causal Assumptions. Assumption (A1) implies a treatment that is non -on-informative. The surgery does not depend patient characteristics (each patient undergoes the surgery), therefore (A1) holds. If this was not the case, we could have used a debiasing method such as inverse probability treatment weighting [Robins et al. 2000a]. Assumptions (A2, A3) imply that (i) path-specific treatments A.M and A A affect only their target path and (ii) there is no unobserved confounding between mediators and outcomes. They do not exactly hold in the study. For (i), one way to realize A.M M is a dietary intervention that only changes the diet; however, it might not be possible to change the rest of the metabolic processes through A. without affecting the diet. For (ii), demographic factors such as age, gender, body weight, and height could be potential confounder variables that could bias the estimation of surgery effects. Moreover, there can be unobserved processes such as exercising habits that affect both meals and blood glucose, even though the impact of confounders other than meals on blood glucose is likely modest for nondiabetics, since blood glucose is known to be relatively stable between meals [Asrali et al. 202T].
5.1.1 Bariatric Surgery Regulates Glucose Through Meals and Other Metabolic Processes
To visualize the effect of the surgery on meal-blood glucose dynamics, we show 1- day long meal-gh ggalool measurements for one patient together with predicted glu- cose trajectories from our outcome model in both pre- and post-surgery periods in Fig. D For blood glucose, we see, after the surgery, (i) the baseline declines, and (ii) a meal produces a faster rise and decline. For meals, see, after the surgery, the patient cats (i) more frequently and (ii) less carbohydrate per meal.
Pre sur gery
Post surgery
Glocose [mmedd (0.
40
00
133
16.6
30.
61
12.3 Time (hours)
18.0
24
Time (hours).
&.K..
(a) Baseline progression.
Pre surgeyy
What only metabolion benaves
Crrb inble (x), m
Clocos (mond)) lt).
lkk surgory?
5.1.2 Direct and Indirect Effects of the Surgery on Meal Response Curves
We compare the predicted glucose base- line fo and the predicted meal response S' for all patients in Fig. 4 In Fig. [4a
What if only the pebistt eats
P sur
Carb. intake (6) m
Glocosa (mwne) (0.
posi surgery?
after the surgery, the glucose baseline de-
clines in agreement with previous findings
[Dirksen et al.) [012 Jacobsen et al., 2013].
In Fig. 4b) we see meal responses corre- sponding to four hypothetical scenarios. In the upper-left, we predict a typical pre- surgery meal response and highlight the area under this curve by shaded grey. In the upper-right, we predict the hypothet- ical meal response by considering only the surgical effect on metabolism, while keep- ing the diet in its natural pre-surgery state. Here, the meal response increases to a higher peak and declines back to the baseline faster than the shaded pre-surgery response, as previously described
Time (hours).
Time (hours),
f-1 T fa T.
Ara under J. [|0.0]
& (1A
(b) Meal response functions.
Figure 4: Pre- vs. post-surgery predicted glucose pro-
gressions: (a) Baseline, (b) Meal response.
7

---

2014]. Moreover, the response model captures the decline under the baseline around 2h after a meal and correction afterwards, which is clinically- meaningful estimation suggesting overshooting of the glucose lowering due to the higher secretion of insulin after the surgery [Jacobsen et al. 2013 Bojsen-Moller et al. 2014]. In the lower-left, we predict the hypothetical meal response if patients only followed the post-surgery diet, while their metabolism would be fixed in its natural pre-surgery state. Here, the meal response increases to a lower peak due to a lower carbohydrate intake, while the shape of the response is preserved. In the lower-right, we predict a typical post-surgery response, which increases to a lower peak due to lower carbohydrate intake and declines back to the baseline faster compared to the pre-surgery response due to the high insulin levels.
Dacobsen et al. 2013 Bojsen- Moleer et al.
5.1.3 Surgery Leads to Shorter Meal Intervals and Less Carbohydrate Intake
We compare meal data and predictions from the mediator model between the pre- and post-surgery periods in Fig. 5 The surgery leads to more regular, low-carb diet due to the pust-surgery dietary advice, a reduction in the stomach size, and an increase in appetite-
gut hormone levels [Dirksen et al.) 2012 Laferrère and Pattou 2018]. In Fig. Sai we see that the surgery leads to more peaky, unimodal distribution for the next meal time, compared to the multimodal pre-surgery distribution. The average time interval until the next meal decreases from 3.161 h to 2.41 h. In Fig. 5b we see that the post-surgery carbohydrate intake is more concentrated around the mean. The median per-meal carbohydrate intake decreases from 29.13 g 11.94g. g.
5.1.4 Would intervening on the mediator (diet) suffice to regularize glucose progression?
As shown in Figs. and 5 the surgery affects glycemia through changing the diet (indirect) and other biological processes (di- rect). Then, a relevant research question is how much of the surgery effect can be at- tributed to the changed dier?
Pre sirgery
(Pre-singrry
Densft
This question is crucial in assessing whether surgery affects blood glucose levels inde- pendently of dietary changes. If confirmed, it implies that surgery can influence blood glucose through two mechanisms: control- ling meal size and independent hormonal changes. Additionally, surgery can also in- duce too low glucose levels (hypoglycemia), if the glucose peak after the meal induces too high insulin secretion [Lee et al. (0166).
Deasity
Deniit
Past-sergery
Pust-wurgery
53
Nost Meal Time Ae (hours)
Carb
intake pir meod m. (lig gramss
Pre A1
Pro- Postrior Xos
Pern Pho Postaror Kos
Par- 26
Pork Postanor Kisk
Pore Poet Postencr foreror Kon
(a) Next meal arrival time.
(b) Carbohydrate intake.
Figure 5: Pre- vs. post-surgery data (histograms) and model posterior (kernel density estimate, dashed) for (a) next meal time and (b) (log) carbohydrate intake.
To measure the contribution of direct and indirect causal paths, we use two metrics: (i) the percentage time spent in hypoglycemia (HG) %T.. = (t : y(t)= S 3.9 mmol/1)/T, and (ii) the percentage time spent in above- normal-glycemia (ANG) %TANN = {l v(( > 5.6 mmol/11// /T. We estimate di- rect, indirect and total effects on %T Ho and ZTANG. as in Eqs. to 66). We show the results in Table I In the empirical data, %TiG increased 27.5 points, while %T ANG decreased 27.0 points. For the estimation of direct and indirect effects, we train our joint model on the RCT data set and use samples from the posterior to obtain a Monte Carlo approximation. The results suggest that the contribution of the changed diet (indirect, NIE) to the total effect in %THO and %TANa is much smaller compared to other metabolic processes (direct, NDE). Our computational exploration of these effects from observational data is supported empirically by Laferrère et al. 20088, who study the effects of two
Table I: NDE, NIE and TE results for % time spent in hypoglycemia %T and in above- normal-glycemee ATANG, to investigate how much of the surgery effect can be attributed to changed diet?
DATA TYPE
CAUSAL EFFECT
A%Tite
A A
Empirical data TE
+27.5
-27.0
TE
+24.4
-28.0 + 0.5
Simulation
NDB
+24.7 0.2
0.5
NIE
-0.3 0.2
1.3
8

---

Table 2: Mean squared error (MSE, mean + std.dev. across 10 runs) for NDE, NIE and TE.
JOINT MODEL
MODEL COMPONENTS
CAUSAL QUERY (MSE 4)
A
MEDIATOR
RESPONSE
NDE(fa)
NIF(f.)
TE(fa)
M1
Mon-interact, (L15)
Parametric (817)
0.22 = 0.02
0.12 0.01
0.31 + 0.02
M2
Non-interact. (L15)
Nou-param (H22)
0.04 0.00
0.15 0.01
0.16
M3
Interacting (H22)
Parametrie (S17)
0.23 = 0.02
0.11
0.00
Z21-1
Interacting (H22)
Parametric (721)
0.07 0.00
0.09 0.01
0.16 0.01
Z21-2
ORAClE
Parametric (721)
0.07 0.00
+00000000
H22
Interacting (H222
Non-param. (H22)
1.14
Our
Interacting (H22)
Non- Non-param. (H22)
0.02 + 0.00
0.09 + 0.01
0.10 - 0.01
different interventions - namely, dietary changes and surgical procedures - on individuals who had lost equal amounts of weight. In the study, the blood glucose response to fixed carbohydrate meal shows a more pronounced decline in the surgery group compared to the control group. Because all patients received the same meal, this decline corresponds the direct effect. This direct effect can be attributed to a range of intricate hormonal influences, including the involvement of gut hormones like GLP-1, alongside heightened insulin peaks subsequent to surgical intervention.
5.2 Semi-Synthetic Simulation Study
In this section, we up semi-synthetic simulation study evaluate the proposed method two causal tasks: estimating (i) natural direct effect (NDE) and (ii) natural indirect effect (NIE). For further details and additional results on sensitivity analysis, see Appendices C.2 and D
Simulator. We train our joint model on the real-world RCT data set, and then use the learned model as the ground-truth meal-blood glucose simulator. One joint model is learned for each of the pre- and post-surgery periods. For the meal simulator, we use a mediator model learned on all patients. For the glucose simulator, use outcome model Iearned subset of three patients with distinct baselines and meal response functions to enable individualization between synthetic patients.
Semi-synthetic dataset. We use the ground-truth simulators to sample meal- glacose trajectories for 50 synthetic patients. As in the RCT Section [5.1 we assume each patient undergoes the surgery in the semi-synthetie scenario while being observed in pre- and post-surgery periods. For the training set, we sample 1-day long trajectories for pre- and post-surgery periods. For the test set, we sample three interventional trajectories for each patient for the subsequent 1-day, corresponding to three interventional distributions resulting from the following interventions: { 2) [2, Ln), [ [=]]- Then, the ground-truth NIE and NDE trajectories are calculated as in Eqs. and (5). respectively.
Benchmarks. We compare methods with respect their abilities in (i) allowing for an external intervention that jointly affects mediator and outcome processes, and (ii) capturing non-linear, long-range dependencies between these processes. For (i), we add benchmark model [H22, Hizh et al. 2023 that excludes the direct arrows from the treatment to the outcomes (A-Y).. For (ii),
we combine different interacting/non-intee interrrcctinnn mediator models and parametrricnoonparaaae response functions to obtain baseline methods that include the direct arrows (A->Y The methods
Z21-1 and Z21-2 are named after a longitudinal causal mediation method (Zeng et al. 2021
with linear, instantaneous effects from mediator to outcome [Parametric (721, 7Zen et al. (Fig. 2a). Additionally, we include a parametric response [Parametric (S17), Schulam and Saria 2017
202T
(M1, M3), and non-paraectric response (Non-parametric (H22), Hizh et al. 2023 (M2). The non- interacting mediator model is chosen as a hhistry-inndepedeeee
hot-homoogeouus Poisson process
[Non-interacting (L15), [loyd al. 2015 (M1, M2), while the interacting mediator model is chosen as a history-dependent, non-parametric point process model [Interacting (1122), Hizh et al.) 2023 (M3, Z21-1). In the joint model Z21-2, further combine the parametric response model by Zeng et al.
2021 (Parametric (221) with the ground-truth (ORACLE) mediator sequence.
Metric. On the test set, we report the mean squared error (MSE) between ground-truth and estimated trajectories. To sample comparable glucose trajectories, three interventional trajectories are simulated
with fixed noise variables for meal (point process) sampling for all methods, as in Hizh et al. 2023

---

Results. MSE results are shown in Table For the natural direct effect, formalized as NDE(fa) Yi, I,,,, foy- [2t, fa]. we answer the causal query: How differently will the glucose progress if we change only the metabolic processes other than the diet, while keeping the diet at its natural post-surgery value? We see that our joint model performs the best compared to the other methods. The models with the non-parametric response produce better NDE trajectories than the models with the parametric response, which fail to capture the glucose baseline and the meal response well. For the natural indirect effect, formalized as (fE(fa) Y [e, fa] Yi. [2, 0. we answer the causal query: How will the glucose progress if we change only the diet, while keeping the rest of the metabolic processes at their natural pre-surgery state? The oracle model Z21-2 that directly uses the mediator sequences sampled from the ground-truth simulator performs better than other methods. Our joint model performs better than the other methods that predict the mediator sequence, and performs the same compared to the model 221-1 which also uses the interacting mediator model. In contrast to the NDE results, the performance on the NIE improves with respect to the expressiveness of the mediator model, e.g. models with the interacting point process (M3, Z21-1, Our) perform better than the models with the non-interacting mediator (M1, M2). Similarly, the oracle model that has access to the ground-trutt mediator sequences performs the best. For the total effect, formalized as TE(fa) = Ysi, Fo. da] Yi, [2, Ø]. our joint model performs similar to the model Z21-2 that has access to the ground ground-truth mediators, while performing better than all the rest.
6 Limitations and Future Work
As required for causal inference, our identifiability result relies on causal assumptions, which may not hold in observational study and are statistically testable. For example, our assumption that there are no unobserved confounders between the mediator and outcome processes may not hold. To understand the sensitivity to this assumption, we performed additional preliminary analysis in Appendix [D which can be refined in future work by extending the sensitivity analysis methods used in the static setting [Robins et al., 2000b]. In addition, our method relies on a hypothetical division of a treatment into path-specific treatments which solely affect the variables in their own path. This may not be possible in reality, e.g., it not trivial to come up with treatment that changes all the other metabolic processes without affecting the diet in our surgery -iier blood glucose example.
In our real-world application, we focus on the dynamic causal mediation problem where the sequence of meals is the mediator of the effect of surgery on blood glucose. In this definition, the rest of the metabolic processes, e.g., gut hormones, weight loss, hepatic insulin sensitivity, any other mediator through which the surgery could affect blood glucose, are included in the direct effect. An extension multiple mediators and an explicit quantification of the corresponding path-specific effects will be an interesting future direction, especially from a medical point of view. In the semi-synthetic study, our joint model matches the functional class of the simulator; in future work, it would be valuable to further analyze the effect of model misspecification.
From modeling perspective, the main limitation is scalability of the outcome model to larger number of data points (see Appendix [B.5]o for details). This can be improved using separate sets of inducing points for the baseline function and the treatment response function. Alternatively, the GP models describing the components of our joint distribution (Fq. (8) could be replaced by other model classes (e.g., neural networks). Our dynamic causal mediation framework does not put any fundamental limitations on the dimensionality of mediators or outcome.
7 Conclusion
We investigated temporal causal mediation in complex healthcare time-series by defining direct and indirect effects as stochastic processes instead of static random variables. Theoretically, we provided causal assumptions required for identifiability. To estimate the effects, we proposed non-parametric mediator outcome outcome sequences, while capturing time-delayed interactions between them. Despite the limitations, in real-world study about the effect of bariatric surgery on meal-blood glucose dynamics, our method identified can be used for gaining insights from observational data without tedious or expensive experiments and supports its use for generating novel, testable research hypotheses. We believe that our method can lead to insightful analyses also in other domains such as epidemiology, public policy, and beyond.
-ottcomee model that allows for an external intervention jointly affecting mediator and
direct and indirect effects. This demonstrates how the model
10

---

References
Odd O Aalen, Mats J Stensrud, Vanessa Didelez, Rhian Daniel, Kjetil Røysland, and Susanne Strohmaier. l'meeddpendent mediators in survival analysis: modeling direct and indirect effects with the additive hazards model. Biometrical Journal, 62(3):532-555 220222--4,-4 2020.
Reza Ashrafi, Aila Ahola, Milla Breengärd-Bärlunde Tuure Saarinen, Sini Heinonen, Anne Juuti, Pekka Marttinen, and Kirsi H Pietiläinen. Computational modelling of self-reported dietary carbohydrate intake on glucose concentrations in patients undergoing Roux-en- Y gastric bypass versus one-anastomosis gastric bypass. Annals of Medicine, 53(1): 111188881955 2021.
Sarah E Berry, Ana M Valdes, David A Drew, Francesco Asnicar, Mohsen Mazidi, Jonathan Wolf, Joan Capdevila, George Hadjigeorgiou, Richard Davies, Haya Al Khatib, et al. Human postprandial responses to food and potential for precision nutrition. Nature Medicine, 26(6): 2020.
Ioana Bica, Ahmed M Alaa, James Jordon, and Mihaela der Schaar. Estimating counterfactual treatment outcomes over time through adversarially balanced representations. In International Conference Learning Representations (ICLR), 2020.
Kirstine N. Bojsen-Møller, Carsten Dirksen, Nils B. Jørgensen, Siv H. Jacobsen, Annette K. Serup, Peter H. Albers, Dorte L. Hansen, Dorte Worm, Lars Naver, Viggo B. Kristiansen, Jørgen F.P. Wojtaszewski, Bente Kiens, Jens Holst, Erik Richter, and Sten Madsbad. Early enhancements of hepatic and later of peripheral insulin sensitivity combined with increased postprandial insulin secretion contribute to improved glycemic control after Roux-en-Y gastrie bypass. Diabetes, 63 (5):1725-1737, 2014.
Bob Carpenter, Andrew Gelman, Matthew D Hoffman, Daniel Lee, Ben Goodrich, Michael Be- tancourt, Marcus Brubaker, Jiqiang Guo, Peter Li, and Allen Riddell. Stan: A probabilistic programming language. Journal of Statistical Software, 76(1), 2017.
Li-Fang Cheng, Bianca Dumitraseu, Michael Zhang, Corey Chivers, Michael Draugelis, Kai Li, and Barbara Engelhardt. Patient-specific effects of medication using latent force models with Gaussian processes. In Artificial Intelligence and Statistics (AISTATS), 2020.
John Cunningham, Zoubin Ghahramani, and Carl Rasmussen. Gaussian processes for time-marked time-series data. In Artificial Intelligence and Statistics (AISTATS), 2012.
Daryl Daley and David Vere-Jones. An introduction to the theory of point processes: volume I: elementary theory and methods. Springer, 2003.
Vanessa Didelez. Asymmetric separation for local independence graphs. Uncertainty in Artificial Intelligence (UAI), 2006.
Vanessa Didelez. Graphical models for marked point processes based local independence. Journal of the Royal Statistical Society: Series B (Statistical Methodology). 70(1):245-264, 2008. 2008.
Vanessa Didelez. Causal reasoning for events in continuous time: A decision-theorrete approach. In Workshop on Advances Causal Inference, Uncertainty in Artificial Intelligence (UAI 2015), volume 1504 of CEUR Workshop Proceedings, pages 40 40-45, CEUR- CEUR-WS.org, 2015.
Vanessa Didelez. Defining causal mediation with longitudinal mediator and a survival outcome. Lifetime Data Analysis, 25:593-610, 2019.
C Dirksen, NB Jørgensen, KN Bojsen-Mølles SH Jacobsen, DL Hansen, D Worm, JJ Holst, and Madshad. Mechanisms of improved glycaemic control after Roux-en-Y gastric bypass. Dia- betologia, 55:1890-1901, 2012.
Tian Gao, Dharmashankar Subramanian, Debarun Bhattacharjya, Xiao Shou, Nicholas Mattei, and Kristin Bennett. Causal inference for event pairs in multivariate point processes. Advances in Neural Information Processing Systems, 34:173 1-11234,1 2021.
Changran Geng, Harald Paganetti, and Clemens Grassberger. Prediction of treatment response for combined chemo-and radiation therapy for non-small cell lung cancer patients using a bio- mathematical model. Scientific Reports, 7(1::3354, 2017.

---

Marzyeh Ghassemi, Tristan Naumann, Peter Schulam, Andrew L Beam, Irene Y Chen, and Rajesh Ranganath. A review of challenges and opportunities in machine learning for health. AMIA Summits on Translational Science Proceedings, 2020:191 1910 2020.
Clive WJ Granger. Investigating causal relations by econometric models and cross-spectral methods. Econometrica: Journal of the Econometric Society, pages 424 1969.
James Hensman, Alexander G. de G. Matthews, and Zoubin Ghahramani. Scalable variational Gaussian process classification. In Artificial Intelligence and Statistics (AISTATS), 2015.
Çağlar HIzh, S. T. John, Anne Tuulikki Juuti, Tuure Tapani Saarinen, Kirsi Hannele Pietiläinen, and Pekka Marttinen. Causal modeling policy interventions from treatment-outcome sequences. In International Conference on Machine Learning (ICML., 2023.
Kosuke Imai, Luke Keele, and Dustin Tingley. A general approach to causal mediation analysis. Psychological Methods, 15(4)300, 2010a.
Kosuke Imai, Luke Keele, and Teppei Yamamoto. Identification, inference and sensitivity analysis for causal mediation effects. Statistical Science, 25(1):51 - -71, 2010b.
Siv H Jacohsen, Kirstine N Bojsen-Moller, Carsten Dirksen, Nils B Jørgensen, Trine R Clausen, Birgitte S Wulff, Viggo B Kristiansen, Dorte Worm, Dorte Hansen, Jens Holst, et al. Effects of gastric bypass surgery on glucose absorption and metabolism during a mixed meal in glucose- tolerant individuals. Diabetologia, 56:2250-2225 2013.
Blandine Laferrère and François Pattou. Weight-independent mechanisms of glucose control after Roux-en-Y gastric bypass. Frontiers in Endocrinology, 9:530, 2018
Blandine Laferrère, Julio Teixeira, James McGinty, Hao Tran, Joseph R. Egger, Antonia Colarusso, Betty Kovack, Baani Bawa, Ninan Koshy, Hongchan Lee, Kimberly Yapp. and Blanca Olivan. Effect of weight loss by gastric bypass surgery versus hypocaloric diet on glucose and incretin levels in patients with type 2 diabetes. The Journal of Clinical Endocrinology & Metabolism, 93 (7):2479-244) 2425,, 2008.
Clare J Lee. G Craig Wood, Mariana Lazo, Todd T Brown, Jeanne M Clark, Christopher Still, and Peter Benotti. Risk of post-gastric bypass surgery hypoglycemia in nondiabetic individuals: single center experience. Obesity, 24(6): 13000::3322113133 1348. 2016.
Sheng-Hsuue Lin, Jessica Young, Roger Logan, Eric J Tchetgen Tchetgen, and Tyler J VanderWeele. Parametric mediational g-formula approach to mediation analysis with time-varying exposures, mediators, and confounders. Epidemiology, 28(2):266, 2017.
Siqi Liu and Milos Hauskrecht. Nonparametric regressive point processes based on conditional Gaussian processes. In Advances Neural Information Processing Systems (NeurIPS), 2019.
Chris Lloyd, Tom Gunter, Michael Osborne, and Stephen Roberts. Variational inference for Gaussian process modulated Poisson processes. In International Conference Machine Learning (ICML), 2015.
Alexander de Matthews, Mark Van Der Wilk, Tom Nickson, Keisuke Fujii, Alexis Boukouvalas, Pablo León- Villagig, Zoubin Ghahramani, and James Hensman. GPflow: A Gaussian process library using TensorFlow. The Journal of Machine Learning Research, 18(40): 2017.
Kimia Noorbakhsh and Manuel Rodriguez. Counterfactual temporal point processes. Advances in Neural Information Processing Systems, 35:24810 00:24810-2455 0-82222, 2022.
Judea Pearl. Direct and indirect effects. In Uncertainty in Artificial Intelligence (UAI), 2001.
Judea Pearl. Causality. Cambridge University Press, 2009.
Judea Pearl. Interpretation and identification of causal mediation. Psychological methods, 19(4):459, 2014.
Jonas Peters, Dominik Janzing, and Bernhard Schölkopf. Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017.
12

---

Joaquin Quiñonero Candela and Carl Edward Rasmussen. A unifying view of sparse approximate Gaussian process regression. The Journal of Machine Learning Research, 6:1939-1959, 2005.
Jakob Gulddahl Rasmussen. Temporal point processes: the conditional intensity function. arXiv preprint arXiv:/806.0022) 2011.
James Robins. A new approach to causal inference in mortality studies with a sustained exposure period control of the healthy worker survivor effect. Mathematical Modelling, (9-12):1393-1512, 1986.
James M Robins. Semantics of causal DAG models and the identification of direct and indirect effects. Oxford Statistical Science Series, pages 70-82, 2003.
James M Robins and Sander Greenland. Identifiability and exchangeability for direct and indirect effects. Epidemiology. (22::1431555 1992.
James M Robins and Thomas S Richardson. Alternative graphical causal models and the identification of direct effects. Causality and Psychopatholoy: Finding the Determinants of Disorders and Their Cures, 84:103-158, 2010.
James M Robins, Miguel Angel Hernan, and Babette Brumback. Marginal structural models and causal inference in epidemiology. Epidemiology, pages 550-560, 2000a.
James M Robins, Andrea Rotnitzky, and Daniel O Scharfstein. Sensitivity analysis for selection bias and unmeasured confounding in missing data and causal inference models. In Statistical models in epidemiology, the environment, and clinical trials, pages 1-94. Springer, 2000b.
James M Robins, Thomas S Richardson, and Ilya Shpitser. An interventionist approach to mediation analysis. In Probabilistic and Causal Inference: The Works of Judea Pearl, pages 713-764. Association for Computing Machinery, 2022.
Robert Rutledge. The mini- mastric bypass: experience with the first 1,274 cases. Obesity surgery, 11 (3):276-280, 2001.
Tuure Saarinen, Sanna Meriläinen, Vesa Koivukangas, Kirsi Hannele Pietiläinen, and Anne Juuti. Prospective randomized controlled trial comparing the efficacy and safety of Roux-en- Y gastric bypass and one- ane-anastomosis gastric bypass (the RYSA trial): trial protocol and interim analysis. Trials, 20(1): 2019.
Mohammed Saeed, Mauricio Villarroel, Andrew T Reisner, Gari Clifford, Li-Wei Lehman, George Moody, Thomas Heldt, Tin H Kyaw, Benjamin Moody, and Roger G Mark. Multiparameter Intelligent Monitoring in Intensive Care (MIMIC-II): public-access intensive care unit database. Critical Care Medicine, 39(5)2522 2011.
Peter Schulam and Suchi Saria. Reliable decision support using counterfactual models, In Advances in Neural Information Processing Systems (NeurIPS), 2017.
Nabeel Seedat, Fergus Imrie, Alexis Bellot, Zhaozhi Qian, and Mihaela van der Schaar. Continuous- time modeling of counterfactual outcomes using neural controlled differential equations. In International Conference on Machine Learning (ICML), 2022.
Hossein Soleimani, Adarsh Subbaswamy, and Suchi Saria. Treatment-response models for coun- terfactual reasoning with continuous-ting time, continuous-valuee interventions. In Uncertainty in Artificial Intelligence (UAI), 2017.
Eric Tchetgen Tchetgen and Ilya Shpitser. Semiparametric theory for causal mediation analysis: efficiency bounds, multiple robustness, and sensitivity analysis. Annals of Statistics, 40(3):1816, 2012.
Jessica Vamathevan, Dominic Clark, Paul Czodrowski, Ian Dunham, Edgardo Ferran, George Lee, Bin Li, Anant Madabhushi, Parantu Shah, Michaela Spitzer, et al. Applications of machine learning in drug discovery and development. Nature Reviews Drug Discovery, 18(6):463-477, 2019.
Tyler J VanderWeele. Marginal structural models for the estimation of direct and indirect effects. Epidemiology, 20(1):18-26 2009.
13

---

Tyler VanderWeele and Eric Tchetgen Tchetgen. Mediation analysis with time varying exposures and mediators. Journal of the Royal Statistical Society Series B: Statistical Methodology, 79(3): 917-938, 2017.
Stijn Vansteelandr, Martin Linder, Sjouke Vandenberghe, Johan Steen, and Jesper Madsen. Mediation analysis of time-to-event endpoints accounting for repeatedly measured mediators subject to time-varying confounding. Statistics in Medicine, 38(24):4828 48488 2019.
Christopher KI Williams and Carl Edward Rasmussen. Gaussian processes for machine learning, volume 2. MIT press Cambridge, MA, 2006.
Alan C WWitgrroee, G Wesley Clark, and Laurier Tremblay, Laparoscopic gastric bypass, Roux-en-Y Y: preliminary report of five cases. Obesity surgery, 4(4):353-357, 1994.
Patrick Wyatt, Sarah Berry, Graham Finlayson, Ruairi O'Driscoll, George Hadjigeorgiou, David Drew, Haya Al Khatib, Long H Nguyen, Inbar Linenberg, Andrew T Chan, et al. Postprandial glycaemic dips predict appetite and energy intake healthy individuals. Nature Metabolism, 3()): 523-529, 2021.
Yanbo Xu, Yanxun Xu, and Suchi Saria. A Bayesian nonparametric approach for estimating individualized weatment-response curves. In Machine Learning for Healthcare Conference, pages 282-300. PMLR, 2016
Shuxi Zeng, Stacy Rosenbaum, Susan C Alberts, Elizabeth A Archie, and Fan Li. Causal mediation analysis for sparse and irregular longitudinal data. Annals of Applied Statistics, 15(2)7747-767, 2021.
Guangyi Zhang, Reza A. Ashrafi, Anne Juuti, Kirsi Pictiläinen, and Pekka Marttinen. Errors-in- variables modeling of personalized treatment-response trajectories. IEEE J. Biomed. Health Informatics, 25(1):201-205 2021.
Yizhou Zhang, Defu Cao, and Yan Liu. Counterfactual neural temporal point process for estimating causal influence of misinformation on social media. Advances in Neural Information Processing Systems, 35:10643-10651 2022.
Wenjing Zheng and Mark van der Laan. Longitudinal mediation analysis with time-varying mediators and exposures, with application survival outcomes. Journal of Causal Inference, 5(2), 2017.
14

---

A Causal Assumptions and Identifiability
A.1 Static Causal Mediation
Consider a structural causal model (SCM) with a treatment A, mediator M and outcome Y (Fig. 6ap. We define the total causal effect (TE) of the treatment A on the outcome Y as the difference between setting the treatment A to target treatment value à and no treatment Ø (earl,2009)
TE( Y[ā] [[2],
M
M
where we use the short-hand notation [ā] to denote an interven- tion: [ã] = do(A a).
In many situations, the total effect does not capture the target diet- example of Section 5.1, we examine how much of the surgery's s effect is due to the post-surgery diet or the rest of the metabolic processes. This question can be formulated as a causal (mediation) query, where we estimate the indirect effect flowing through the medi- ator M (A-MM +Y), separately from the direct effect flowing through the path A-Y. To measure the effect of specific path, one can devise a pair of inter- ventions on the treatment A and the mediator M so that only the specific target path is 'active". A straightforward implementation of this idea leads to the definition of the controlled direct effect [CDE.
of the scientific investigation. For instance, in the glucose rreatmenn-mmeiiiarr-oootooo
(a) Classical.
(b) Interventionist.
Figure 6: Graphical models for causal mediation. Mediation is de- fined in (a) using nested counter- factuals, while in (b) using path- specific treatments A.M and A.v.
Pearl 2001
CDE(â, m) Y[A ū, M = m] Y(A 20, M = m)
(II) where (ä, fl denotes a pair of interventions on and M: [ā, ml do a, M= m.. The CDR is intuitively defined in Eq. (1T) as the difference of the outcome Y when the mediator M is fixed to in while the treatment A is either à or Ø. In the surgery-diet-gee glucose example, this corresponds to the difference in the outcome Y while the patient is set to either (i) the surgery à and a certain diet m or (ii) no surgery Ø and the same diet m. Hence, CDE m) has a prescriptive interpretation as we prescribe both A and M to external intervention values, in contrast to the attributive interpretation that we are after to understand the underlying causal mechanisms [Pearl 200T].
-Yāā, - m.,
To understand the underlying causal mechanisms, we rather want to estimate the contribution of direct and indirect paths to the total causal effect. To achieve this, Pearl (200T) defines the natural direct effect (NDE) and the natural indirect effect (NIE). In natural effects, we devise a pair of interventions such that it sets a target path to a target intervention value while keeping the other path fixed in its natural state, i.e., the state that it would have attained without our external 'do' -intervention. Traditionally, the NDE and NIE are defined as contrast between nested counterfactuals [Pearl] 200T). Accordingly, the NDE is
NDE(a)= Y[A = à, M = m
Y[4 2, M = 2)
(12) where [ä, m[==21 = do(A ā, M = ) denotes pair of interventions on A and M. where the treatment A is set to ā and the mediator M is set to 1=)) the value M would have attained without our doing any intervention on the treatment [A 2). i.e., no treatment. The counterfactual outcome Y [ā, m[== is called 'nested' since we set the treatment to two distinct values à and Ø for the same individual data point Y, which is not possible in real-world scenario. Similarly, the NIE is
Y ā, m= Y|0,
NIE(a) Y[A a, M m Y(A = ā, M m[)=
Y [ā, m[;=aa] Y [ā. m
(13)
The NDE and NIE with nested counterfactuals are identifiable under the following causal assumptions Pearl 2001 2014 Imai et al. [2010b]:
(SA1): p(- do(A a)) = p(- = a),
(SA2): Y[a,, m] IL M(22].
15

---

The static assumption (SA1) states that there is no unobserved confounding (Nuc) between the pairs
(A, .M) and (A. Y). Pearl [014] interprets the static assumption (SA2) as the mediator-outcom outcome relationship is deconfounded while keeping the treatment A fixed. Under these assumptions, the
distribution the counterfactual outcome Y [ā, (===) can be written as follows [Pearl 2001]
P(Y (i )=j)) = PPY A = ā M m" m m AA=
(14)
A.2 Dynamic Causal Mediation (with Single Intervention)
We extend the static definitions of natural direct and indirect effects by formulating them as stochastic processes over period [0, This leads to a definition of dynamic causal mediation. For each patient, we define process M that is observed at / arregularly-sample time points: {(t,, m)) and (iii) an outcome process Y that is observed at J prregularly-samples time points: {(tg. Vy) For a detailed problem formulation, see Section 2.1.
treatment process A that occurs only once at time to [0, T). (ii) mediator
The identifiability in the nested-ccounteffacuall based mediation is only possible there exist no post-treulmenl confounders, i.e., confounder variables between mediator and an outcome must not be causally affected by the treatment [Pearl 2014). However, in dynamic causal mediation, past mediators and outcomes causally affect future mediators and outcomes. This means that past outcome measurement acts as a post- treatment confounder for a future mediator and a future outcome, and the NDE and NIE are non-identifiable without further assumptions (Pearl 2014
Didelez 2019).
To work around the post-treatment confounding problem, Zeng et al. [202] assume that there exists no interaction from past outcomes to future mediators (See Fig. 2a). However, in a real-world healthcare setup, the mediator and outcome processes most likely interact, e.g., past glucose levels should affect future glucose levels as well as future meals. To overcome this limitation, we follow an interventionist approach to the causal mediation [Robins et al., 2022]. similar to Didelez [2019). Aalen et al. [2020]. In this approach, we hypothetically duplicate the treatment A into two path- specific treatments: the direct-path treatment A and the indirect- tatireect-pahhhhe treatment A (Fig. 6b). For instance, in the surgery- diery--deelllucose example, the direct-path treatment A corresponds to changing only the metabolic processes (other than the diet), without affecting the diet. Using path-specific interventions A_M and A_,, Y,, we define the NDE
NDF((a) = =Y [A y L,, A A.M [a]
- M Ln]
= Y [Ta [o] Yúi, La)
(15)
where Y(ā,, āg] is the potential outcome after setting the direct-path treatment A to 0g and the indirect-pane treatment A. >M to 02 Similarly, the NIE is defined as
NIB(C.)= = Yy [A . Ø, A M ia] Yúi, A Ø, A A.M M- - Ø]
= Y 0 00 1 10
(16)
Accordingly, we define the total effect as follows
TE(E.) NDE(F.) + NIE(Fa) Y Si, Baital Ful YYs 13,110,01
(17)
A.2.1 Causal Assumptions
To identify the NDE and the NIE, we make the causal assumptions (A1, A2, A3):
Assumption A1: Continuous-time NUc. There are no unobserved confounders (NUC) between the reatment-mediator process pair (A, .M) and the treatment-outcome process pair (A, Y), i.e., the treatment randomized. Hence, the interventional distribution of treatment intervention and the conditional distribution of those who got treated are equivalent:
p(- Ao = NA)) = p(- A NA).
(18)
Assumption A2: Local Independence of Mediator M and a Single Direct-Path Treatment A.y. Conditioned on the history Her of the mediator and outcome processes up until time т, the mediator process M is independent of the direct-path treatment A, locally at time r, for all times T E [0,T]:
A IL M(r) A Her, TE [0, Hence, there no direct arrows from the direct-path treatment A_y to the mediator process M.
(19)
16

---

Assumption A3: Local Independence of Outcome Y and Single Indirect-Path Treatment A -M. Conditioned on the history H.er of the mediator and outcome processes up until time т, the outcome process Y (T) is independent of the indirect- -athh treatment A A locally at time for all time r E T]:
A.M IL ((r) Her, TE [0. 7.
(20)
Hence, there are no direct arrows from the indirect-path treatment A of to the outcome process Y.
The static version of the NUC assumption in (A1) is common in the existing literature on longitudinal causal mediation [Didelez] 2019 Aalen et al. 2020]. Here, we define as a continuous- time Nuc [Schulam and Saria 2017] for completeness, as we also define the treatment A as a process in Section 2.1. (A2, A3) state that the path-specific treatments A. and A causally affect only their target path for a given time т conditioned on the past history. They can be seen as the continuous-time generalizations of the similar causal assumptions provided for discrete-ting time mediator outcome measurements (M1, M2, Yy..... Mn, Yn) in Didelez (2019) and (Aleen et al. 2020 An interesting connection is between (A2, A3) and the notion of local independence [Didelez] 2006 2008 2015), dynamic interpretation of independence that is the continuous-time version of Granger causality [Granger] 1969). In this regard, (A2, A3) state that the processes M and Y are locally independent of the direct- and indirect-path treatments A_ Y and A_ -M respectively, given the history of the rest of the processes. Furthermore, (A2, A3) imply that there are no (continuous-tin unobserved confounders between the mediator and outcome processes, otherwise unobserved confounder between them would render the process Y (or M) and A_ (or A, dependent as we condition the past history (See Didelez 2019 for detailed explanation).
A.2.2 Proof of the Identifiability Result
For the total effect, we need to estimate the trajectories Y=ú, Moy, En] and YSE, [0,0]. identifiable under (A1). For direct and indirect effects, we further need to estimate the counterfactual trajectory Y=i, [Ø, (.), i.e., the outcome process under a hypothetical intervention, which is identifi- able under (A1, A2, A3). In the following, show the identification result for the outcome process under a hypothetical intervention Yx,, ta]. since it is a generalization of the 'fcctual' trajectories Yzi, [F,, [a] and ,i,, 10,
Ø]. which are
We consider a counterfactual trajectory YsE under paired intervention, e.g. [Z, at R ordered query points {4- ) Gr > I.: Yg 10, [a] (Y(g))))))))))))) (2, We start by explicitly writing the interventional trajectory in do-notation:
P(Y. [0, [,]) = P(Y, | do(La , = Ø, LA -M = [.)).
Let M (9-9)=1) denote the mediator occurrences between two consecutive query points or and gr+11 and M Myr R-1 M g--9- 1). We include the mediator process Myi,, the counterfactual trajectory
Y, [e, En], and write the conditional distributions of Yg and Myi, using a factorization in temporal
order:
R-1 P(Y do(ta_. 0, 1, = =ta), Ma (a 2r Hsg
P(Yalo,ta))
Σ
M r=0
P(M do(La.. -,LA,N = -ia, (,),HHsn)) Hgn.),
(21)
where do i and H.gg. denotes the history that contains the past information the path-specific
treatments (A (A,M,, A. ) and past mediators up to (non-inclusive) 4r, and past outcomes up until
(inclusive) q Hzg. A M U A, ((t,,m4) < q.) {(t,, : 9r)-
(A3) states that the outcome Y (gr+1) is independent of the indirect-path treatment A.,M conditioned on the past history Heaa-1 including the direct-path treatment A... Hence, we can change the value of the intervention on LA LM without changing the first conditional distribution term in Eq. (1
Using (A3), re-write Eq. (2l) as
R-1 P(Y 4-11 P = =2,1A 1A = =R), M Mararrii) Hea.)
P(Ya 10, [0,,,)))= = Σ
II
MyL. 0=
PMM do(ta = 1,tA = [a), Hgg.))
(22)
17

---

Similarly. (A2) states that the mediators Ma 1) are independent of the direct-path treatment A conditioned on the past history Heg. including the indirect-path treatment A.M M- Using (A2),
re-write Eq.
22 as
R-1 II P(Y g-+s do(tt,. 2, 1M = = M ((niaot1): Hgg
P(Y ([,()
E
M r=
P(M(rrerts)) do((l do(Ls = -tay la AM4 = Hs))
(23)
In Eq.
23
the target quantities are considered under 'factual' intervention pairs:
do(tA_v = 2, tM =) do(ta Ø),
(24)
do(lA..y = Ea, LA LA = (a) do(ta ia).
(25)
Using Eqs.
24 and 25
we can simplify Eq. (23) as follows:
R-1
P(Y i.)
E
P(
a do((A 2), M Mo Hag
Myr. r=0
P(M dolttttoatttttoooo Ea), H.g.).
do(tt
(26)
In Eq. 26), both terms in the product correspond to the mediator and outcome processes under the interventions [2]] and [7a] respectively. These interventional distributions are identified under (A1), as it states that there Using (A1) on Eq. (26), we obtain the final identification result:
unobserved confounders between the process pairs (A, M) and (A, Y).
R-1
((Ya(9, = Σ
II
P(Y = Ø M Mg....111) Hga P(M (a-g-1 1) 1I44 = Tax H H
My..
0
outcome
mediator intensity
(27)
To estimate the direct and indirect effects, model the two terms in Eq. 27 with an interacting mediator- -ottooee model.
A.3 Dynamic Causal Mediation (Generalization to a Treatment Sequence)
In this section, extend the dynamic causal mediation definitions to multiple treatments. To achieve this, we define the treatment as a non-binary, non-unitary process A [0, I] + N x {R U {Ø}} similar to the mediator process M. Here, the difference between two processes A and M is that consider A to be a known, deterministic sequence, while M to unknown and stochastic. Hence, sequence
{a, > where each treatment a, = (tn, dn) is a tuple of a treatment time tn E [] and a treatment type/dosage marker d, E A. discrete space A Z representing set of treatment types,
assume that the treatment process A is given
The type/dosage space can be chosen a continuous space A = IR representing a set of dosages, or combination of both spaces A = N x IR.
We again hypothetically duplicate the treatment process A into two path-specific treatment sequences: the direct-path treatments A_, and the indirect-patl treatments A A.M (Fig 6b). Using path-specific interventions A.M and A y, define the NDE as
NDE a1, au) = Y A a, A M = -a] A
= ay, A = a.]
= YYs. a āi] Ys äJ].
(28)
where [ag àn] the potential outcome after setting the direct-path treatment sequence A. -Y {a0,1, 00,2,........ do.N.) and the indirect-path treatment sequence A M to á (01,1, 01,2,...,.. ,1,N, Similarly, the NIE defined as
NIE(āI, an) Yi, A âo, A = āi] Y IA âo A.M ão]
=YSū [ ā,] - Y āg)
(29)
Accordingly, we define the total effect as follows
TE( āo) NDE(â,, ao) + NIE(aI ān) = YSS, [ā,, ā, YYs (ão, ão].
(30)
18

---

A.3.1 Causal Assumptions
To identify the NDE and the NIE, we make the causal assumptions (A4, A5, A6):
Assumption A4: Continuous-time NUC (Hizh et al. 2023). Let sequential treatments occur a discrete set of time points on a given interval, characterized by the conditional intensity function (2(4,)) d). The conditional treatment intensity (1, d) of treatment
(1, d), is independent of
the potential outcome trajectory Y>1 [a.. conditioned on the past history Her, VI E Rgo, where the history H.rr contains the past treatments, mediators and outcomes.
Assumption A5: Local Independence of Mediator M and Direct-Pate Treatment A. Con- ditioned on the indirect-path treatment process A M and the history Her of the mediator and outcome processes up until time т, the mediator process M is independent of the history of the direct-path treatment A A locally at time T, for all times [0:
IL M(T HHer, T [0,
(31)
Hence, there are no direct arrows from the direct-path treatment A. to the mediator process M.
Assumption A6: Local Independence of Outcome Y and Indirect-Path Treatment A.M- M. Conditioned on the indirect-pan -ath treatment process A <T Y and the history Her of the mediator and outcome processes up until time т, the outcome process Y (T) is independent of the past of the indirect-patl treatment A M locally at time т, for all time T E [0,T]]
M II (() A Y Her, t E [0, 7)
(32)
M to the outcome process Y. Hence, there no direct arrows from the indirect-path treatment A
Assumptions (A5, A6) define the local independence with respect to the past sequences of the direct- and indirect-path treatment processes A²r and A.M. This is in contrast with the definitions of Assumptions (A2, A3), where we only have single treatment.
A.3.2 Proof of the Identifiability Result
For the total effect, we need to estimate the trajectories Ysi, [āi, ā and Yi,, [ão, äo]. which are identifiable under (A4) ().). For direct and indirect effects, we further need to estimate the counterfactual trajectory Y i [ān, ān]. i.e., the outcome process under hypothetical intervention, which is identifi- able under (A4, A5, A6). In the following, we show the identification result for the outcome process under a hypothetical intervention Y [a0, a. since it is generalization of the 'factual' trajectories Y [ā, ā and SE, [ão, āo]-
We consider a counterfactual trajectory >SE under a paired intervention, e.g. [ão, â at R ordered query points (1r J 4r > I,: Yg [an, ai] (Y(a))(ān, ) We again start by explicitly writing the interventional trajectory in do-notation:
P(Y. [2, fa)) P(Y, do(A -Y āo A A-M ā,)).
Similar to the analysis with a single intervention Appendix A.2.2 we define Myi, - M Ma (++1) and write the conditional distributions of Ya and M,i, using factorization in temporal order:
n-1 I(Y I do -Y ao, A A-M =ā)), M Maraa++)>> Hos..)
(ang
Σ M
P(M do -Y = -g A M = ā,), Hgn.),
(33)
where = FG and Hsg. denotes the history that contains the past information on the path-specific treatments (A -M A Y and past mediators up to (non- mon-inclusivv) gr, and past outcomes up until (inclusive) q Hggg
A AZY. {(t,, m.) 4, < 9r) (11, 85) :1 gr)-
Let us start with the first term P(Y,. |d - = âo, A + a1) M Mig.g.+11: ). We know that the outcome Yg-- at time point 9r+1 is independent of any future interventions:
P(Y do(A->> -Y āo. A ā1), M (0 H.gg))
= =P(Y ge+1 do -Y
cgr+1 = ān <0 A +M
= ā1,5 M Mor..a41); H.g.).
(34)
2g0+1
19

---

(A6) now states that the outcome Y (gr+1) is independent of the past of the indirect tatirect-pathhhte treatment 3 conditioned on the past history H-cer+ including the past of the direct-path treatment
A
A <ge+s' Hence, we can change the value of the intervention on A M without changing probability of the conditional term in Eq.
Eq--1
Using (A6), we re-write Eq.
34 as
P(Y do A <9r+1
ā0, 20110-
M ā1,<0- 1), M (4-.4++1) H.a.)
29.+1
P(Y do
80 80,59-411
A
-M
â0 <0. M Mor.er+1): Hgg.). (35)
20.41
Let us continue with the mediator term P(M(a-.q-4.1) do(A (lo(A-Y- åo, A +M ai), H.a.). The steps will be similar to the discussion above, with one difference: there might be interventions alg--0-11) in the interval (g., (r+1). Without loss of generality, let us assume there only a single intervention "p = (bp= dp) in the interval lp [dr: fr+1). Then, we consider the mediator term in two parts, namely up ip and after Ep:
P(M dA +Y
āo A A-M =ā1); Hgg))
-P(M do -Y -o; A *M āi); H.a.)
P(M (1 do - = ag A-M
-M = āi), M (g Hgg
(36)
We know that the mediators M tp and M((p..0+11) are independent of any future interventions:
P(M [p) ))] do + ag, A +M = ā1), Hsg
=P(M [- do( A A a0, AZdd a1,<0)); H&r,)
(37)
P(M do(A "8 = āo A M = =a1), aa),MMicc M(r-tp)) H.s..)
(PM do A +Y at, Agt, āi,st,); Manntyl H.g
(38)
(A5) states that the mediator M M,..,, (and ((p)ar411)) is independent of the direct-pati treatment A A conditioned on the past history Hes. including the indirect-path treatment A AZAd Using (A5),
we re-write Eq. (37p and Eq. 388 as
P(M cp do A <ar
Y 00, A A = <a,,ca): Heea))
(a do (o(A
-Y -1, A A ā, <g.) H.gg.)
(39)
<q.
P(M do( A = āo st, Azd. = =b,,st,); M (1- 7.saa)
=P(M(( do (A -i, A Ast.
M -i, Mignital: H.sr))
(40)
Using Eqs. (35)
(39)
and 40
we write Eq. 33
P(Y (2 ā1l)
Σ
P(Y
P(Y
do(A
cg-11
g--1 āo 30,50.+1
A A.M 20. A Man H Hgar)
M.ia
r=0
P(M do (o =1, A AM ā Hsge)
cq.
P(M do(A
A AY S1,
A M
= à ري. M Marnda) Hea.).
St,
Stp
(41)
In Eqs. 335..
39 and
40). the target quantities are considered under 'factual' intervention pairs:
do(A
- -Y
āg A M āo,e7) do(Acr āg,e7),
(42)
<T
do(A=) Y āl,<7) A âι,-7) = do(Acr = āI,e7).
(43)
<T
Using Eqs. 42 and
43 we can simplify Eq. as follows:
R-1
P(Y a0, āi))
Σ
II
P(Y guts do(āa..g.m)) ), M (1): Hbsg.)
M.i.. r=0
P(M sp do(ā), Hear)
P(M /ola) M,.,),,MMuoo MIg.,t,)) Hear).
(44)
20

---

In Eq. (44, both terms in the product correspond to the mediator and outcome processes under the interventions [ao] and [ār] respectively. These interventional distributions are identified under (A4), as it states that there are no unobserved confounders between the process pairs (A, M) and (A, Y). Using (A4) on Eq. (44). we obtain the final identification result:
R-1
P(Ya ai))
E
II
P(Y,. 9:1 IIA = 60,5a- 1: M Mag-ar++1) H Hsg,)
M. 0=
outcome
P(M a1 H.g P (t.. at, Maat,,Maa..4 Mag..el H
mediator intensity
(45)
To estimate the direct and indirect effects, now the joint mediator-outcome model needs to take the treatment history å into account.
B
Interacting Mediator-Outcome Model
Our interacting mediator-outcome model builds on marked point processes [MPP, Daley and Vere-
Jones 2003 and Gaussian processes [Gp, Williams and Rasmussen 2006]. Hence, we first introduce
MPPS B. and GPs (B.2). We describe our model in detail B.3 and discuss learning and inference
in
B.4 Finally, we discuss computational complexity and scalability of our model in B.5
B.1
Marked Point Processes
temporal point process (TPP) a stochastic process that models continuous-tine event sequences. e.g., sequence of treatment times D {t Vi over period [0, 7) [Daley and Vere-Jones 2003
[0, + Zzo. which outputs the number of points until time т: (T) = Σ L[t S T]. We assume that there can be most one point in an infinitesimal interval [T - AT,T]: AN {0,1}, where AN limar1o( (N(T) - N(r Ar)). The counting process N (T), and hence the change AN, can be decomposed into predictable compensator function ( ((r) and a zero-mean noise process (martingale) (r) by the Doob Doob-Meyer
Rasmussen 2011]. TPP can be represented by a counting process
Meyer theorem Dideleez 2008
((T) = A(T) + U(T)
(46)
Using the Doob-Meyer decomposition, a TPP can be uniquely determined by the expected rate of change in its counting process: E[AN [Hrr] = AA Her (7) dr, where the function (T) = X(T Her) is called the conditional intensity function and the star superseript is shorthand notation for the dependence on the history Her (t: t, < T, I..
When temporal point carries additional information (mark, m), c.g., a sequence of treatment times and dosages D [[t,, m.) mn))/=
model sequence of time-mark pairs using marked point process (MPP). Accordingly, the conditional intensity function X (t, m) is extended such that includes the mark intensity: >* m) (ttA** (m t). Using the conditional intensity function, we can write the joint distribution of as follows [Rasmussen] 2011]:
II X (m, (t,) exp (- (-f, x((()d))
(DD)
(47)
1=1
B.2 Gaussian Processes
Gaussian process [GP, Williams and Rasmussen (006) describes prior distribution GP over a continuous-valued function f: R² E:
f()) (((m(),,(..)))
(48)
where a mean function RDD + R represents the expectation = E(f()),, and a symmetric positive-definite kernel function TR RDD - represents the covariance k(,, ') = cov(.,'). In practice, we do not deal with infinite-sized distributions, rather only consider evaluations of the
21

---

GP at a finite number of input points. The GP prior fx) of any subset of N data points E R RN follows a joint Gaussian distribution:
f(x)=~~ MMx: Kxx),
(49)
where the mean μ4x - [u(x)= E R& is obtained by evaluating the mean function (u-) at N input points and the covariance matrix Kxx x'x,x') E RNxN is obtained by evaluating the kernel function -", at N x N input pairs. Commonly, we assume zero mean μx = O.
For given set of N training points x and N. test points X., we can use the joint Gaussian property of GPs and write the joint distribution of f = f(xx and f. [(x)):
Kxx
Kxx.
1)
N
(50)
Kx,x
Kx.x.]
where the croas-coveriance matrix Kxx. E NNN. is obtained by evaluating the kernel function at N x N. input pairs. Using the conditional distribution identities of the Gaussian distribution, we write the posterior distribution p(f. [f):
(K
Kx.x, Kx Kxx.K)
(51)
Taking the inverse of matrix is computationally expensive. Its computational complexity is (NN), which is unfeasible for large data sets. To make the Gp inference scalable, one common method is to use inducing point approximations [Quiñonero Candela and Rasmussen 2005). For this, we choose a set of M inducing variables u = f(z) E R= evaluated at AZ inducing points z E RM where M < N. Using the same conditional Gaussian identity, we can write the conditional distribution of the function f conditioned on the inducing variables u as follows
u1 < Kxx KxrK=1K Kxx);
(52)
where the inverse is now only required of a much smaller matrix Kzu E RMM
B.3 Model Definition
For the joint model definition, we extend a non non-parametric mediator-outcome outcome model (Hzh et al. 2023] to include an external intervention A that jointly affects both mediators and outcomes. Similar to Hizh et al.] [2023), we combine an MPP and a conditional GP to model the interacting mediator- outcome processes, The binary value of the treatment process A(r) E {0, 1] acts as regime indicator, which specifies whether the treatment is active not. The structural causal model for the treatment process A, the mediator process M, and the outcome process Y can be written as follows:
A(T) = 1(r 2 {o) {0,
M(T) = 1/ (T, (orr)r) + U/4 (T),
(53)
Y(7) == ( (7, Her) + U (7),
(54)
where 7 E [1, (T((T) is zero-mean noise process, and Uy (T) is zero mean Gaussian noise. Eqs. 533 and (54) capture the mediator term (O) and the outcome term in Eq. (27 respectively. The mediator and outcome terms detailed in Appendices B.3. and B.3.7 for single regime
since we use equivalent model definitions for both pre- and iost-intervention regimes.
B.3.1 Mediator Intensity
Considering Eq. (53) as the Doob-Meyer decomposition of the mediator process, can interpret the function fas (.,) as the compensator function Á (-), and the noise UM as a zero-mean martingale.
Hence, we parameterize the function (sx)) )) by conditional intensity function X² (T)), where SM (::-) is equivalent to the integral of X* (T): JM Her) = A (T) = - X(T, m Her ddrdm
The conditional intensity function X(t,, m, HLe,) consists of two main components: the mediator time intensity X(4: H.r)) and the mediator dosage intensity X(m; 4, He,, ): A(4, m; Her;) =
A(42 Her, (mm;; 4i, H.et)) The dosage intensity is modeled as simple GP prior with Matern- 1/2 kernel that does not depend on the history Het, and takes the absolute time as input: X(m:
t, Hew) A(m; ta) ~ GP.
22

---

We model the mediator time intensity A(t; Hee,) using three independent components { Im. 9o similar Hizh et al. 2023]. where the constant Bn serves as a simple Poisson process baseline, the time-dependent function In captures the dependence on the past mediators, and the time-dependent function Go captures the dependence on the past outcomes. We assume the effects of these components as additive, and their sum is squared to ensure non-negativity:
X(r HKr)) = ( Bo
+ Im (T; m) (o(T:o)))
(55)
mediator effect
outcome
baseline
The mediator effect function Im (T; m) captures the dependence the past mediators, e.g., the intensity should decrease just after a meal as the patient unlikely to eat at this moment. For this, regresses the relative times of the last Qm mediators that occurred before time T: [T t.......
R R - R. [Liu and Hauskrecht 2019 Hizh et al. 2023]. modeled GP prior 9m GP. Its input has Qm dimensions, where each dimension g Qm is modeled independently by a squared exponential (SE) kernel: k.g. (.--) = Ei kSE (..))
tqm) ). where tg < T for q I,.... Qm with Im.
The outcome effect function 9m (m; m) captures the dependence on the past outcomes, e.g., the intensity should decrease when the blood glucose is high due to a previous meal. For this, it regresses on the relative times of the last Qo outcomes that occurred before time T: (T- f1. .i..... T-t vQ.).
where tg < T for E 1,..., Qo. with go {R>o x IR Q. + R (Hizh et al. 2023 It is modeled as a GP prior go ~ GP. Its input has Qo x dimensions, where Qo dimensions
modeled independently.
Each dimension q E ,,....,6. Qa has a 2-dimensional SE kernel: (:
)) = Σ
g==1 1.12) (;:-): the first
axis represents the relative-time input and the second axis represents the measurement value, e.g..
glucose levels. For more details on the non-parametric point process model, see Hizh et al. 2023
B.3.2 Outcome Model
For Eq. (54 we model the function (-.-) using two components: (i) baseline function (o(T) that is independent of the history (past mediators) and (ii) a mediator response function (-.)) that captures the outcome response due to a mediator occurrence (Schulam and Saria 2017 Cheng et al.)
2020 Hizh et al. 2023). Together with the independent, zero-mean Gaussian noise My ~ ~N(0 o we can write Eq. (4) as follows:
Y(r) fo(T) +
Sm (n; m)
+ (T
(56)
baseline
mediator response
The baseline function has GP prior fo GP. Its kernel is sum of constant and periodic (PER) kernel --)- = kcoNsT(:; -) + kPER( (:))( The mediator response function fm. models the dependence of the future outcomes on the past mediators. We assume that the effect of the past mediators is additive, and the magnitude and the shape of the response are factorized as follows:
fm fm
Σ ((me)) (T (T (4),
(57)
where (i) the magnitude of the response depends on the mark m, through the linear function 1(m:)) and (ii) the shape of the response depends the relative time 1, through Gp prior for ~ GP that has a SE kernel: ())) = (ss We ensure that a future mediator does not affect a past outcome by using a 'time-marked" kernel [Cunningham al. 2012 where the output of the kernel is set to zero if the relative time input is negative, i.c., the mediator has occurred after the outcome, similar Cheng et al. [2020), HHzzh et [2023]. Besides, we assume that the mediator has a causal effect on the outcome for an effective period Tenr e.g., the glucose response of a meal takes place in the next 3h (Wyatt et al. 2021 For more details on the non- -arramemet outcome model, see Hizh et al. [2023].
B.3.3 Joint Distribution of Mediator-Qutcome Model
In our problem setup. each patient undergoes the surgery and is observed in two regimes (pre- and post-surgery): D (eeo))) Within each regime E {0, 1). the data set D(a) con-
tains the measurements of mediator M and outcome Y irregular times: ((tf0) (())))/ ((0)
and
23

---

(0)) ) For completeness, repeat the joint distribution of D: 11000 ,1
P(D) = II
(exp(-A(9) II
(1, mi Hct,) II (v) i H
(58)
aE(0,1)
mediator intensity o
model
B.4
Learning and Inference
We use the likelihood in Eq. 58) to learn the joint mediator-outcome model. The mediator intensity has sparse GP prior using inducing point approximations (Hensman al. 2013]. Hence, use variational inference and optimize the evidence lower bound (ELBO). The outcome model is standard GP prior. Hence, we use the marginal likelihood to learn the hyperparameters. For more details on the derivations of the learning algorithmss, see Hizh et al. [2023).
Following Eq. (58). we learn single joint model for each of pre-surgery (a 0, 2)) and post- surgery regimes (a 1, [ FaD. With these two models, we can estimate the two interventional trajectories Y [2, 2] and Yú, Ea, under 'factual' interventions. For the interventional tra- jectory Yz. [2, fa] under the hypothetical intervention [2, ka] Eq. (27 states that the outcomes follow the pre-surgery outcome distribution while the mediators follow the post-surgery distribution. Therefore, combine the pre-surgery outcome model p(Y [A Ø]) and the post-surgery mediator
intensity X {1 ta] to estimate the interventional trajectory Y,i, [ fa].
B.5 Scalability
Outcome Model. The computational complexity for the learning and inference in standard GPs is O(N3) where N is the number of training data points. In the RCT data set used in experiments, we have ca. 5100 data points for each period, resulting from 17 patients with 3-day long glucose measurements in approximately 15-minute intervals. This is relatively large data set that renders standard GP inference slow. However, straightforward inducing point approximation would not work on the outcome model, due to the 'time-marked' mediator-response function where past mediator only affects the future outcomes. To make this approach more scalable, an efficient inducing point implementation will be required and it will be considered as future work. We believe that this will be a meaningful contribution for scalable Bayesian estimation treatment-response curves Schulam and Saria 2017
Xu et al. 2016 Soleimani et al. 2017 Cheng et al. 2020
Mediator Intensity. The computational complexity for the learning and inference in GPs with inducing point approximations is M?) where M is the number of inducing points. In experiments, we see that M can be chosen in the order 10 and we use M = 20 in all experiments. Hence, the learning and the inference for the mediator intensity is scalable compared to the outcome model.
24

---

PRE.SURGERY
INTERVENTION ENTIO
POST SURGERY
8.
Intensity X*(t) Glucose (mmol/l).
1.--
Carb. intake (6)
60-
50-
4.0
3.-
50
10.0
03-
0.2
0.0
6.0
12.0
16.0
24.0
T+6.0
T+420
T+180
T+24.0
Time,
Clucose, y
Meals, m
X
(a) Example patient 1.
SURERY
INTERVENTION
POST
Intensity (t) Glucose (mmol/f) (I).
Carb. intake (g)
60-
40-
02-
0.
0.0
6.0
12.0
18.0
26.0
T46.0
T+422
T+180
T+2400
Time,
Glucose. y
Meals, m
Xirr
(b) Example patient 2.
PRE-SUBGERY
INTERVENTION
POST-SURGERY
Intensity (+( Glucose [mmol/l) l1).
intake (6).
6.0-
30.
30,0
10.0
0.3
00-
0.0
6.0
12.0
10.0
26.0 Time,
T+6.0
T+120
T+180
T+2400
7
Churose,
Meals, m
XM(c)
(c) Example patient 3.
Figure Example 1-day long meal-glucose data and joint model fits for three patients: meals (carbohydrate intake, cyan bars), glucose (black crosses), predicted meal intensity X (orange dashed line), predicted glucose baseline fo (red dashed line) and predicted glucose progression f (blue dashed line). For blood glucose, see, after the surgery, (i) the baseline declines, and (ii) meal produces a faster rise and decline. For meals, we see, after the surgery, the patient eats (i) more frequently and (ii) less carbohydrate per meal.
25

---

C Experiment Details
C.1 Real-world Study
For the real-world study, we consider data from real-world randomized controlled trial (Rct) about the effects of bariatric surgery on blood glucose (Saarinen et al. 2019 Ashrafi et al. 2021]. We investigate whether our model can learn siminaaly-mecaninguul direct and indirect effects of bariatric surgery on blood glucose, by analyzing how surgery affects glucose through the changed diet (indirectly) or other metabolic processes (directly).
Dataset. The RCT dataset consists of surgery-meal blood glucose preatment--ediator-oon
measurements of 15 obesity patients (body mass index, BMI 2 35 m//m²) undergoing a gastric
bypass surgery. In the original study, patients are randomized into two types of surgeries: Roux-en-Y Y gastric bypass (RYGB) [Wittgrove et al. [994] and mneaanastomosis gastric bypass (OAgB) [Rutledge, 200T]. Nevertheless, we consider both as a single surgery type since it has been previously reported that two surgeries do not have a statistically aaatittialllyssiniffaann difference between their effects on the blood glucose progression [Ashrati et al.) 2021]. A
monttoornn device measures the blood glucose of each patient at 15-minute intervals. Patients record their meals in a food diary. Data is collected over two 3-day long periods: (i) the pre-surgery period, which is 2-months prior to the surgery at weight stability, and (ii) the post-surgery period, which takes place right after the surgery. From the surgery-medt meal-glucose data set, we show 1-day long meal-glucos, measurements in pre- and post-surgery periods for three example patients in Fig. 7
Data Preprocessing Since patients record their meals with error, self-recorded food diaries contain very noisy observations, especially in terms of the meal times. For example, a patient can record a meal with 30-min delay when the blood glucose already peaked to its local maxima (top of the meal bump). Or, they can record a single meal as multiple meal records. This may cause a naive supervised learning algorithm to come to counterintuitive conclusion that meal causes a temporary decrease in the blood glucose. Therefore, we perform a data preprocessing step on the meals to correct their occurrence times. To avoid multiple records, combine multiple meals that occur within 30 min. To align the meal response bumps and the meal times, i.e., to find the true meal time values, we use a Bayesian error-in-variables model that accounts for the errors in meal timings [Ashrafi et al. 2021 Zhang et al. 2021]. We train the arror-in-variable model using the provided code in Stan [Carpenter al. 2017 and use the posterior means of the true meal times.
Model. We model the pre- and post-surgery sequences of meals and blood glucose measurements using our interacting mediator-outcome model, given in Eqs. (55) and (56). We represent each of pre- and post-surgery periods as single regime E {0, 1} using the binary-valued treatment process A(T) E {0, 1}. In the following, we explain the model parameters for a single regime a E {0, 1}. since we use the same model definition and initialisation for both regimes.
The mediator dosage intensity X(m | T) ~ GP has a Matern-1/e 1/2 kernel with the variance and the lengthscale parameters are initialized as follows: of = 1.0, la 1.0. Its hyperparameters are learned. The mediator time intensity has three components: {Su. Im- 9. The hyperparameters of these components are set using the domain knowledge. The Poisson process baseline 30 is initialized to 0.1.
The meal-effect function Im depends on the relative time to the last meal: Q. = 1. The variance and the lengthscale parameters of its SE kernel are initialized as: 0 0.1, fm 1.5. The lengthscale value 1.5 captures the likely decline and rise in the meal intensity right after a previous meal in the next 5 h. Similarly, the glucose-effec function Io depends on the relative time and value of the last glucose mcasurement: Qo = 1. The hyperparameters of its 2-dimensional SE kernel are initialized as: -f = 0.1, f, [100.0, 5.0). The large lengthscale value 100.0 in the time dimension encourages piecewise linear function that changes with new glucose measurement in every 155 min, since the glucose measurements are more frequent compared to the meal measurements (~33h) The large lengthscale value 5.0 of the glucose dimension encourages a smooth, slow-changing function as blood glucose levels fluctuate the range [4.0, 9.0) to capture a monotonically decreasing intensity as the blood glucose levels increase. The number of inducing points are chosen as M = 20 and they are placed on regular grid in the input space. The hyperparameters are not learned, while the inducing variables Z are learned. The mediator intensity is shared among all patients.
26

---

The outcome model has three components: fm. uy}. The most important hyperparameters are the GP lengthscale parameters, which are selected by a combination of domain knowledge and validation of the model fit. For real-sesponse, we considered lengthscales (0.15h, 0.3 h, 0.5 h, 1.0h), and for the baseline, lengthscales (5 h, 10 h, 20
The kernel of the baseline function fo is equal to the sum of constant and a periodic kernel. The intercept parameter of the constant kernel is initialized to 1.0. The period parameter p is set to 24 so that fa models the daily glucose profile. The variance and the lengthscale parameters of the ks, are initialized as: of 1.0,&s
10.0. The large lengthscale value 10.0 encourages a -lww-hhanging. smooth baseline function. We assume that each patient has an independent baseline function fo- The meal response function fm = Eit.gr [(m,) (T t,) consists of two functions: (i) linear function ((-) whose intercept and slope parameters are initialized to 0.1, and (ii) the response shape function fm GP with SE kernel whose variance and lengthscale parameters are initialized as: of = 1.0, to = 0.5. The magnitude function ((m:) is modeled in hierarchical manner, where each patient has their own intercept and slope parameters and they all share hierarchical Gaussian priors N(0, 0.12). The shape function for is shared among the patients as the meal responses for different individuals are very similar. Furthermore, the effective period for meal Ten is set to 3 h following the empirical findings on the duration of the meal response in Wyatt et al. (2021). The hyperparameters of the outcome model are learned except the period of the baseline p (24 h) and the effective period Tan of the shape function (3 h),,, which are chosen w.r.t. the domain knowledge.
Training. As described above, the interacting mediator-outcom outcome model is trained on the surgery- meal-glucose dataset. For each regime, one set of joint model is learned. We train the hyperparameters of the meal dosage intensity using the marginal likelihood and the inducing variables of the meal time intensity using the ELBO. For the outcome model, we learn the hyperparameters using the marginal likelihood. We show three example training fits of the joint model on 1-day long meal-glucose measurements in pre- and post-surgery periods in Fig. 7
Next Meal Predictions in Section 5.1.3. Once the models are learned, we can sample from the GP posteriors. We take 5000 samples from the posterior of the time intensity for the next meal time under typical glucose level. Similarly, we take 5000 samples from the posterior of the dosage intensity for the carbohydrate intake per meal. In Fig. of the main text, we show the kernel density estimations (KDF) using dashed lines. For the computation of the KDE, we use the built-in function of the 'seaborn' library.
Direct and Indirect Effects on Glycemia in Section 5.1.4. In Section 5.1.4, we investigate the direct and indirect effects of the surgery on the glycemia to answer the following causal query: how much of the surgery effect can be contributed to the changed dier? To measure the contribution of the direct and indirect effects, we use two metrics: (i) the percentage time spent in hypoglycemia (HG) %THo = {t: (t)) Σ 3.9 mmol/1)/ /T, and (ii) the percentage time spent in above-normal -lyyemia (ANG) %T ANG {t= (1) 2 5.6 mmol//}// In the following, we describe the computation for one metric for brevity, e.g., %.To. as the computations of the two metrics are the same.
The metrics can be calculated on the surgery- seseer--melllllucoss data set in straightforward manner. After we calculate them for the pre-surgery period [t = 2] = [Ø, Ø) and the post-surgery period [tA = [a] = [F. ].). we compute the total causal effect (TE) as follows
TEna (f.) = TTTaalla Ta] %Tna [2), Ø).
For direct and indirect effects, we further need to estimate %THo [Ka, FaJ. i.e., the percentage time spent in hypoglycemia under a hypothetical intervention [Ø, F.l. As the counterfactual The [2, ig] not available closed form, we take samples from the posterior of the learned joint model and perform a Monte Carlo approximation. As the posterior samples, we sample 3-day long meal- -leuo-e trajectories for 17 patients for each of the three interventional regimes: {10, Ø), [2, in], [La, [-] Each 1-day long trajectory has 40 glucose measurements, which makes 2040 samples for each regime. For the interventional trajectories to be comparable, we fix the noise variables of the point process sampling, similar to Hizh et al. [2023] Then, the Monte Carlo approximations of the NDE and the
27

---

Table 3: Benchmark models considered in the semi-synthetic study.
MODEL COMPONENTS
JOINT MODEL
A-Y
MEDIATOR
RESPONSE
M1
Non-interacting (1.15)
Parametric (517)
M2
/
Non-interacting (L15)
non-parametric (H22)
M3
V Interacting (H22)
Parametric (S17)
721-1
V
Interacting (H22)
Parametric (721)
721-2
ORACLE
Parametric (721)
H22
X
Interacting (H22)
Non-parametric (H22)
OUR
Interacting (H122)
Non-parann Non-parametric (H22)
NIE in %THt Ho computed as follows
17x3
NDEHG (Fa)
%T ( [ [a] %T [0, t,]
17x3
NIEHO (fa) =
Σ 7T (0
Ø Eal - *TH0 0 Ø),
where each index E I,..., 17 x refers to a I-day long trajectory sample.
C.2
Semi-synthetic Study
The performance the causal tasks validated on synthetic studies, since the true causal effects unknown in real-world observational data sets. Hence, we set up a realistic, semi-synthetic simulation study to evaluate the performance of our model on two causal tasks: estimating the NDE and NIE trajectories.
C.2.1 Simulator
To set up realistic semi-synthetic study, we design realistic ground-truth simulators, that are based on the real-world data set of the RCT study. To achieve this, we train our joint mediator-outcome model on the surgery-meal-bile
glucose data to obtain single joint simulator for each regime {0,1) 1}. We use the same model definition, initialisation and learning procedure in Appendix C.1 For a visual example on how the data and the simulator fits look, see Figs. and g
The ground-truth joint simulator has two components: the meal (mediator) simulator and the glucose (outcome) simulator. train the meal simulator, we use the mealoglueose data from all patients. We show the training fits on 1 d-y long meal trajectories of three example patients in the bottom panels of the sub-figures in Fig. 7 addition, we show how the function components 9m and 9. differs in Figs. Pa and 9b We see that in both pre- and post-surgery periods, the meal-time intensity decreases after a meal event. Besides, the post-surgery meal-time intensity increases faster compared to pre-surgery meal-time intensity as expected, as the surgery leads to diet with more frequent, smaller meals. For the decrease the size of the meals, we show how the carbohydrate intake (meal dosage) intensity changes after the surgery in Fig, 9c
For the glucose simulator, we use the meal-glucose data for three patients. This enables individualiza- tion between patients through their glucose baseline fo(-) and the meal response magnitude function 2(-). We chose to train the glucose simulator on three patients instead of all since (i) the usage of all patients make the posterior sampling slow due to the increase in the simulator size and (ii) three patients are enough to create a realistic individualization behavior where we have three patient groups with similar glycemia: (gr, gT2. grz). We show 1-day long examples of the outcome simulator fit Fig. & Besides, we show how the glucose haseline fú and the meal response fm differs between these three patients in Fig. 10
28

---

PRE-SURGERY
INTERVENTION
POST-SURGERY
intake (g). m
Glucose (mmol/1 II).
5.0
Carb.
3.0-
nl
10.0
Time,
Glucose, Y
Meals,
(a) Example 1-day long glucose predictions patient group for the outcome simulator.
PRE-SURGERY
INTERVENTION
POST-SURCERY
8.0
Carb. intake (g), m
Glucose (mmol) l/)).
6.0-
4.0
50.0
30.0
10.0
10.0
20.0
30.0
40.0
50.0
Time, T
Glucose, y
Meals, m
f
(b) Example 1-day long glucose predictions of patient group 2 for the outcome simulator.
PRE-SURGERY
INTERVENTION
POST-SURGERY
Glucose (mmol/) /l).
Carb. intake (g)
5.0
1.0
30.0
np.1
10.0
0.0
10.0
20.0
30.0
40.0
50.0
Time, T
Glucose,
Meals,
(c) Example 1-day long glucose predictions of patient group 3 for the outcome simulator.
Figure 8: Example 1-day long meal-glucose data and outcome simulator fits for three patient patient groups: meals (carbohydrate intake, cyan bars), glucose (black crosses), predicted glucose baseline fo (red dashed line) and predicted glucose progression f (blue dashed line).
C.2.2 Benchmarks
In the semi-synthetic study, we use the benchmark models shown in Table In the following, we describe the model definitions and implementation details of the mediator and outcome models.
Non-interacting mediator model (L15). The non con-interacting mediator model Lloyd et al. 2015) GP-modulated non-homoggneous Poisson process where intensity X(r) = ["(r) is the square transformation of latent intensity ʃ GP with GP prior. The GP model uses inducing point approximations for scalable inference and variational inference is used for learning.
(L15),
We implementation of the model in GPflow [Matthews et al. 2017

---

Awsdin (2]
Agiin
1iN FoR cin Time,
Time
Mediator-eflect function Pi- (b) Outcome-eflect function 9o- (c) Carb. intensity A(m r).
Figure 9: Comparison of the ground-truth meal simulator intensity components between pre- and post-surgery periods: (a) the mediator-effiect function 9 that models the dependence of future meal on past meals, (b) the outcome- effecc function to that models the dependence of a future meal on past glucose levels, and (c) the carbohydrate intake intensity X(m) [).
Glucosn Baseline, fulr)
Glucose Baseline, fi(r)
figr
fror
har figr
far
har
Time,
Time,
(a) Pre-surgery glucose baseline fo-
(b) Post-surgery glucose baseline fo-
Mediator Response, fulr)
Mediator Resporse, fult)
fmar
fmars
fmar
Iman
fmara
fmar
15
(c) Pre-surgery meal response fm.
(d) Post-surgery meal response fm.
Figure 10: Comparison of the ground-truth glucose simulator components between pre- and post- surgery periods for three patient groups (gri, gr2, gra) corresponding to three real-world patients. For three groups, we show (a) pre-surgery glucose baseline fú. (b) post-surgery glucose baseline fa, (C) pre-surgery meal response function fmx and (d) post-surgery meal response function Jm-
Parametric mediator-responss (S17). As simple benchmark for the outcome model, add a highly-cited parametric response model [Parametric (S17), [Schulam and Saria 2017]. It has a conditional GP prior with parametric response function that models the mediator response in the outcome as constant effect. We use the implementation provided in the supplementary material in Schulam and Saria 2017).
Parametric mediator-response (721). Zeng et al. 2021 proposed a longitudinal causal mediation model based on functional principal component analysis, where its response model [Parametric (221) Zeng et al. 2021 is a simple linear function with a single slope parameter. The principal components spline basis where the coefficients satisfy the orthogonality constraint. They assume that the treatment intervention only affects the coefficients of the spline basis. ceatinuuus-valleee stochastic process that is observed at the same times with the outcome measurements, which is different than our problem setup where the mediator is a marked point process. Therefore, we combine the outcome model of (Zeng et al. 2021 with a point-process mediator model in the joint benchmark models 721-1 1 and 721-2, and transform the meal sequence into continuous-valuee sequence that observed the same times with the outcome measurements. For this, we use the carbohydrate intake values of the
chosen linear combination
In their work. Zeng et al. [202T) consider the mediator
30

---

meals in their effective periods and we simply add up the carbohydrate values if two meals are nearby similar the additive mediator response assumption in our outcome model definition. We use the publicly available code implemented in R. For inference, the method uses Markov chain Monte Carlo (MCMC). We use 20000 samples with a burn-in period of 2000 samples.
Non-parametric model (H22). The non-parametric model is GP-based joint model that combines an interacting mediator model [Interacting (H22), Hizh et al. [2023] and non paraaetrretcc response model [Non-parametric (H22), Hizh al. 2023]. The model assumes that the intervention effect fully-men fully-mediated through meals, and hence it can not capture the direct arrows from the treatment to the outcomes (A--tY). Without explicitly modeling these direct effects, the learned outcome model seems to average the baseline and response functions of the pre- and post-surgery periods. We use an implementation of the model in GPflow [Matthews et al. 2017].
PRE-SURGERY
In INTERVER TION
POST-SURGERY
Glucose (mmol (I),
Glucose.
Meols,
6.0
Carb. intake (E)
4.0-
10.0
Time, 7
(a) I-day long example real-world data of patient group 2.
Clucone,
Glucose, y
Carb.
30-
50.0
75.0
Time, 7
Gluccss, y
Meals, in
Glucose,
5.-
Carb., m
XxxXX
4.0
3.0
50.0
00
Time, 7
60
Glucoss,
Moals,
5.0
Carb.. m
Glucose,
$0.00
Time,
(b) 1-day long example semi-synthetic data for patient group 2.
Example semi semi-synthetic trajectories from the training set. (a) Example 1 1-day long real- world data for patient group 2. (b) Example 1-day long semi-synthetic data for patient group
Figure 11:
C.2.3 Semi-Synthetie Train and Test Trajectories
Using the ground-truth meal-glucose simulator, we sample 1-day long meal-glucose trajectories of 50 synthetic patients for both pre- and post-surgery periods, i.e., for each regime E [0, We show some examples of the simulated trajectories in Fig. [T] We train the benchmark models on both periods, and hence obtain single joint model for each regime E 1).
31

---

Yewk
Yin
mon
Yau
moza
Ya
Intorsbyy A85
X
AdAUE
Time (hours).
(a) Glucose trajectories Y [6, Ø the pre-surgery regime (2, Ø].
min
(mmak))))
Yaaes Yaz Yae
Intessty MeT
X
Time (boum))
(b) Glucose trajectories Y [20, Fa] for the hypothetical regime [0, Fa.
Yau
(mmelif)
Aul
Mel
(boums)
(c) Glucose trajectories Ysi, [Fa, Fa] for the post-surgens regime (Fa fa).
Figure 12: Example 1-day long interventional (test) meal-glucose trajectories of the oracle model, the proposed model and the benchmark models in the semi-synthetic study for three hypothetical interventional regimes [ Ø]. [ ta] and [ ta]. In all figures, (i) at top panels we show the meal- glucose trajectories and (ii) at bottom panels show the meal time intensities and the point process sampling procedure.
(a) The pre-surgery glucose trajectories Y 10, Ø) for the pre-surgery regime [e,, Ø0. (b) The hypothetical glucose trajectories Y [2, i.]] for the hypothetical regime [22, T.). (c) The post-surgery glucose trajectories Ysi, [Tay i.] for the post-surgery regime [L,, [n].
Once the models are trained, we sample three I-day long interventional trajectories Ysi, [2,0]. Ysi, [a] and YsE Fa Eo], corresponding to three hypothetical interventional regimes [2,0].
32

---

[0, and [Fa. fo]. Three trajectories are sampled for the benchmarks and our model. These estimated trajectories are compared to the ground-truth trajectories sampled from the ground-truth simulator. To sample meal-glucose trajectories that are comparable w.r.t. their meal times, we fix the noise variables of the point process sampling similar to Hizl et al. (2023) After the interventional trajectories are sampled, we compute the TE((.), (fF((,) and (IE as described in Eqs. (15)
to (77.. We show a I-day long example for the three trajectories in Fig. 12 For all three trajectories >i, [0 Øj. Si, [0, Lo] and >i, [ [o], we see that our model follows the oracle meal intensity and the glucose trajectory well. Hence, our model also follows the direct, indirect and total effect trajectories well, since these effects are calculated by subtracting the three interventional trajectories.
We can inspect Fig. [2] to understand how the considered benchmark models fit to the synthetic training data. We see that the simple intercept response model of S17 does not capture the meal response curves well, e.g., the constant response (pink dashed line) in Fig. 12c roughly between 5am 6pm (in the effective meal periods). Similarly, the linear mediator response function of 722 is unable to capture the complex, non-linear meal response, e-g., simple constant responses in the purple dashed line in Fig. 12c for the time periods [5, 8). [9, 17] and [19, 22]. We see that the non-parametric benchmark model H22 has a glucose baseline and a meal response that is averaged over the pre- and post-surgery periods, e.g., the under-oracle glucose baseline of H22 in Fig. 12a and the above-oracle glucose baseline of H22 in Fig. 12c (brown dashed lines). Similarly, we see the model fit for the non-interacting mediator benchmark model (pink dashed intensity lines in bottom panels of Figs. 12a to [2c), and does not capture the dynamic, long-range dependence between the past meal-glucos. measurements and the future meals.
D
Additional Results
D.1
Sensitivity Analysis
In this section, we perform sensitivity analysis by creating hypothetical confodnnnn scenario in which the causal assumptions do no longer hold. In such a scenario, a hidden confounder that affects both the mediator and the outcome sequences also can be seen as source of model misspecification. Therefore, our goals are to understand: (i) how sensitive the model predictions are to the causal assumptions, and (ii) how our model behaves under model misspecification.
Setup. To create a hypothetical hidden-ccoffounding scenario, we assume that patients are advised to be more active after the surgery in the observational (training) data. We sample an unobserved binary confounder C, for being active during the period of each meal with probability 3: C. (B)) If active in the meal period, patient both (i) eats more (bias in meal dosage m: Mactive m² 12), and (ii) their glucose peaks less (bias in response to a meal via the response magnitude Mettective m² mm244 /4). We vary the amount of confounding by considering 3 E {0.0, 0.2, 0.4, 0.6, 0.8, 1.0]. where 3 = 0 corresponds to the case of no unobserved confounding (NUC). Under this scenario, the models will learn biased estimates for meal amounts and meal responses.
We consider three different interventional distributions test time to understand how the models behave under unbiased or biased estimates: (i) same as the observational data where the patients are advised be active with the same probability 3 in the post-surgery period, (ii) the patients are advised to be active with the same probability 3 in the pre-surgery period, and (iii) the patients are not advised at all. The interventional distribution in (i) the closest to the observational distribution, while the mismatch between the observational distribution and the interventional distributions in (ii) and (iii) increase for larger 3 values.
For each case, we report the MSE in the natural direct effect NDE(fa) = YY (e, Fa] Y,,, [a], the natural indirect effect NIE(f.) = Y [e, - Yr, [0, [2, and the total effect TE((.) = YY, V., F.] Y. 2 Ø We repeat the experiments 10 times, and report the mean and
Results.
+1 standard deviation in Figs. 13 to 15
From Fig. 13 we see that the results are inconsistent when the same hidden confounding is applied
to the training and test data. Even though the model makes biased predictions of meal dosages and responses, it is not penalized at test time since the test data has the same bias on average. In Figs. [4] [5] the hidden confounding between the train and test data different, i.e., the models are forced to make biased estimates.
33

---

In Figs. 44a and 15a the MSE of NDE(ta) rises noticeably with the increased confounding level 3. This not surprising as the confounding biases both the post-surgery glucose response to meals (which affects Yt, Pay (a) and the post-surgery meal dosages (which affects Ysi, [ fa] and 12, (.))).. For our model, the MSE rises more pronouncedly compared the baselines, because the latter were already misspecified to start with. In Figs. 14b and 15b the MSE of NIE(Ea)
changes less with increased confounding compared to NDE(fa). the post-surgery meal times
not affected by the confounding, and the dosage bias (which affects only Ysi, [0,t,]
Fg)) affects the
performance in NIB(ta) less compared the response bias in NDE(Fa). In Figs. 14c and 15c the MSE in TE(fa) increases with confounding. However, this is less pronounced than for NDE(ta). as the confounding bias only affects Y >i, L fal.
06
201-1
Za1-1
221-1
0.4
Ove
MSF
MSR
0.3
000
02
112
11.
1.0
010
02:2
Degroe of confounding,
Degree of confounding, /
Degroe confounding,
(a) NDE(fa).
(b) NIE(fa).
(c) TE((.).
Figure 13: MSE for NDE, NIE, TE for the confounding scenario (i), where the patients are advised to be active also the post-surgery period in the test data, i.e., the same hidden confounding training and test data.
0.5
X33
221-1
221-1
221-1
0.4
Oui
MSR
MSR
1032
0.3
000
03
02
0.4
0.5
000
000
022
1.0
000
000
02
Degree of confounding,
Degree of confoundingg 8
Degroe confounding, 8
(a) NDE(Fa).
(b) NIF(Fa).
(c) TE(f.)-
Figure 14: MSE for NDE, NIE, TE for the confounding scenario (ii). where the patients are advised be active in the pre-surgery period in the test data, i.e., different hidden confounding in training and test data.
11.
168
315
333
221-1
221-1
221-2
0.0
Ova
MSF
062
000
60
03"
0.5
1.0
n0
05"
1.0
60
06 Degree of confounding, /
00
Degree of confounding, /
Degree of confounding, /
(a) NDE(fa).
(b) NIE(FA).
(c) TE(F.).
Figure 15: MSE for NDE, NIE, TE for the confounding scenario (iii), where the patients are not advised to be active in the test data, i.e., hidden confounding in the training data, no hidden confounding in the test data.
34


Reviews:
[{"review_id": "ssizbDkYHH", "reviewer": "Reviewer_bzqS", "summary": "The paper's outstanding qualities lie in its well-articulated presentation and its precise experimental design. It amalgamates the earlier research findings of [Zeng et al., 2021] and [Hızlı et al., 2022] with the innovative notions put forth by [Robins et al., 2022] on indirect effects. The authors tackle pragmatic issues, such as the effects of surgery on a patient's blood sugar levels in relation to their diet, by formulating pertinent questions. For instance, they question whether optimal post-surgery mediation can entirely regulate blood sugar levels, or if there exist uncontrollable surgery-induced effects on blood sugar levels that resist management through mediation and diet adjustments.\n\nIn their methodological approach, the authors utilize non-parametric models of the temporal data-generating process. They employ a Marked Point Process (MPP) akin to [Hızlı et al., 2022] for meal intake (the mediating factor) and a non-parametric Gaussian Process (GP) for the outcome. The former is modeled as a combination of a counting process (number of meals) and a dosage process (carb intake per meal) using a non-parametric Poisson Process and the latter as a Gaussian process. The mediator model is trained to predict the mediator based on the intervention and the outcome model is trained with both the mediator and intervention given as input. This approach is put to the test in a series of synthetic experiments, validating its predictive strength against baseline models like Zeng et al., 2021. They further apply it in a real-world setting, successfully reproducing biological insights and potentially addressing the question of the degree to which surgery impacts diet changes.\n\nWhile at first glance, this paper might seem to bear similarities to [Hızlı et al., 2022], it stands out through its adept combination of the best methods for examining direct and indirect cause-and-effect relationships in a temporal setting. The paper, with its organized code and clear writing style, has the potential to become a valuable asset. However, I'm leaning towards accepting this paper on the condition that certain concerns regarding its originality and novelty are addressed, which I will detail in the following.", "questions": "1. Even though the paper presents a succinct and coherent narrative, it's hard to ignore that the methodology could easily extend to cases where the intervention itself is also a point process. For instance, one might consider a patient's long-term history and periodic clinical treatments. In such scenarios, $NIE$ and $NDE$ could be defined at different time points. It might be beneficial to include the theory behind this in the appendix section. The theoretical framework in sections 2 and 3 would work if one defines $N_A: [0, T] \\to \\mathbb{N}$, and instead of developing two distinct models, a more comprehensive model could be formulated that includes the history of interventions. This approach could also minimize the chance of future incremental papers being published.\n2. What is the model's predictive power under model misspecification? Currently, the paper only presents results assessing predictive power in semi-synthetic scenarios where the model is appropriately specified. However, it would be beneficial to conduct experiments in scenarios reflective of real-world settings where model misspecification is common. Although the paper does incorporate a real-world setting, it is used merely for extracting qualitative observations. A comparative analysis of prediction power, similar to the semi-synthetic scenario but including model misspecification, is missing.", "limitations": "1. Like any causality-oriented study, this paper relies on certain assumptions for its model to function effectively. However, the authors have acknowledged this constraint adequately. They have also indicated possible real-world scenarios with hidden confounders where these assumptions might be compromised. This demonstrates a good understanding of the model's limitations.\n2. A further limitation of the method, as previously hinted, is its inability to handle more complex interventions. Currently, the model considers total effect, direct, and indirect effect only in relation to a unitary, binary intervention point process. It could potentially be enhanced by extending its capacity to accommodate non-binary scenarios (for different intervention styles, such as dosage treatments) or non-unitary processes (considering the entire electronic health record of a patient over a long period), which could provide a more comprehensive understanding.", "rating": 7, "confidence": 3, "soundness": 4, "presentation": 4, "contribution": 2, "strengths": "1. The paper is commendable for its realistic problem setup, which is articulated in Section 5.1 dealing with corner cases where the assumptions might falter: the existence of hidden confoundings and the violation of assumptions A.1 to A.3. Such validation is crucial in causal studies to confirm assumptions and identify any unnoticed confoundings that may influence our conclusions. Furthermore, the experiments and predictions are consistent with the clinically significant direct and indirect impacts of bariatric surgery on blood glucose levels.\n2. The approach to modeling the temporal dynamic is robust, anchoring its foundation on recent, proven work that adds to its credibility.\n3. The paper's eloquent presentation is worthy of note. The reading experience is enhanced by effective use of color-coding to differentiate between mediator and direct interventions. A minor suggestion would be to consider adaptations for grayscale printed versions of the paper. For instance, the caption of Figure (2) includes light and dark blue color coding, which could be made more distinguishable by slightly altering the arrow patterns.", "weaknesses": "1. The theoretical advancement of the study appears relatively marginal. While the exploration of direct vs. indirect causal effects in a temporal setting is engaging and the experiments provide valuable insights, I have some reservations about two of the claimed main contributions:\n* Dynamic causal mediation with a point process mediator: [Hızlı et al., 2022] have previously introduced point process mediator modeling. The novelty here is questionable, given that in the prior work, the treatment was the mediator itself.\n* A mediator-outcome model with an external intervention: The distinctiveness here is the training of two models: pre-intervention and post-intervention. However, the applied intervention is overly simplistic, offering limited theoretical innovation or insight. I have proposed, in the \"Questions\" section, the inclusion of the theory behind more complex interventions and experimentation on the simpler case. Yet, as it stands, this contribution mainly replicates the approach from [Hızlı et al., 2022], but uses two models to account for the intervention.\n2. Table 1 presents results suggesting that the direct causal impact of surgery outweighs its indirect effects. Although the insights from 5.1.3 and 5.1.2 align with existing studies, there seems to be no supportive evidence for this hypothesis. Perhaps incorporating relevant literature explanations into the discussion would be beneficial. While the coherence between findings in 5.1.2 and 5.1.3 lend some validation to the model, it would still be advantageous to have literature support for 5.1.4.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you for your thorough feedback! In the following we hope to address your concerns regarding originality and novelty:\n\n**Dynamic causal mediation with point process mediator:**\nWe emphasize that the whole formulation of the problem with point process mediator and outcome, as well as defining what direct and indirect effects mean in this context and proving their identifiability, are novel contributions, even if the model used in the estimation builds on existing works. The significant difference between our work and [Hizli+2022] is the problem that we are solving, namely dynamic causal mediation. In [Hizli+2022], while the treatments could be considered as mediators, there are no direct arrows from the intervened variable (the policy) to the outcomes. The direct/indirect effect estimation problem with the included direct arrows is fundamentally harder and even unidentifiable within the potential outcome based formulation of [Hizli+2022], when the mediator–outcome processes interact. Notice that [Zeng+2021] exclude arrows from the past outcomes to the future mediators due to the same reason. We solve this by following the interventionist approach to causal mediation [Robins+22].\n\n**Extension to more complex interventions:**\nFollowing your suggestion, we have extended the current problem setup to a sequence of (hard) interventions, possibly containing non-binary or non-unitary treatments, and will add this to the text. Here, we only briefly specify the differences compared to Section A.2 and provide the final result. We are happy to provide further details during the discussion period.\n\nWe define the direct, indirect, and total causal effects as differences in the potential outcomes with respect to two intervention sequences: (i) a target treatment sequence $\\mathbf{a}^1 = \\{a^1_1, \\ldots, a^1_{N_1}\\}$ (similar to the surgery in the current setup), and (ii) a reference treatment sequence $\\mathbf{a}^0 = \\{a^0_1, \\ldots, a^0_{N_0}\\}$ (similar to the “no treatment” in the current setup). To answer the causal queries, we need to identify the counterfactual trajectory $\\mathbf{Y}[\\text{direct path}=\\mathbf{a}^0, \\text{indirect path}=\\mathbf{a}^1]$, which is the outcome under the intervention that sets the direct-path treatment sequence to $\\mathbf{a}^0$ and the indirect-path treatment sequence to $\\mathbf{a}^1$. The final result is\n\n$$P(Y_{\\mathbf{q}}[\\mathbf{a}^0, \\mathbf{a}^1]) = \\sum_{M_{ > t_a}} \\prod_{r=0}^{R-1} P(Y_{q_{r+1}} | \\mathbf{A} = \\mathbf{a}^0_{ < q_{r+1}}, M_{[q_r, q_{r+1})}, \\mathcal{H}_{\\leq q_r}) \\quad $$\n\n$$\\qquad\\times P(M_{[q_r, t_p]} | \\mathbf{A} = \\mathbf{a}^1_{ < q_r}, \\mathcal{H}_{\\leq q_r}) $$\n\n$$\\qquad\\times P(M_{(t_p, q_{r+1})} | \\mathbf{A} = \\mathbf{a}^1_{\\leq t_p}, M_{[q_r, t_p]}, \\mathcal{H}_{\\leq q_r})$$\n\n$t_p$ represents a possible treatment time in the sequence $\\mathbf{a}^1$ that falls in the interval $[q_r, q_{r+1}]$. Different from Eq. (7) of our submission, to account for such a treatment $a_p=(t_p,d_p)$, we divide the mediator process into two parts, both conditioned on the treatments up to the start of their interval. Without loss of generality, we consider only a single treatment in the interval $[q_r, q_{r+1})$ at time $t_p$. It can easily be extended to multiple treatments, leading to further factorization of the mediators in the interval. As you also suggested, this implies that mediator and outcome models should depend on the history of the intervention sequence. This can be either (i) included in the current GP framework by concatenating a summary of the history to the kernel inputs, or (ii) modeled with a more expressive model such as a neural ODE.\n\nIf the treatment sequences are further considered as a set of stochastic (soft) interventions in continuous time similar to [Hizli+22], then this can be considered as a point process. Accordingly, the above result can be further extended, similar to the extension of [Schulam+17] to [Hizli+22]. This can be achieved by averaging the above result over all possible treatment sequences, i.e., adding the probability of observing the treatment sequence in each interval to the above equation and integrating out the whole treatment sequence.\n\n**Literature support for 5.1.4:**\nPrompted by your comment, we delved deeper into the medical literature and found Laferrère et al., The Journal of Clinical Endocrinology & Metabolism 93 (7), 2008, who study the effects of two different interventions—namely, dietary changes and surgical procedures—on individuals who had lost equal amounts of weight (10 kg). The study focuses on the impact of a 50 g glucose dose, notably showcasing a more pronounced decline, particularly towards the conclusion of the test, in the surgery group compared to the control group. Because all patients received the same meal, this decline corresponds to the direct effect. This direct effect can be attributed to a range of intricate hormonal influences, including the involvement of gut hormones like GLP-1, alongside heightened insulin peaks subsequent to surgical intervention.\n\nHence, application-wise, the novelty of our work lies in its exploration, by computational means, of the contribution of dietary change vs. predicted metabolic changes within a person. To our knowledge, there have been no existing models for this, making our work a pioneering contribution. We have added this reference and discussion in Section 5.1.4.\n\n**Predictive power under model misspecification:**\nThe benchmarks in our semi-synthetic study already include misspecified models with respect to the ground-truth simulator (which is the same as the most complex model). Our empirical findings (Table 2) suggest that the performance deteriorates proportional to the amount of misspecification. Nevertheless, we agree that it is good to study model misspecification more systematically. We combined this idea with *Reviewer NnCo*’s question (Q3) about the performance under hidden confounding. Please see our response there."}, {"review_id": "d3N1YF1vma", "reviewer": "Reviewer_jr2N", "summary": "The paper defines direct and indirect effects in complex healthcare time-series as dynamic stochastic processes and theoretically provides causal assumptions for identifiability. This model allows for an external intervention influencing both mediator and outcome sequences simultaneously and captures time-delayed interactions among them.", "questions": "1.\tWhat advantage does the utilization of a marked point process offer in modeling mediators compared to the approach in [1], where the observed mediator is considered as drawn from a smooth underlying process?\n2.\tDoes the proposed method allow for modeling a high-dimensional observed mediator?\n3.\tIn line 119-120, the mediator process M considers the number of occurrences of the mediating event up until time $\\tau$ and the value of the mediator at time $\\tau$. I'm curious if the occurrence count alone is sufficient to model the process, or if the past values of the mediator should also be considered?\n4.\tRegarding line 146, how is the continuation of the outcome after the intervention at $t_a$ represented? Should it be an equal average over all timepoints post $t_a$, or should it be a weighted average giving more importance to timepoints closer to $t_a$?\n5.\tFor quick clarification, in line 159, $H_{\\leq \\tau}$ refers to the history up until time $\\tau$. Does this history include both mediator and outcome?\n\nReference\n\n[1] Zeng, Shuxi, et al. \"Causal mediation analysis for sparse and irregular longitudinal data.\" The Annals of Applied Statistics15.2 (2021): 747-767.", "limitations": "Yes, the authors addressed their limitation, which involve untestable causal assumptions and scalability of the method to larger data sets.", "rating": 5, "confidence": 3, "soundness": 3, "presentation": 2, "contribution": 3, "strengths": "1.\tThe authors proficiently present the estimated direct and indirect effects as longitudinal counterfactual trajectories, along with the requisite theoretical causal assumptions for their identification.\n2.\tThe method proposed is neat and articulated with good clarity.", "weaknesses": "1.\tThe method's scalability to larger datasets poses a concern. There exists many methods specifically designed for high-dimensional mediation analysis in time series [1][2][3]. It would be enlightening to observe how the proposed method compares to these in handling complex datasets.\n2.\tTo my understanding, Figure 1a may not accurately depict Zeng et al. 2021 [4]. It seems the original work allows for past mediators to have an influence on future outcomes.\n\nReferences\n\n[1] Chén, Oliver Y., et al. \"High-dimensional multivariate mediation with application to neuroimaging data.\" Biostatistics 19.2 (2018): 121-136.\n\n[2] Zhang, Haixiang, et al. \"Mediation analysis for survival data with high-dimensional mediators.\" Bioinformatics 37.21 (2021): 3815-3821.\n\n[3] Luo, Chengwen, et al. \"High-dimensional mediation analysis in survival models.\" PLoS computational biology 16.4 (2020): e1007768.\n\n[4] Zeng, Shuxi, et al. \"Causal mediation analysis for sparse and irregular longitudinal data.\" The Annals of Applied Statistics15.2 (2021): 747-767.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you for appreciating the articulation of our proposed method and for your valuable questions. We hope we can further clarify and address your concerns in the following:\n\n**Regarding scalability:**\nThere appears to be a misunderstanding, as the works referred to [Chen+18, Luo+20, Zhang+21] are not for time-series, but for the static causal mediation with a single, high-dimensional mediator. Hence, it is not possible to directly compare them to our method.\n\nWe discuss scalability to a larger number of data points as a main limitation in the conclusion and provide further details in Appendix B. For standard Gaussian processes (GP), as in our outcome model, the computational complexity is $\\mathcal{O}(N^3)$ where $N$ is the number of training data points. For GPs with inducing point approximations, as in our mediator model, the complexity is $\\mathcal{O}(NM^2)$, where $M$ is the number of inducing points. Improving these is an important future research direction but falls outside the scope of the present work.\n\nRegarding the scalability to higher-dimensional mediators, there is no fundamental restriction on the dimensionality of the mediator dimensionality in our joint distribution in Eq. (7). As our main contribution lies in the formulation of the dynamic causal mediation problem, which is not restricted to just GP-based modeling, we could replace the GP-based mediator model for example with a neural ODE to handle high-dimensional dynamics. This also is beyond the scope of the current work and can be an exciting future direction.\n\n**Regarding accuracy of depiction of [Zeng+2021]:**\nWe assume this refers to our Figure *2*a. To clarify, [Zeng+2021] “assume the effect of the mediation process on the outcome is concurrent, namely the outcome process at time $t$ does not depend on the past value of the mediation process” (their paragraph leading to Eq. (4.9); see also Eq. (4.9)). This is what we show in the figure. Nonetheless, [Zeng+2021] indeed include a potential influence from past mediators to future outcomes in their _theoretical_ framework, but this cannot be solved analytically. We have updated the caption of our figure to clarify this point.\n\n\nRegarding your remaining questions:\n\n**Q1: Comparison of point process mediators to high-dimensional mediators in [Zeng+2021], “where the observed mediator is considered as drawn from a smooth underlying process”:**\nThe data we are considering are fundamentally discrete events, for which point processes are an appropriate model, and a smooth process would not be because it neglects the information in the event times. In other applications, where event times are non-informative, a smooth mediator process might be appropriate.\n\n**Q2: Allowing for a high-dimensional observed mediator?**\nOur method/problem formulation is agnostic to the choice of models. With the current setup including a GP-based mediator model, modeling high-dimensional mediators such as images may not be feasible. However, this could be an interesting future direction and for example, a suitable model such as a neural ODE could be used as the mediator mark intensity to capture high-dimensional dynamics.\n\n**Q3: Clarification of the Mediator Process definition (line 119-120):**\nWe condition on the history of the whole process, which actually also includes the previous mediator values. Hence, our model does consider the past mediator values as well. We thank you for pointing out this aspect that would benefit from additional clarification, and we have improved the text correspondingly.\n\n**Q4: Clarification of the Outcome Process definition (line 146):**\nThe outcome process definition $Y_{>t_a} = \\{Y(\\tau): \\tau > t_a\\}$ is the stochastic process defined on the interval $[t_a, T]$ as described by the fitted model. As such it describes the *entire* future trajectory, not a single value (such as an average over time points). We have made this more explicit in the manuscript.\n\n**Q5: History definition (line 159):**\nYes, it includes both mediators and outcomes. We have now made this explicit in the manuscript."}, {"review_id": "vhZy9NHdzc", "reviewer": "Reviewer_NnCo", "summary": "The paper aims to estimate the direct and indirect treatment effects of healthcare interventions. The authors model the mediator as a point process and propose a non-parametric mediator–outcome model where the mediator is assumed to be a temporal point process that interacts with the outcome process. The authors conduct experiments on a real-world RCT dataset and a semi-synthetic dataset. The experiments on the synthetic dataset show that the proposed model outperforms the baselines on the treatment effect estimation tasks.", "questions": "See above.", "limitations": "NA", "rating": 5, "confidence": 4, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "- The authors propose a new approach to model the direct and indirect effects of healthcare interventions.\n- The authors conduct experiments on both real-world and semi-synthetic datasets. The results demonstrate that the proposed model outperforms the baselines.\n- The implementation code is available.\n", "weaknesses": "- Treatment A, as the confounder, affects both mediator M and outcome Y. M affects Y. \nThe confounding bias would make the estimation E[Y|A,M] inaccurate. Figure 5 shows the difference of diet density pre- and post-surgery, which demonstrates the existence of confounding bias. Without consideration of the confounders, the direct and indirect treatment effect estimation could be inaccurate.\n- The authors claim that (A1, A2, A3) might not hold in observational studies and they are not statistically testable. I have the concern that if the assumptions do not hold, can the proposed model be applied to real-world applications? How to evaluate the potential risk of the model.\n- A1，A2，A3 are very strong assumptions. In real-world settings, the no-unobserved confounder assumption may not hold, so it is necessary to conduct a sensitivity analysis of how sensitive or robust the proposed models are to the unobserved confounders. \n- Bariatric surgery could cause weight loss. Another mediator weight would significantly change after the surgery.\n- Some details are missing.  The authors just use diet and surgery to predict blood glucose. Is any detailed information about the diet, like nutrients including sugar, and starch? Are patients’ demographics (weights, age, height) used in the experiments? \n- It would be better if the authors display the factual prediction performance, like MSE for glucose prediction.\n- It is unclear what the variables m and o in Eq. (9) mean.\n", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you for your feedback and questions, which we hope to address in the following and with which we have improved the manuscript:\n\n**1. Confounding bias of treatment $A$ on mediator $M$ and outcome $Y$:**\nPlease note that the estimation of $E[Y|A,M]$ is not confounded by $A$, because $A$ is included in the conditioning set. However, if there were unobserved confounders affecting for example $Y$ and $A$, then these confounders would bias the estimation. Our assumption A1 essentially is that there are no such unobserved confounders. \n\n\n\n\n**2. Application to real-world problems when causal assumptions A1, A2, A3 do not hold:**\nWe agree that causal assumptions (A1, A2, A3) may not hold in real-world applications, that is why we included a discussion of causal assumptions in the real-world experiment in Section 5.1 and highlighted this as one of the main limitations. Note that this limitation applies to causality literature in general. Nevertheless, in our real-world study everybody undergoes the surgery, which rules out the possibility of a confounder affecting both the surgery and the outcome (A1).\n\n\n\n\n\n**3. Sensitivity analysis of NUC assumption:**\nThe violation of the NUC assumption would result in an error in the causal effect estimates due to the unblocked back-door paths, whose magnitude depends on the size of the violation. We agree that an interesting future direction is to extend existing sensitivity analysis methods (Robins et al., 2000b) in order to estimate the size of the error in the present setting, but this is beyond the scope of the present article.\nNevertheless, we decided to add another experiment to demonstrate the effect of hidden confounding, and combined this with *Reviewer bzqS*’s question about model misspecification. In the experiment, we created a hidden-confounding scenario where after the surgery, patients are advised to be more active. We sample an unobserved binary confounder for being active for each meal period with probability $\\beta$. If active, a patient both (i) eats more, and (ii) their glucose peaks less. The results are shown in Figure 1 in the attached PDF, and shows a decline in estimation accuracy when the amount of hidden confounding increases. We are happy to take feedback during the author-reviewer discussion and improve this further towards the final version.\n\n\n\n\n\n\n**4. Handling of other mediators, e.g., weight loss:**\nAs described in the *Dataset* paragraph of the experimental details in Appendix C.1, the post-surgery data is collected right after the surgery (within 2 weeks), and in this early period after the surgery, weight loss is not considered as a mediator [Bojsen-Møller+14]. Yet, this comment applies to all other possible mediators, and we agree that further discussion is beneficial.\n\nThere are many possible mediators that could be added into the model, e.g., gut hormones, weight loss, hepatic insulin sensitivity, etc. In our real-world application, we focus on the dynamic causal mediation problem, where the sequence of meals is the mediator of the effect of surgery on blood glucose. In this definition, the rest of the metabolic processes, weight loss, or any other mediator through which the surgery could affect blood glucose, are included in the “direct effect”. An extension to more mediators and an explicit quantification of the corresponding indirect effects will be an interesting future direction, especially from a medical point of view, but beyond the scope of the current work.\n\n\n**5. Missing details on nutrient information and patient characteristics:**\nThank you for pointing this out. The nutrient information was processed into carbohydrate amounts for each meal, equaling the sum of sugar and starch. Patients were non-diabetic individuals who had had bariatric surgery. More detailed patient characteristics were not available for our study due to data privacy. We have updated the manuscript accordingly and are happy to provide details during the discussion period if needed.\n\n\n\n**6. Factual prediction performance in MSE:**\nCould you please clarify what you mean by “factual prediction performance” and what you hope to learn from the results? Do you mean the MSE of the blood glucose over the entire test set trajectory, as predicted by each model? We have run this and show the results in Table 1 in the attached PDF. Note that this depends only on the outcome models and will not assess performance of the mediator models.\n\n\n**7. Clarification of m and o in Eq. 9:**\nThey refer to the list of all past mediators and past outcomes, respectively. In our implementation, the mediator effect $g_m(\\tau; \\mathbf{m})$ depends on the relative times of the last $Q_m$ mediators (meals), and the outcome effect $g_o(\\tau; \\mathbf{o})$ depends on the relative times and values of the last $Q_o$ glucose outcome measurements, as described in Appendix B.3.1. We have clarified this in the manuscript.\n"}, {"review_id": "pMh3fk6aD3", "reviewer": "Reviewer_5ke6", "summary": "This paper studies how to estimate the direct and indirect effctes of healthcare interventions. The general idea of this paper is to model the mediation process and outcome process jointly. More specifically, it considers the mediation process as a temporal point process conditioned on the past mediation, outcome and treatment data. It allows two causal paths: direct path models the direct effect of treatment and indirect path models the path treatment->mediation->outcome. The authors prove that under their three assumptions, the two effects can be represented by two terms in their non-paraametric temporal point process model. Experimental results shows the advantage of their proposed model.", "questions": "Did you consider that in real world, the treatment may be correlated with the outcome, leading to bias in the model? \n\nDid you try to reduce the issue with IPTW or other method to debias?", "limitations": "They have discussed.", "rating": 7, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "(1) The proposed model studies an interesting problem: how to distinguish indirect and direct effect, which is important in healthcare\n\n(2) The overall design of their causal model are reasonable. Althought their assumptions are not easy to verify on the data, they have tried their best to give convincing analysis to the data.\n\n(3) The motivation is clear and convincing.", "weaknesses": "(1) Did you consider that in real world, the treatment may be correlated with the outcome, leading to bias in the model? Did you try to reduce the issue with IPTW or other method to debias?\n\n(2) Some recent related works about handling treatment effect and causal inference with non-parametric temporal point process model are missing. For example, [1] studies the treatment effect in healcare, too. [2] considers how to debias the neural temporal point process in the context of social media analysis. [3] studies how to sample the counterfactual sequences from temporal point process.\n\n[1] Gao, Tian, et al. Causal Inference for Event Pairs in Multivariate Point Processes. NeurIPS 2021\n\n[2] Zhang, Yizhou, et al. Counterfactual Neural Temporal Point Process for Estimating Causal Influence of Misinformation on Social Media. NeurIPS 2022.\n\n[3] Noorbakhsh, Kimia , and M. G. Rodriguez . Counterfactual Temporal Point Processes. NeurIPS 2022.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We are glad that you find our problem setting and approach both interesting and relevant. Thank you for highlighting the clarity of our motivation and the design of the causal model and analysis!\n\n**Regarding treatment–outcome correlation and potential bias:**\nIn our real-world case-study, as discussed in the Causal Assumptions paragraph in Section 5.1, all patients undergo the surgery. Thus the probability of the treatment is independent of past outcomes. Hence, in this setup, there is no need to debias the effect estimations.\n\nHowever, if there were unobserved confounders affecting for example $Y$ and $A$, debiasing methods such as IPTW may of course be relevant. Thank you for making this important point, which we have added to the manuscript.\n\n**Regarding references on causal inference with temporal point processes:**\nThank you for pointing out these references. We have now included them in the introduction.\n"}]

Author rebuttal:
We thank all reviewers for their time and effort in writing thoughtful and valuable reviews. Overall, the reviews appear positive about our submission. We are happy for the explicit commendations of our realistic and relevant problem setup, robust modeling approach, and clarity of our presentation and experimental design.

In response to the reviews, we have extended our framework to the more general case where the intervention is itself a sequence of treatments (see response to Reviewer bzqS). Furthermore, we added a new experiment to study the effect of unobserved confounders and model misspecification (see response to Reviewer NnCo). We have clarified the manuscript as described in the individual responses thanks to the feedback and questions from all reviewers.

We hope we have adequately addressed all open questions in the individual responses and are looking forward to the discussion period.

Meta-review: This paper uses models to capture and correct for the direct and indirect effects of time-varying interventions. The work models the mediation process as a temporal point process conditioned on the past mediation and a non-parametric Gaussian Process for the outcome model (conditional on the mediator). The mediator model is trained to predict the mediator conditional on intervention and the outcome model is trained using the mediator and intervention as input. The model is evaluated in synthetic data against several existing baselines using a semi-synthetic dataset where its efficacy is verified after which it is evaluated on real data.

The reviewers, on average found the work well written, easy to follow, and even if incremental in terms of theoretical advance, felt the work presented a useful practical example of leveraging ML tools for capturing treatment effects in the presence of mediators in time series data. During the author discussion phase, the reviewers request additional experiments assessing the degree to which the model was affected by unobserved confounding -- the authors ran experiments in the form of sensitivity analysis studying how their treatment effects varied due to weaker and stronger confounding.

These results should be incorporated and discussed in the final revision. In addition to the other fixes detailed in the discussion period, as discussed with Reviewer NnCo, please do also include the variant of the experiment and the effect of confounding at evaluation time (test data).
Decision: Accept (poster)