
Figure 1. Conceptual model

Figure 2. Statistical model
Mplus code for the model:
!Commands before USEVARIABLES are omitted intentionally, !please refer to the 1st clip if necessary
! Predictor variable - X
! Mediator variable(s) – M
! Moderator variable(s) – W
! Outcome variable - Y
USEVARIABLES = X M W Y XW;
! Create interaction terms
! Note that they have to be placed at end of USEVARIABLES
subcommand above
DEFINE:
XW = X*W;
ANALYSIS:
TYPE = GENERAL;
ESTIMATOR = ML;
BOOTSTRAP = 5000;
! In model statement name each path and intercept using
parentheses
MODEL:
[Y] (b0);
Y ON M (b1);
Y ON X (c);
[M] (a0);
M ON X (a1);
M ON W (a2);
M ON XW (a3);
! Use model constraint subcommand to test conditional indirect
effects
! You need to pick low, medium and high moderator values for W
! for example, of 1 SD below mean, mean, 1 SD above mean
! 1 moderator, 3 values for it
! arbitrary naming convention for conditional indirect and total effects used below:
! MED_Q = medium value of Q, etc.
MODEL CONSTRAINT:
NEW(LOW_W MED_W HIGH_W IND_LOWW IND_MEDW IND_HIW
TOT_LOWW TOT_MEDW TOT_HIW);
LOW_W = #LOWW; ! replace #LOWW in the code with your
chosen low value of W
MED_W = #MEDW; ! replace #MEDW in the code with your
chosen medium value of W
HIGH_W = #HIGHW; ! replace #HIGHW in the code with your
chosen high value of W
! Calculate conditional indirect effects for each combination of
moderator values
IND_LOWW = a1*b1 + a3*b1*LOW_W;
IND_MEDW = a1*b1 + a3*b1*MED_W;
IND_HIW = a1*b1 + a3*b1*HIGH_W;
! Calculate conditional total effects for each combination of
moderator values
TOT_LOWW = IND_LOWW + c;
TOT_MEDW = IND_MEDW + c;
TOT_HIW = IND_HIW + c;
! Use loop plot to plot conditional indirect effect of X on Y
for each combination of low, med, high moderator values
! Could be edited to show conditional direct or conditional
total effects instead
! NOTE - values of 1,5 in LOOP() statement need to be replaced
by logical min and max limits of predictor X used in analysis
PLOT(LOMOD MEDMOD HIMOD);
LOOP(XVAL,1,5,0.1);
LOMOD = IND_LOWW*XVAL;
MEDMOD = IND_MEDW*XVAL;
HIMOD = IND_HIW*XVAL;
PLOT:
TYPE = plot2;
OUTPUT:
STAND CINT(bcbootstrap);

