# Mediators are hard but important: direct and indirect effects

In a previous post I described the difference between mediators and moderators, and I talked about mediators being the “why” of experiments. In other words, we can do an experiment and measure the effect of a treatment, but why did that effect occur? One way to formalize the why question is with direct and indirect effects. However, as we will see, once we define these effects clearly, they are very difficult to estimate using standard experimental designs that only manipulate the treatment.

Before defining direct and indirect effects, it is helpful to start off defining the total effect of a treatment. Using the potential outcome notation, we can write the total effect of a treatment T as

$\tau_i = Y_i(T=1) - Y_i(T=0) \qquad [1]$

By doing a standard experiment where we randomly assign the treatment to participants, we are able to observe some people with $T=1$ and some with $T=0$ enabling us to estimate the average treatment effect. However, if we are interested in decomposing the total effect into the amount that can be attributed to some mediator M, it is useful to rewrite the total effect as

$\tau_i = Y_i(T=1, M_i(1)) - Y_i(T=0, M_i(0)) \qquad [2]$

where $M_i(1)$ is the value of the mediator when the $T=1$ and $M_i(0)$ is the value of the mediator when $T=0$.

Notice that the only difference between the two equations is that in the second we are now explicit about the proposed mediator. That is, $Y_i(T=1, M_i(1)) = Y_i(T=1)$ and $Y_i(T=0, M_i(1)) = Y_i(T=0)$. Thus, given Eq (2), we can see that the standard experimental design enables us to estimate what happens if we change the treatment and the let the mediator change concurrently.

However, we could try to decompose that total effect, and we could ask:

• What happens if you keep the treatment fixed and change the mediator? (indirect effect)
• What happens if you change the treatment and keep the mediator fixed? (direct effect)

More formally, we can define the indirect effect of treatment t as

$\delta_i(t) = Y_i(t, M_i(1)) - Y_i(t, M_i(0))$

Note that this equation makes clear that there are actually two different indirect effects, depending on whether we fix the value of treatment to be 1 or 0.

Similarly to how we defined the indirect effect, we can also define the direct effect of a treatment t as

$\zeta_i(t) = Y_i(1, M_i(t)) - Y_i(0, M_i(t))$

Again, there are actually two different direct effects depending on whether we fix the value of mediator.

Something about these quantities should look strange: they both involve quantities that we never observe for any units. That is, we never observe $Y_i(1, M_i(0))$ and we never observe $Y_i(0, M_i(1))$. Without observing these quantities we cannot estimate the direct and indirect effects.

One way to think about why it might be hard to estimate direct and indirect effects is that we are trying to estimate two causal effects—the direct effect and the indirect effect—while only doing one experiment. This suggests that one possible way to estimate direct and indirect effects would involve doing more complex experiments that manipulate the treatment and mediators. However, as we will see in a future post, these experiments turn out to be very difficult in practice. Thus, even though mediators are very important, estimating direct and indirect effects is very difficult. Therefore, in a future post, I’ll also describe some alternative approaches learning about mechanisms.