6  Moderated mediation and mediated moderation

6.1 The simplest scenario: when X is continuous

6.1.1 Continuous Z

Now we are interested in a more complex model combining mediation and moderation. Specifically, we would like to know whether the mediation effect is different at different values of a moderator, that is, a moderated mediation model.

Likewise, we are investigating the relationship between X and Y and want to know the detailed mechanism of how X is affecting Y.

In moderated mediation, the relationship between X and Y without mediator M can be moderated by moderator Z Y=c0+c1X+c2Z+c3XZ+ϵY.

6.1.1.1 Full moderated mediation model

Now assume that the relationship between X and Y is mediated by M while the mediation effect is moderated by Z. More specifically, we assume:

  1. the path between X and M is moderated by Z;
  2. the path between M and Y is moderated by Z;
  3. the path between X and Y is moderated by Z.

Thus we have a full moderated mediation model, of which the path diagrams are

and the equations are M=a0+a1X+a2Z+a3XZ+ϵMY=c0+c1X+c2Z+c3XZ+b1M+b2MZ+ϵY. By combining the two equations above we have Y=c0+c1X+c2Z+c3XZ+b1(a0+a1X+a2Z+a3XZ+ϵM)+b2(a0+a1X+a2Z+a3XZ+ϵM)Z+ϵY=c0+c2Z+(c1+c3Z)X+b1(a0+a2Z)+b1(a1+a3Z)X+b1ϵM+b2(a0+a2Z)Z+b2Z(a1+a3Z)X+b2ZϵM+ϵY=c0+c2Z+(a0+a2Z)(b1+b2Z)+[(c1+c3Z)+(a1+a3Z)(b1+b2Z)]X+(b1+b2Z)ϵM+ϵY.

In this full moderated mediation model, the mediation effect is (a1+a3Z)(b1+b2Z); the moderation effects of three moderated paths are

  1. a3, the path between X and M is moderated by Z;
  2. b2, the path between M and Y is moderated by Z;
  3. c3, the path between X and Y is moderated by Z.

If we did not assume the path between X and Y is moderated by Z, then we replace c3 with 0 in above equations, the resulting conceptual model is

We can simplify the full moderated mediation model by assuming that only parts of the paths in the basic mediation model are moderated by Z.

6.1.1.2 First stage moderated mediation model

In this model, we assume that

  1. the path between X and M is moderated by Z;
  2. the path between X and Y is moderated by Z.

Thus we have

and M=a0+a1X+a2Z+a3XZ+ϵMY=c0+c1X+c2Z+c3XZ+b1M+ϵY. By combining these two equations Y=c0+c1X+c2Z+c3XZ+b1(a0+a1X+a2Z+a3XZ+ϵM)+ϵY=c0+c2Z+(c1+c3Z)X+b1(a0+a2Z)+b1(a1+a3Z)X+b1ϵM+ϵY=c0+c2Z+(a0+a2Z)b1+[(c1+c3Z)+(a1+a3Z)b1]X+b1ϵM+ϵY. In this first stage moderated mediation model, the mediation effect is (a1+a3Z)b1; the moderation effects of two moderated paths are

  1. a3, the path between X and M is moderated by Z;
  2. c3, the path between X and Y is moderated by Z.

If we did not assume the path between X and Y is moderated by Z, then we replace c3 with 0 in above equations, the resulting conceptual model is

6.1.1.3 Second stage moderated mediation model

In this model, we assume that

  1. the path between M and Y is moderated by Z;
  2. the path between X and Y is moderated by Z.

Thus we have

and M=a0+a1X+ϵMY=c0+c1X+c2Z+c3XZ+b1M+b2MZ+ϵY. By combining these two equations Y=c0+c1X+c2Z+c3XZ+b1(a0+a1X+ϵM)+b2(a0+a1X+ϵM)Z+ϵY=c0+c2Z+(c1+c3Z)X+b1a0+b1a1X+b1ϵM+b2a0Z+b2a1ZX+b2ZϵM+ϵY=c0+c2Z+a0(b1+b2Z)+[(c1+c3Z)+a1(b1+b2Z)]X+(b1+b2Z)ϵM+ϵY.

