We show that the overall effect of an exposure on an outcome, in the presence of a mediator with which the exposure may interact, can be decomposed into four components: (i) the effect of the exposure in the absence of the mediator, (ii) the interactive effect when the mediator is left to what is would be in the absence of exposure, (iii) a mediated interaction and (iv) a pure mediated effect. These four components respectively correspond to the portion of the effect that is due to neither mediation nor interaction, to just interaction (but not mediation), to both mediation and interaction, and to just mediation (but not interaction). It is shown that this four-way decomposition unites methods that attribute effects to interactions and methods that assess mediation. Different combinations of these four components correspond to measures for mediation, while other combinations correspond to measures of interaction. The decomposition can be carried out using standard statistical models and software is provided to estimate each of the four components. The four-way decomposition provides the greatest insight into how much of an effect is mediated, how much is due to interaction, how much is due to both mediation and interaction together, and how much is due to neither.
VanderWeele, Tyler J., "A unification of mediation and interaction" (November 2013). Harvard University Biostatistics Working Paper Series. Working Paper 164.