# Where does this formula for the effect of the mediator on the outcome comes from?

Caron, P.-O., & Valois, P. 2018. A computational description of simple mediation analysis. The Quantitative Methods for Psychology, 14(2): 147–158.

There there is the following model for mediation:

Where:

• $$a_{xm}$$ is the coefficient obtained by the following regression: $$M = a_{xm} X + \epsilon$$

• $$c_{xy}$$, also called total effect, is the coefficient obtained by the following regression: $$Y = c_{xy} X + \epsilon$$

• $$c_{xy|m}$$ and $$b_{my|x}$$, are obtained by the following regression: $$Y = c_{xy|m} X + b_{my|x} M + \epsilon$$

• $$b_{my}$$ (unreported in the picture) is the coefficient obtained by: $$Y = b_{my} M + \epsilon$$

The paper says that:

$$b_{my} = b_{my|x} (1-a_{xm}^2) + a_{xm} c_{xy}$$

This is equation (1) in page 148.

But there is no proof for that.

Why is that? Where does this formula comes from?

In this case, we want $$b_{my}$$, which is the unconditional correlation between $$M$$ and $$Y$$. There are two pathways from $$M$$ to $$Y$$: the direct pathway and the indirect pathway through $$X$$. So, $$b_{my} = Path_{MY} + Path_{MXY}$$. We can compute those paths in a straightforward way using the rules above:
\begin{align} Path_{MY} &= b_{my|x} \\ Path_{MXY} & = a_{xm} c_{xy|m} \end{align}
That gives us $$b_{my} = b_{my|x} + a_{xm} c_{xy|m}$$. We're halfway there.
Next, realize that the total effect, $$c_{xy}$$, is the sum of the paths from $$X$$ to $$Y$$, which include the one through $$M$$ (the indirect path) and the direct path; the following equation gives the standard mediation decomposition of the total effect into the indirect and direct effects: $$c_{xy} = a_{xm} b_{my|x} + c_{xy|m}$$ which can be rearranged as $$c_{xy|m} = c_{xy} - a_{xm} b_{my|x}$$ If we substitute this formula into our formula for $$b_{my}$$, we get the result: \begin{align} b_{my} &= b_{my|x} + a_{xm} c_{xy|m} \\ &= b_{my|x} + a_{xm} (c_{xy} - a_{xm} b_{my|x}) \\ &= b_{my|x} - a_{xm}^2 b_{my|x} + a_{xm} c_{xy} \\ &= b_{my|x}(1 - a_{xm}^2) + a_{xm} c_{xy} \\ \end{align}