In second stage moderated mediation model, the mediation effect is a1(b1+b2Z); the moderation effects of two moderated paths are

  1. b2, the path between M and Y is moderated by Z;
  2. c3, the path between X and Y is moderated by Z.

If we did not assume the path between X and Y is moderated by Z, then we replace c3 with 0 in above equations, the resulting conceptual model is

6.1.1.4 Moderated mediation analysis

Because in a moderated mediation model, we care most is the mediation effect and want to know if it is moderated by Z, thus the analysis consists of two steps, first moderation analysis and then simple mediation analysis. It is similar to what we have learned in basic moderation analysis, we first want to know the significance of hypothesized moderation effect (significance of interaction effect in ANOVA), if so, we then want to know what exactly does the moderation mechanism looks like by conducting simple slope analysis (simple main effect analysis in ANOVA).

  1. Significance test of moderation effect(s).

The effect of X on Y in full moderated mediation model is

(c1+c3Z)+(a1+a3Z)(b1+b2Z), as long as at least one of c, a3 or b2 is non-zero, the effect of X on Y is moderated by Z. But testing these 3 coefficients separately leads to floated type-I error rate and low power issue, so we test the products instead.

The equation above can be rewritten as c1+a1b1+c3Z+a1b2Z+a3b1Z+a3b2Z2, where the coefficients of the last 4 terms, c3, a1b2, a3b1, and a3b2, are the moderation effects, or moderated mediation parts. If any of these 4 coefficients is non-zero, the effect of X on Y is moderated by Z. We use bootstrap method to test the significance of c3, a1b2, a3b1, and a3b2. More specifically,

  • if a1b2, a3b1, and a3b2 were all non-zero, we have full moderated mediation model with (c30) or without (c3=0) direct path being moderated,
  • if a3b10, we have first stage moderated mediation model with (c30) or without (c3=0) direct path being moderated,
  • if a1b20, we have second stage moderated mediation model with (c30) or without (c3=0) direct path being moderated.
  1. Simple mediation analysis.

In basic moderation analysis, for categorical moderator, we just need to test the significance of K simple slopes, K is the level of Z; for continuous moderator, we use either the pick-a-point method or the Johnson-Neyman method.

In moderated mediation analysis, we use exactly the same method. In addition to the significance test of simple slope, we also need to test the simple mediation effect (conditional indirect effect) calculated using simple slope.

6.1.2 Categorical Z

6.1.2.1 Full moderated mediation model

Suppose Z is a 3-level categorical variable and is dummy coded, the 1st category is used as the reference. The equations of a full moderated mediation model become M=a0+a1X+a2d2Z+a3d3Z+a4Xd2Z+a5Xd3Z+ϵMY=c0+c1X+c2d2Z+c3d3Z+c4Xd2Z+c5Xd3Z+b1M+b2Md2Z+b3Md3Z+ϵY. By combining the two equations above we have Y=c0+c1X+c2d2Z+c3d3Z+c4Xd2Z+c5Xd3Z+b1a0+b1a1X+b1a2d2Z+b1a3d2Z+b1a4Xd2Z+b1a5Xd3Z+b1ϵM+b2a0d2Z+b2a1Xd2Z+b2a2d2Zd2Z+b2a3d3Zd2Z+b2a4Xd2Zd2Z+b2a5Xd3Zd2Z+b2ϵMd2Z+b3a0d3Z+b3a1Xd3Z+b3a2d2Zd3Z+b3a3d3Zd3Z+b3a4Xd2Zd3Z+b3a5Xd3Zd3Z+b3ϵMd3Z+ϵY=c0+(a0+a2d2Z+a3d2Z)b1+(a0+a2d2Z+a3d3Z)b2d2Z+(a0+a2d2Z+a3d3Z)b3d3Z+c2d2Z+c3d3Z+[(c1+c4d2Z+c5d3Z)+(a1+a4d2Z+a5d3Z)b1+(a1+a4d2Z+a5d3Z)b2d2Z+(a1+a4d2Z+a5d3Z)b3d3Z]X+(b1+b2d2Z+b3d3Z)ϵM+ϵY=c0+c2d2Z+c3d3Z+(a0+a2d2Z+a3d2Z)(b1+b2d2Z+b3d3Z)+[(c1+c4d2Z+c5d3Z)+(a1+a4d2Z+a5d3Z)(b1+b2d2Z+b3d3Z)]X+(b1+b2d2Z+b3d3Z)ϵM+ϵY.

