SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Comparison with the MSM and its extensions: In the following, we show that the weighted GMSM extends popular sensitivity models from the literature. Proofs are in Appendix C. Note that existing sensitivity models do not consider settings with mediators (i.e.,  $\ell = 0$ ), we thus can write  $\Gamma = \Gamma_{Y}$  for the sensitivity parameter,  $q(\mathbf{a},\mathbf{x}) = q_{Y}(\mathbf{a},\mathbf{x})$  for the weight function, and  $\mathbf{U} = \mathbf{U}_Y$  for the unobserved confounders. For binary treatments  $\mathbf{A} = A\in \{0,1\}$ , the marginal sensitivity model (MSM) [67] is defined via  $\frac{1}{\Gamma}\leq \frac{\pi(\mathbf{x})}{1 - \pi(\mathbf{x})}\frac{1 - \pi(\mathbf{x},\mathbf{u})}{\pi(\mathbf{x},\mathbf{u})}\leq \Gamma$ , where  $\pi (\mathbf{x}) = \mathbb{P}(A = 1\mid \mathbf{x})$  denotes the observed propensity score and  $\pi (\mathbf{x},\mathbf{u}) = \mathbb{P}(A = 1\mid \mathbf{x},\mathbf{u})$  denotes the full propensity score. For continuous treatments  $\mathbf{A}$ , the continuous marginal sensitivity model (CMSM) [32] is defined via  $\frac{1}{\Gamma}\leq \frac{\mathbb{P}(\mathbf{a}|\mathbf{x},\mathbf{u})}{\mathbb{P}(\mathbf{a}|\mathbf{x})}\leq \Gamma$ . For longitudinal settings with time-varying observed confounders  $\mathbf{X} = (\mathbf{X}_1,\dots ,\mathbf{X}_T)$ , unobserved confounders  $\mathbf{U} = (\mathbf{U}_1,\dots ,\mathbf{U}_T)$ , treatments  $\mathbf{A} = (\mathbf{A}_1,\dots ,\mathbf{A}_T)$ , we define the longitudinal marginal sensitivity model (LMSM) via  $\frac{1}{\Gamma}\leq \prod_{t = 1}^{T}\frac{\mathbb{P}(\bar{\mathbf{a}}_t|\bar{\mathbf{x}}_T,\bar{\mathbf{u}}_t,\bar{\mathbf{a}}_{t - 1})}{\mathbb{P}(\bar{\mathbf{a}}_t|\bar{\mathbf{x}}_T,\bar{\mathbf{a}}_{t - 1})}\leq \Gamma$ .
Lemma 1. The MSM, CMSM and LMSM are special cases of the weighted GMSM by choosing the weight functions  $q(\mathbf{a},\mathbf{x}) = \mathbb{P}(\mathbf{a}\mid \mathbf{x})$  (MSM) and  $q(\mathbf{a},\mathbf{x}) = 0$  (CMSM, LMSM).
Lemma 1 provides a new interpretation of the MSM: If the probability  $\mathbb{P}(\mathbf{a} \mid \mathbf{x})$  is large, the MSM restricts the confounding strength because most of the randomness in the treatment is already explained by the observed confounders  $\mathbf{x}$ . We can extend this approach to arbitrary discrete treatments within the weighted GMSM framework. The CMSM and LMSM apply the same confounding restriction for all  $\mathbf{a}$  and  $\mathbf{x}$ .
4 Bounding causal effects under the GMSM
In this section, we derive sharp bounds under our GMSM. We first quantify the maximal shift in conditional distributions (Sec. 4.1). This allows us to derive an algorithm to compute explicit bounds (Sec. 4.2). Finally, we show how these bounds can be estimated from finite data (Sec. 4.3).
4.1 Shifting interventional distributions
In the following, we provide some intuition before stating the main result. Let us consider a simple setting with treatment  $\mathbf{A}$ , a single unobserved confounder  $\mathbf{U}_Y = U \in \mathbb{R}$ , outcome  $Y$ , and GMSM bounds  $s_Y^-(\mathbf{a})$  and  $s_Y^+(\mathbf{a})$  (see Fig. 2, left). Any SCM  $\mathcal{M}$  that is compatible with  $S$  describes the relationship between  $\mathbf{A}$ ,  $U$ , and  $Y$  via a functional assignment  $Y = f_Y(\mathbf{A}, U)$ . For a fixed treatment  $\mathbf{a}$ , we denote  $f_Y(\mathbf{a}, \cdot)$  as  $f_{\mathbf{a}}$ . We are interested in the interventional density  $\mathbb{P}(y \mid do(\mathbf{A} = \mathbf{a})) = \int \mathbb{P}(y \mid \mathbf{a}, u) \mathbb{P}(u) \, \mathrm{d}u = f_{\mathbf{a}\#} \mathbb{P}^U(y)$ , where  $f_{\mathbf{a}\#} \mathbb{P}^U$  denotes the push-forward distribution induced by  $f_{\mathbf{a}}$  on  $\mathbb{P}^U$ . However, we only have access to the observational density  $\mathbb{P}(y \mid \mathbf{a}) = \int \mathbb{P}(y \mid \mathbf{a}, u) \mathbb{P}(u \mid \mathbf{a}) \, \mathrm{d}u = f_{\mathbf{a}\#} \mathbb{P}^{U|\mathbf{a}}(y)$ . Hence, for a fixed functional assignment  $f_{\mathbf{a}}$ , we can quantify the discrepancy between  $\mathbb{P}(y \mid do(\mathbf{A} = \mathbf{a}))$  and  $\mathbb{P}(y \mid \mathbf{a})$  via the distribution shift between  $\mathbb{P}^U$  and  $\mathbb{P}^{U|\mathbf{a}}$ .
Fig. 2 shows a toy example where  $\mathbb{P}^{U|\mathbf{a}}$  is the uniform distribution on  $[0,1]$ , and the functional assignment  $f_{\mathbf{a}}$  is the inverse standard normal CDF  $\Phi^{-1}$ , so that  $\mathbb{P}(y|\mathbf{a})$  is the standard normal probability density. We now want to "right-shift" the interventional density  $\mathbb{P}(y|do(\mathbf{A} = \mathbf{a}))$  as much as possible, so that  $F(y|a) \gg F(y|do(\mathbf{A} = \mathbf{a}))$  for the CDFs. To achieve this, the distribution  $\mathbb{P}^U$  must put more probability mass on the right-hand side of the unit interval  $[0,1]$  as compared to  $\mathbb{P}^{U|\mathbf{a}}$  (see Fig. 2, left).
Then, the functional assignment will also push more probability mass to the right of  $\mathbb{P}(y\mid do(\mathbf{A} = \mathbf{a}))$  as compared to  $\mathbb{P}(y\mid \mathbf{a})$  (see Fig. 2, right). However, the GMSM bounds the distribution shift between  $\mathbb{P}^U$  and  $\mathbb{P}^{U|\mathbf{a}}$  via  $1 / s_{Y}^{+}(\mathbf{a})\leq \mathbb{P}(u)\leq 1 / s_{Y}^{-}(\mathbf{a})$  Eq.3 using that  $\mathbb{P}(u) = \mathbb{P}(u$  do(A=a)). Intuitively, the maximal possible right shift under the
Figure 2: Intuition for bounding interventional distributions under our GMSM.
GMSM should occur by choosing  $\mathbb{P}(u)$  so that the bounds are attained, i.e.,  $\mathbb{P}(u) = \mathbb{1}(u \leq c_Y^+)(1 / s_Y^+) + \mathbb{1}(u > c_Y^+)(1 / s_Y^-)$  for some  $c_Y^+$  that can be obtained via the normalization constraint  $\int \mathbb{P}(u) \, \mathrm{d}u = 1$ . The corresponding "right-shifted" interventional density  $\mathbb{P}_+(y \mid d o(\mathbf{A} = \mathbf{a}))$  is defined via the push-forward (see Fig. 2).
It turns out that the density  $\mathbb{P}_{+}$  ( $y \mid do(\mathbf{A} = \mathbf{a})$ ) is the maximally right-shifted interventional distribution that can be obtained under any SCM that is compatible with the GMSM. Furthermore, the above arguments can be generalized beyond the toy example from Fig. 2.
Theorem 1. Let  $\mathcal{S}$  be a GMSM with bounds  $s_W^- = s_W^-(\mathbf{a},\mathbf{x})$  and  $s_W^+ = s_W^+(\mathbf{a},\mathbf{x})$  for  $W \in \{M_1,\ldots,M_\ell,Y\}$ . We define  $c_W^+ = \frac{(1 - s_W^-)s_W^+}{s_W^+ - s_W^-}$ . If  $W \in \mathbb{R}$  is continuous, we define the probability density function
$$
\mathbb {P} _ {+} (w \mid \mathbf {x}, \mathbf {m} _ {W}, \mathbf {a}) = \left\{ \begin{array}{l l} \left(1 / s _ {W} ^ {+}\right) \mathbb {P} (w \mid \mathbf {x}, \mathbf {m} _ {W}, \mathbf {a}), & i f F (w) \leq c _ {W} ^ {+}, \\ \left(1 / s _ {W} ^ {-}\right) \mathbb {P} (w \mid \mathbf {x}, \mathbf {m} _ {W}, \mathbf {a}), & i f F (w) > c _ {W} ^ {+}, \end{array} \right. \tag {4}
$$
where  $F(\cdot)$  is the CDF corresponding to  $\mathbb{P}(\cdot \mid \mathbf{x},\mathbf{m}_W,\mathbf{a})$ . If  $W \in \mathbb{N}$  is discrete, we define the probability mass function
$$
\mathbb {P} _ {+} (w \mid \mathbf {x}, \mathbf {m} _ {W}, \mathbf {a}) = \left\{ \begin{array}{l l} (1 / s _ {W} ^ {+}) \mathbb {P} (w \mid \mathbf {x}, \mathbf {m} _ {W}, \mathbf {a}), & i f F (w) <   c _ {W} ^ {+}, \\ (1 / s _ {W} ^ {-}) \mathbb {P} (w \mid \mathbf {x}, \mathbf {m} _ {W}, \mathbf {a}), & i f F (w - 1) > c _ {W} ^ {+}, \\ (1 / s _ {W} ^ {+}) \left(c _ {W} ^ {+} - F (w - 1)\right) + (1 / s _ {W} ^ {-}) \left(F (w) - c _ {W} ^ {+}\right), e l s e. \end{array} \right. \tag {5}
$$
Let  $F_{+}(\cdot)$  denote the conditional CDF corresponding to  $\mathbb{P}_{+}(\cdot \mid \mathbf{x},\mathbf{m}_{W},\mathbf{a})$  and let  $F_{-}(\cdot)$  be the conditional CDF of  $\mathbb{P}_{-}(\cdot \mid \mathbf{x},\mathbf{m}_{W},\mathbf{a})$ , which is defined by swapping signs (in  $c_{W}$  and  $s_W$ ). For any SCM  $\mathcal{M}$ , denote the CDF corresponding to  $\mathbb{P}_{\mathcal{M}}(\cdot \mid \mathbf{x},\mathbf{m}_{W},do(\mathbf{A} = \mathbf{a}))$  as  $F_{\mathcal{M}}(\cdot)$ . Then, for all  $w$
$$
F _ {+} (w) \leq \inf  _ {\mathcal {M} \in \mathcal {C} (\mathcal {S})} F _ {\mathcal {M}} (w) \quad a n d \quad F _ {-} (w) \geq \sup  _ {\mathcal {M} \in \mathcal {C} (\mathcal {S})} F _ {\mathcal {M}} (w). \tag {6}
$$
Assume now that  $\mathbb{P}(\mathbf{u}_W\mid \mathbf{x},do(\mathbf{A} = \mathbf{a})) = \mathbb{P}(\mathbf{u}_W\mid \mathbf{x})$ . Then, the bounds are sharp (i.e., equality holds in Eq. (6)) whenever  $\mathbf{A}$  is discrete and it holds that  $1 / s_W^+ \geq \mathbb{P}(\mathbf{a}\mid \mathbf{x})$ , or  $\mathbf{A}$  is continuous.
The result in Theorem 1 does not depend on the distribution or dimensionality of unobserved confounders, and it does not depend on any specific SCM. As such, our sharp bounds are applicable to a wide class of causal effects, without restricting assumptions on the confounding structure beyond the sensitivity constraint of the GMSM.
In case  $S$  is a weighted GMSM with sensitivity parameters  $\Gamma_W$  for all  $W\in \{M_1,\ldots ,M_\ell ,Y\}$ , the quantiles  $c_{W}^{+}$  and  $c_{W}^{-}$  are of the particular simple form  $c_{W}^{+} = \Gamma_{W} / (1 + \Gamma_{W})$  and  $c_{W}^{-} = 1 / (1 + \Gamma_{W})$ . Furthermore, the discrete sharpness condition simplifies to  $(1 - \Gamma_W^{-1})q_W(\mathbf{a},\mathbf{x}) + \Gamma_W^{-1}\geq \mathbb{P}(\mathbf{a}\mid \mathbf{x})$ . In particular, the bounds are sharp whenever we choose a weighting function that satisfies  $q_{W}(\mathbf{a},\mathbf{x})\geq \mathbb{P}(\mathbf{a}\mid \mathbf{x})$ . The assumption  $\mathbb{P}(\mathbf{u}_W\mid \mathbf{x},do(\mathbf{A} = \mathbf{a})) = \mathbb{P}(\mathbf{u}_W\mid \mathbf{x})$  excludes the time-varying case (LMSM). Deriving sharp bounds for the LMSM is an interesting direction for future research.
4.2 Bounding causal effects
We now leverage Theorem 1 to obtain explicit solutions for the partial identification problem from Eq. (2) with monotone  $\mathcal{D}$  (see Appendix B). This includes expectation and distributional effects.
Corollary 1 (Bounds without mediators). If  $\ell = 0$  and  $\mathcal{D}$  is monotone, we obtain sharp bounds
$$
Q ^ {+} (\mathbf {x}, \mathbf {a}, \mathcal {S}) \leq \mathcal {D} \left(\mathbb {P} _ {+} ^ {Y} (\cdot | \mathbf {x}, \mathbf {a})\right) \quad a n d \quad Q ^ {-} (\mathbf {x}, \mathbf {a}, \mathcal {S}) \geq \mathcal {D} \left(\mathbb {P} _ {-} ^ {Y} (\cdot | \mathbf {x}, \mathbf {a})\right), \tag {7}
$$
and sharpness holds under the same conditions as in Theorem 1.
Algorithm 1: Causal sensitivity analysis with mediators
Input: Causal query  $Q(\mathbf{x},\bar{\mathbf{a}}_{\ell +1},\mathcal{M})$  ,GMSM  $S$  with  $s_W^+$  and  $s_W^-$    
Output: Upper bound  $Q^{+}(\mathbf{x},\bar{\mathbf{a}}_{\ell +1},\mathcal{S})$    
// Outcome bound   
 $c_W^+ \leftarrow \frac{(1 - s_W^-) s_W^+}{s_W^+ - s_W^-}$  for  $W \in \{M_1, \ldots, M_\ell, Y\}$ $Q_{\ell + 1}^{+}(\bar{\mathbf{m}}_{\ell}) \leftarrow \mathcal{D}\left(\mathbb{P}_{+}^{Y}(\cdot \mid \mathbf{x},\bar{\mathbf{m}}_{\ell},\mathbf{a}_{\ell + 1})\right)$  for  $\bar{\mathbf{m}}_{\ell} \in supp(\bar{\mathbf{M}}_{\ell})$    
// Adjusting for confounding in mediators   
for  $i \in \{\ell, \dots, 1\}$  do   
for  $\bar{\mathbf{m}}_{i-1} \in supp(\bar{\mathbf{M}}_{i-1})$  do   
 $\pi \gets$  Permutation map in ascending order of   
 $\left(Q_{i+1}^{+}(\bar{\mathbf{m}}_{i-1}, \pi(m_i))\right)_{m_i \in supp(M_i)}$ $\widetilde{F}(m_i) \leftarrow \sum_{m : \pi(m) \leq m_i} \mathbb{P}(M_i = m \mid \mathbf{x}, \bar{\mathbf{m}}_{i-1}, \mathbf{a}_i)$ $\mathbb{P}_{+}(m_i) \leftarrow \begin{cases} (1 / s_{M_i}^{+}) \mathbb{P}(m_i \mid \mathbf{x}, \bar{\mathbf{m}}_{i-1}, \mathbf{a}_i), & \text{if } \widetilde{F}(\pi(m_i)) < c_{M_i}^{+}, \\ (1 / s_{M_i}^{-}) \mathbb{P}(m_i \mid \mathbf{x}, \bar{\mathbf{m}}_{i-1}, \mathbf{a}_i), & \text{if } \widetilde{F}(\pi(m_i) - 1) > c_{M_i}^{+}, \\ (1 / s_{M_i}^{+}) \left(c_{M_i}^{+} - \widetilde{F}(\pi(m_i) - 1)\right) & + (1 / s_{M_i}^{-}) \left(\widetilde{F}(\pi(m_i)) - c_{M_i}^{+}\right), \\ & \text{else.} \\ Q_i^+(\bar{\mathbf{m}}_{i-1}) \leftarrow \sum_{m_i} Q_{i+1}^+(\bar{\mathbf{m}}_{i-1}, m_i) \mathbb{P}_+(m_i) \\ end$    
end  
 $Q^{+}(\mathbf{x},\bar{\mathbf{a}}_{\ell + 1},\mathcal{S}) \leftarrow Q_1^+$
If  $\mathcal{D}$  is the expectation functional,  $\mathbf{A}$  is binary, and  $Y$  is continuous, this coincides with the optimality result from Dorn and Guo [18]. Hence, Corollary 1 generalizes the result from Dorn and Guo [18] to distributional effects and arbitrary treatments (e.g., categorical, continuous, or time-varying). In their paper, Dorn and Guo proved the sharpness of the bounds by using the Neyman-Pearson Lemma. In contrast, we take the more principled approach outlined in Sec. 4.1, which is applicable to more general settings.
In the following, we consider settings with mediators, i.e., we aim to derive bounds for the causal effect in Eq. (1). The idea is to first obtain outcome bounds  $\mathcal{D}\left(\mathbb{P}_+^Y (\cdot \mid \mathbf{x},\bar{\mathbf{m}}_\ell ,\mathbf{a}_{\ell +1})\right)$  conditioned on all possible values  $\bar{\mathbf{m}}_{\ell}\in supp(\bar{\mathbf{M}}_{\ell})$  in the support of the mediators  $\bar{\mathbf{M}}_{\ell}$ . Without unobserved confounding between treatments and mediators, we can obtain the upper bound  $Q^{+}(\mathbf{x},\bar{\mathbf{a}}_{\ell +1},S)$  from Eq. (1) by replacing  $\mathcal{D}\left(\mathbb{P}^Y (\cdot \mid \mathbf{x},\bar{\mathbf{m}}_\ell ,do(\mathbf{A} = \mathbf{a}_{\ell +1})\right)$
with  $\mathcal{D}\left(\mathbb{P}_{+}^{Y}(\cdot \mid \mathbf{x},\bar{\mathbf{m}}_{\ell},\mathbf{a}_{\ell +1})\right)$ . With unobserved confounding, we need to additionally take the distribution shift in the mediators into account. To maximize the causal effect, the shifted mediator distribution should put more probability mass on values  $\bar{\mathbf{m}}_{\ell}$  for which  $\mathcal{D}\left(\mathbb{P}_{+}^{Y}(\cdot \mid \mathbf{x},\bar{\mathbf{m}}_{\ell},\mathbf{a}_{\ell +1})\right)$  is large. Hence, we can apply the maximal right-shift from Theorem 1 to the mediator distributions in Eq. (1), but where the values  $\bar{\mathbf{m}}_{\ell}$  are permuted to order  $\mathcal{D}\left(\mathbb{P}_{+}^{Y}(\cdot \mid \mathbf{x},\bar{\mathbf{m}}_{\ell},\mathbf{a}_{\ell +1})\right)$  in ascending order. We provide the details on our iterative procedure to compute the upper bound  $Q^{+}(\mathbf{x},\bar{\mathbf{a}}_{\ell +1},S)$  in Algorithm 1. The lower bound  $Q^{-}(\mathbf{x},\bar{\mathbf{a}}_{\ell +1},S)$  can be computed analogously by swapping signs in  $c_{W}$  and  $s_W$ .
Corollary 2. Under the Assumptions of Theorem 1, Algorithm 1 returns the sharp bounds from Eq. (2).
4.3 Empirical bounds via importance sampling
In practice, we only have access to an empirical distribution  $\mathbb{P}_n^{\mathbf{V}}$  of sample size  $n$  instead of the full observational distribution  $\mathbb{P}^{\mathbf{V}}$ . We thus obtain estimates  $\hat{\mathbb{P}}(w \mid \mathbf{x}, \mathbf{m}_W, \mathbf{a})$  of the conditional density or probability mass functions  $\mathbb{P}(w \mid \mathbf{x}, \mathbf{m}_W, \mathbf{a})$  for all  $W \in \{M_1, \dots, M_\ell, Y\}$ . If  $W$  is discrete, this reduces to a standard (multi-class) classification problem, and the estimated class probabilities can be plugged into Algorithm 1. If  $W = Y$  is continuous, we can use arbitrary conditional density estimators to obtain  $\hat{\mathbb{P}}(y \mid \mathbf{x}, \bar{\mathbf{m}}_\ell, \mathbf{a})$ . We propose an importance sampling approach to estimate  $\mathcal{D}\left(\mathbb{P}_{+}^{Y}(\cdot \mid \mathbf{x}, \bar{\mathbf{m}}_{\ell}, \mathbf{a})\right)$  assuming that we can sample from our estimated density  $\hat{\mathbb{P}}^{Y}(\cdot \mid \mathbf{x}, \bar{\mathbf{m}}_{\ell}, \mathbf{a})$  (see Appendix F for details and derivations). If  $\mathcal{D}$  is the expectation functional, our estimator is
$$
\mathcal {D} \left(\widehat {\mathbb {P} _ {+} ^ {Y} (\cdot | \mathbf {x}, \bar {\mathbf {m}} _ {\ell} , \mathbf {a})}\right) = \frac {1}{\hat {s} _ {Y} ^ {+} k} \sum_ {i = 1} ^ {\lfloor k c _ {Y} ^ {+} \rfloor} y _ {i} + \frac {1}{\hat {s} _ {Y} ^ {-} k} \sum_ {i = \lfloor k c _ {Y} ^ {+} \rfloor + 1} ^ {k} y _ {i}, \quad \text {w h e r e} \quad (y _ {i}) _ {i = 1} ^ {k} \sim \hat {\mathbb {P}} ^ {Y} (\cdot | \mathbf {x}, \bar {\mathbf {m}} _ {\ell}, \mathbf {a}) \quad \text {i s s o r t e d}. \tag {8}
$$
We also provide importance sampling estimators for distributional effects in Appendix F. We can also obtain empirical confidence intervals by using the same bootstrap procedure as described in [32].
Implementation: We use feed-forward neural networks with softmax activation function to estimate discrete probability mass functions. For densities, we use conditional normalizing flows [73] (neural spline flows [21]), which are universal density approximators and allow for sampling. We perform training using the Adam optimizer [41]. We also perform extensive hyperparameter tuning in our experiments. Implementation and hyperparameter tuning details are in Appendix G.
Baselines: Most existing methods focus on sensitivity analysis for binary treatments under the MSM [18, 19, 31, 35, 53]. In this setting, our bounds coincide with existing optimality results [18]. For mediation analysis, we are to the best of our knowledge the first to propose bounds for MSM-based sensitivity analysis. This is why we refrain from benchmarking against baselines in our experiments and only show the validity of our bounds.
Synthetic data: We perform extensive experiments using synthetic data from various causal inference settings to evaluate the validity of our bounds. Synthetic data are commonly used to evaluate causal inference methods as they ensure that the causal ground truth is available [6, 16, 76]. Here, we generate six different synthetic datasets with  $n = 50,000$  samples in the following manner: We first construct three SCMs with binary treatments for the causal graphs in Fig. 1, that is, (i) no mediators, (ii) a single mediator  $M$ , and (iii) two mediators  $M_{1}$  and  $M_{2}$ . We then construct three more SCMs for settings (i)-(iii) with continuous treatments. Details are in Appendix H.
Figure 3: Results for the binary treatment setting. Settings (i)-(iii) are ordered from left to right. The top row shows the oracle sensitivity parameter  $\Gamma_W^*$  (depending on  $x$ ), and the bottom row shows the bounds.
To demonstrate the validity of our bounds, we aim to show that they contain the oracle causal effect whenever the sensitivity constraints are satisfied. We evaluate two versions of our GMSM: the MSM for binary treatments and the CMSM for continuous treatments (see Sec. 3.3). Using oracle knowledge from the SCMs, we estimate the respective density ratio from Eq. (3) and obtain the oracle sensitivity parameter  $\Gamma_W^*$  (details are in Appendix H).
We thus demonstrate that our bounds contain the oracle causal effect whenever  $\Gamma_W \geq \Gamma_W^*$ , i.e., whenever we choose sensitivity parameters  $\Gamma_W$  at least as large as the oracle  $\Gamma_W^*$ .
The results for binary treatments are shown in Fig. 3 and for continuous treatments in Fig. 4. For binary treatments, we evaluate the causal effect  $Q(\mathbf{x}, \bar{\mathbf{a}}_{\ell + 1}, \mathcal{M})$  for over  $x \in [-1, 1]$  with three (arbitrary) treatment combinations corresponding to the three different settings:
(i)  $\bar{\mathbf{a}}_1 = 1$  (ii)  $\bar{\mathbf{a}}_2 = (1,0)$  and (iii)  $\bar{\mathbf{a}}_3 = (1,0,0)$ . For continuous treatments, we also use three (arbitrary) treatment combinations: (i)  $\bar{\mathbf{a}}_1 = 0.6$ , (ii)  $\bar{\mathbf{a}}_2 = (0.9,0.5)$ , and (iii)  $\bar{\mathbf{a}}_3 = (0.2,0.4,0.5)$ . Results for additional treatment combinations are in Appendix J. Evidently, the oracle causal effect is contained within our bounds. Hence, the results confirm the validity of our bounds.
Figure 4: Results for continuous treatment setting. Settings (i)-(iii) are ordered from left to right. The top row shows the oracle sensitivity parameter  $\Gamma_W^*$  (depending on  $x$ ), and the bottom row shows the bounds.
We also compare the bounds from Jesson et al.
[32] with our sharp bounds under the CMSM and examine whether we can improve on these by using a different weight function (Def. 4). For this purpose, we modify the SCM from setting (i) in the continuous treatment setting so that there is no unobserved confounding for individuals with  $x > 0$  (i.e.,  $\Gamma_{Y}^{*} = 0$ ). Details are in Appendix H. Table 1 reports the bounds from Jesson et al., our bounds under the CMSM, and our bounds under a weighted CMSM with weight function  $q_{Y}(x) = \mathbb{1}(x > 0)$ . The two main findings are: (i) Using the weight function, we can leverage prior knowledge about the confounding structure to obtain even tighter bounds. (ii) Our bounds are much faster to compute (using 5,000 samples). The latter is because we derived closed-form solutions for our bounds, while the method proposed by Jesson et al. is an approximation that uses grid search.
Table 1: Experiment with weighted CMSM
Metric/ ΓY Bounds	Interval length	Coverage	Time (sec.)
1.2	1.5	2	1.2	1.5	2
Jesson et al.[32] (CMSM)	0.33 ± 0.00	0.74 ± 0.01	1.27 ± 0.01	1	1	1	137.48 ± 2.02
Our bounds (CMSM)	0.33 ± 0.00	0.74 ± 0.01	1.25 ± 0.01	1	1	1	0.39 ± 0.02
Our bounds (weighted CMSM)	0.17 ± 0.01	0.37 ± 0.02	0.63 ± 0.03	0.6	1	1	0.42 ± 0.05
Reported: Average  $\pm$  standard deviation over 5 random seeds (best in bold).
Real-world data: We demonstrate our bounds using an example with real-world data. We consider a setting from the COVID-19 pandemic where mobility (captured through telephone movement) was monitored to obtain a leading predictor of case growth [57]. Details regarding the data (publicly available) and our analysis are in Appendix I. Here, mobility is the mediator, case growth is the outcome, and stay-home order (ban of gatherings with more than 5 people) is the treatment. We are interested in the natural directed effect (NDE, see Example 2) of a stay-home order on the case growth. We suspect that unobserved confounders between treatment and mediator might exist (e.g., adherence, etc. of the population). Hence we perform a causal sensitivity analysis where we vary  $\Gamma_{M}$  and plot the bounds in Fig. 5. We observe that the estimated effect under unconfoundedness  $(\Gamma_{M} = 1)$  is negative, i.e., the stay-home order decreases case growth. For  $\Gamma_{M} > 1$ , we obtain bounds around this estimand. For  $\Gamma_{M} < 6$  the bounds are negative, which means that under moderate unobserved confounding, it seems likely that the NDE is nonzero, in line with prior evidence [57].
Assumptions: As common in the causal inference literature, our results rely on assumptions on the data-generating process that must be justified by domain knowledge. Our main assumption is that we exclude confounders between mediators and the outcome in our analysis (see Def. 2). The reason
for this assumption is that it allows us to interpret the causal query from Eq. (1) as a path-specific effect. Path-specific effects are defined as so-called nested counterfactuals that lie in the third layer of Pearl's causal hierarchy [55] Using the assumption from Theorem 1, they can be reduced to the query from Eq. (1), which lies in layer 2 of Pearl's hierarchy, i.e., only depends on interventions [15]. Our sensitivity analysis then bridges the gap from layer 2 to layer 1 (observational data). Approaches for relaxing this assumption, e.g., by combining our results with a sensitivity analysis from layer 3 to layer 2, are left for future work.
Figure 5: Estimated upper/lower bound for the NDE on real-world data. Reported: mean and standard deviation over 10 runs.
Sensitivity parameter and weighting function: Both the sensitivity parameter  $\Gamma_W$  and the weighting function  $q(\mathbf{a},\mathbf{x})$  incorporate domain knowledge about the unobserved confounding and need to be chosen by the practitioner accordingly.