2
$\begingroup$

I was reading through the material on the mediation formulas [1] and do not understand how to apply it in cases where Y, the outcome is binary and Pr(Y) is estimated using logistic regression and Z, the mediator is continuous.

All the texts I have referred to suggest that there is no closed form solution when Pr(Y) is estimated using logistic regression but there is a closed form when probit regression is used. I was trying to figure this out by applying the mediation formulas using the simplest case where we have:

X where x = control, x' = treatment,
Z is a continuous mediator
Y is a continuous outcome

Setting this mediation up, we have:

[Eq1] $Y = \beta_0 + \beta_1X_y + \beta_2Z + \varepsilon_1$

[Eq2] $Z = \gamma_0 + \gamma_1X_z + \varepsilon_2$

And the mediation formulas state:

[Eq3] Direct effect, $DE_{x,x'}(Y) = E(Y_{x', Z_x}) - E(Y_x)$

[Eq4] Indirect effect, $IE_{x,x'}(Y) = E(Y_{x, Z_{x'}}) - E(Y_x)$

Under no confounding, we have:

[Eq5] $DE_{x,x'}(Y) = \sum_{z}{[E(Y|x', z) - E(Y|x,z)] P(z|x)}$

[Eq6] $IE_{x,x'}(Y) = \sum_{z}{E(Y|x, z)[P(z|x') - P(z|x)}$

First question:

Are [Eq3] and [Eq4] re-expressions of pure direct [Eq7] and total indirect effects [Eq8] as presented in many other literature?

[Eq7] $DE_{x,x'}(Y) = E[Y(x', Z(x)) - Y(x, Z(x))]$

[Eq8] $IE_{x,x'}(Y) = E[Y(x', Z(x')) - Y(x', Z(x))]$

If it is, then why is [Eq4] not [Eq9]?

[Eq9] $IE_{x,x'}(Y) = E(Y_{x', Z_{x'}}) - E(Y_{x'})$

Second question:

How should [Eq5] be applied? In this case, Z is a continuous variable so what should P(z|x) be? I see in various other sources that suggest that when all variables are continuous, you can just substitute in the terms as in [Exp1].

[Exp1] $DE_{x,x'}(Y) = [\beta_0 + \beta_1x' + \beta_2 * (\gamma_0 + \gamma_1x)] - [\beta_0 + \beta_1x + \beta_2 * (\gamma_0 + \gamma_1x)]$

[Exp1] appears to follow [Eq7] but I do not follow how this is an application of [Eq5].

I was hoping that understanding how [Eq5] and [Eq6] are applied in the continuous Z and Y case can help me understand why there is no closed form expression for the direct and indirect effects of the following mediation model:

[Eq10] $Pr(Y) = [1 + exp({-(\beta_0 + \beta_1X_y + \beta_2Z + \varepsilon_1)})]^{-1}$

[Eq11] $Z = \gamma_0 + \gamma_1X_z + \varepsilon_2$

where

$\varepsilon_1$ follows a logistic distribution

$\varepsilon_2$ follows a normal distribution

[1] Pearl J. The Causal Mediation Formula - A Guide to the Assessment of Pathways and Mechanisms. Prevention Science. 2012 Aug;13(4):426–36.

$\endgroup$

1 Answer 1

3
$\begingroup$

Let's start by computing $\sum_{z}E[y|x', z]p(z|x)$. If $z$ is continuous, you just change the summation to integration, and $p(z|x)$ now refers to the density,

$$ \begin{align} \int_z E[y|x', z]p(z|x)dz &= \int_z(\beta_0 + \beta_1x' + \beta_2z)p(z|x)dz\\ &=\beta_0 + \beta_1x' + \beta_2\int_zzp(z|x)dz\\ &=\beta_0 + \beta_1x' + \beta_2E(z|x)\\ &=\beta_0 + \beta_1x' + \beta_2(\gamma_0 + \gamma_1x) \end{align} $$

Thus, we have that,

$$\int_{z}(E[y|x', z]- E[y|x, z])p(z|x)dz = [\beta_0 + \beta_1x' + \beta_2(\gamma_0 + \gamma_1x)] - [\beta_0 + \beta_1x + \beta_2(\gamma_0 + \gamma_1x)]$$

Now, if you posit a logistic regression for $y$, then you have to solve the following integral,

$$ \begin{align} \int_z E[y|x', z]p(z|x)dz &= \int_z p(y=1|x', z)p(z|x)dz\\ &=\int_z \text{logit}^{-1}(\beta_0 + \beta_1x' + \beta_2z)p(z|x)dz\\ &=\int_z \frac{1}{1+e^{-\beta_0 - \beta_1x' - \beta_2z}}p(z|x)dz \end{align} $$

Which you can see is not as straightforward as the linear case. In fact, as per this answer, most likely there isn't a closed form solution and you will need to use simulation or other types of approximation.

Regarding your other questions, yes Eq3 is equal to Eq7, you just wrote the potential outcomes differently. Eq4 and Eq8 are both indirect effects, just having a different reference for how we are holding the X not via mediation fixed (one is fixing at $x$ and the other fixing at $x'$). As to your Eq9, remember that $E[Y_{x'}] = E[Y_{x', Z_{x'}}]$ by composition, so that equation is effectively equal to zero.

$\endgroup$
5
  • $\begingroup$ Thanks for your explanation. in the last line of the integration in the case of a logistic regression, why wouldn't one be able to integrate p(z|x) as in the previous continuous case and use E(z|x)? $\endgroup$
    – RJ-
    May 7, 2018 at 1:31
  • $\begingroup$ @JackeJR the logit function is not linear, we can't simply move the integral inside like in the linear case. $\endgroup$ May 7, 2018 at 2:09
  • $\begingroup$ Pardon the ignorance, why can we do that in the linear case and not the logistic case? $\endgroup$
    – RJ-
    May 7, 2018 at 6:37
  • $\begingroup$ @JackeJR integration (or in this case, expectation) is a linear operator en.wikipedia.org/wiki/Linearity_of_integration#cite_note-1. As a simple example, you can always write $E[aX+bY]= aE[X] + bE[Y]$ but in general for an arbitrary function $g(\cdot)$, $E[g(X)] \neq g(E[X])$. $\endgroup$ May 7, 2018 at 6:40
  • $\begingroup$ @JackeJR Here you can see that the integral most likely does not have a closed form solution math.stackexchange.com/questions/207861/…. In this case you can compute it with monte carlo simulations, or you can use approximations. $\endgroup$ May 7, 2018 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.