We now have 3 simple mediation effects to test. When Z=1, d2Z=d3Z=0, we have Y=c0+a0b1+(c1+a1b1)X+b1ϵM+ϵY. When Z=2, d2Z=1,d3Z=0, we have Y=c0+(a0+a2)(b1+b2)+c2d2Z+[(c1+c4)+(a1+a4)(b1+b2)]X+(b1+b2)ϵM+ϵY. When Z=3, d2Z=0,d3Z=1, we have Y=c0+(a0+a3)(b1+b3)+c3d3Z+[(c1+c5)+(a1+a5)(b1+b3)]X+(b1+b3)ϵM+ϵY.

6.2 When X is categorical

6.2.1 Continuous Z

Suppose X is a 3-level categorical variable, of which the 1st category is used as reference group when dummy coding. The equations of a full moderated mediation model become M=a0+a1d2X+a2d3X+a3Z+a4d2XZ+a5d3XZ+ϵMY=c0+c1d2X+c2d3X+c3Z+c4d2XZ+c5d3XZ+b1M+b2MZ+ϵY. By combining the two equations above we have Y=c0+c1d2X+c2d3X+c3Z+c4d2XZ+c5d3XZ+b1a0+b1a1d2X+b1a2d3X+b1a3Z+b1a4d2XZ+b1a5d3XZ+b2a0Z+b2a1d2XZ+b2a2d3XZ+b2a3ZZ+b2a4d2XZZ+b2a5d3XZZ+b1ϵM+b2ϵMZ+ϵYY=c0+c3Z+b1(a0+a3Z)+b2Z(a0+a3Z)+[c1+c4Z+b1(a1+a4Z)+b2z(a1+a4Z)]d2X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+(a2+a7)(b1+b2)+b1ϵM+b2ϵM+ϵY. When X=3 and Z=3, d3X=d3Z=1, d2X=d2Z=0, we have Y=(c0+c4)+(a0+a4)(b1+b3)+(c1+c8)+(a2+a8)(b1+b3)+b1ϵM+b3ϵM+ϵY.

6.3 How to report moderated mediation analysis

8.3 section in Ye et al. 2024 paper

6.4 Real data example

In the following section, we use a real data example from EPSY:579 R cookbook for SEM by Ge Jiang.

In this example, we fit the first stage moderated mediation model without moderated direct path, that is, we assume that the path between CBT and NegThoughts is moderated by NeedCog. Therefore, the moderation effect to-test is a3b1.

6.4.1 Categorical Z

  • X: CBTDummy, cognitive behavioral therapy
  • M: NegThoughts, negative thoughts
  • Y: Depression
  • Z: NeedCog, need for cognition, a psychological construct that refers to an individual’s desire for, and enjoyment of, intellectually engaging activities. As such, a substantial amount of research has shed light on how need for cognition is associated with numerous positive outcomes, such as learning and academic success, and also how it is associated to theoretically related constructs found in the literature (e.g., intellectual engagement, epistemic curiosity).

Interpretation: needCog significantly moderates CBT -> NegThoughts -> Depression indirect effect through moderating the first stage of the indirect effect. Since we expect the effect of CBT on Depression to be negative (CBT reduces Depression). And IndexOfModMed a3b1 is also negative. We’ll say NeedCog strengthens the indirect effect of CBT on Depression through NegThoughts. The higher need for cognition, the stronger the indirect effect, and the more effect mediated by NegThoughts.

6.4.2 Continuous Z

Now, we use the continuous version of NeedCog, NeedCogCont.

  • Pick-a-point (recommended)

Interpretation is similar to the one of categorical moderator.

  • Johnson-Neyman

The Johnson-Neyman for the output of SEM() has not being implemented yet.

6.5 Mediated moderation

Mediated moderation and moderated mediation are the two sides of one coin ().

6.5.1 How to report mediated moderation

Section 5.1.3 in Liu and Wang (2024)

6.5.2 An unprecedented example

Moderated serial mediation, 1st stage model with direct path moderated