Mplus model86 模型讲解

来自图书《MPlus中介调节模型》

Mplus 高级教程:串联中介与调节模型

  • 理论模型:深入理解两个中介变量和一个调节变量的复杂作用机制。
  • 数学模型:详细呈现模型中的各个路径及其相互作用的数学表达式。
  • 数学推导:解释模型参数如何通过数学方式进行估计,以及如何进行假设检验。
  • 代码解读:逐行分析 Mplus 代码,掌握如何定义变量、构建模型、计算效应和绘制交互图。

理论模型

数学模型

数学公式1

模型方程:

1.  Y = b0 + b1M1 + b2M2 + c1'X + c2'W + c3'XW
2.  M1 = a01 + a1X + a3W + a4XW
3.  M2 = a02 + a2X + d1M1

数学公式2

模型方程:

1.  Y = b0 + b1M1 + b2M2 + c1'X + c2'W + c3'XW
2.  M1 = a01 + a1X + a3W + a4XW
3.  M2 = a02 + a2X + d1M1
代入和展开:

M2 = a02 + a2X + d1(a01 + a1X + a3W + a4XW)

Y = b0 + b1(a01 + a1X + a3W + a4XW) + b2(a02 + a2X + d1(a01 + a1X + a3W + a4XW)) + c1'X + c2'W + c3'XW

Y = b0 + a01b1 + a1b1X + a3b1W + a4b1XW + a02b2 + a2b2X + a01d1b2 + a1d1b2X + a3d1b2W + a4d1b2XW + c1'X + c2'W + c3'XW

数学公式3

模型方程:

1.  Y = b0 + b1M1 + b2M2 + c1'X + c2'W + c3'XW
2.  M1 = a01 + a1X + a3W + a4XW
3.  M2 = a02 + a2X + d1M1
代入和展开:

M2 = a02 + a2X + d1(a01 + a1X + a3W + a4XW)

Y = b0 + b1(a01 + a1X + a3W + a4XW) + b2(a02 + a2X + d1(a01 + a1X + a3W + a4XW)) + c1'X + c2'W + c3'XW

Y = b0 + a01b1 + a1b1X + a3b1W + a4b1XW + a02b2 + a2b2X + a01d1b2 + a1d1b2X + a3d1b2W + a4d1b2XW + c1'X + c2'W + c3'XW
整理和分组:

Y = (b0 + a01b1 + a02b2 + a01d1b2 + a3b1W  + a3d1b2W + c2'W) + (a1b1 + a2b2 + a1d1b2 + a4b1W + a4d1b2W + c1' + c3'W)X

数学公式4

模型方程:

1.  Y = b0 + b1M1 + b2M2 + c1'X + c2'W + c3'XW
2.  M1 = a01 + a1X + a3W + a4XW
3.  M2 = a02 + a2X + d1M1
代入和展开:

M2 = a02 + a2X + d1(a01 + a1X + a3W + a4XW)

Y = b0 + b1(a01 + a1X + a3W + a4XW) + b2(a02 + a2X + d1(a01 + a1X + a3W + a4XW)) + c1'X + c2'W + c3'XW

Y = b0 + a01b1 + a1b1X + a3b1W + a4b1XW + a02b2 + a2b2X + a01d1b2 + a1d1b2X + a3d1b2W + a4d1b2XW + c1'X + c2'W + c3'XW
整理和分组:

Y = (b0 + a01b1 + a02b2 + a01d1b2 + a3b1W  + a3d1b2W + c2'W) + (a1b1 + a2b2 + a1d1b2 + a4b1W + a4d1b2W + c1' + c3'W)X
总结:

a (截距) = b0 + a01b1 + a02b2 + a01d1b2 + a3b1W  + a3d1b2W + c2'W

b (斜率) = a1b1 + a2b2 + a1d1b2 + a4b1W + a4d1b2W + c1' + c3'W

数学公式5

模型方程:

1.  Y = b0 + b1M1 + b2M2 + c1'X + c2'W + c3'XW
2.  M1 = a01 + a1X + a3W + a4XW
3.  M2 = a02 + a2X + d1M1
代入和展开:

M2 = a02 + a2X + d1(a01 + a1X + a3W + a4XW)

Y = b0 + b1(a01 + a1X + a3W + a4XW) + b2(a02 + a2X + d1(a01 + a1X + a3W + a4XW)) + c1'X + c2'W + c3'XW

Y = b0 + a01b1 + a1b1X + a3b1W + a4b1XW + a02b2 + a2b2X + a01d1b2 + a1d1b2X + a3d1b2W + a4d1b2XW + c1'X + c2'W + c3'XW
整理和分组:

Y = (b0 + a01b1 + a02b2 + a01d1b2 + a3b1W  + a3d1b2W + c2'W) + (a1b1 + a2b2 + a1d1b2 + a4b1W + a4d1b2W + c1' + c3'W)X
总结:

a (截距) = b0 + a01b1 + a02b2 + a01d1b2 + a3b1W  + a3d1b2W + c2'W

b (斜率) = a1b1 + a2b2 + a1d1b2 + a4b1W + a4d1b2W + c1' + c3'W
间接效应和直接效应:

* X 通过 M1 对 Y 的间接效应 (条件效应): (a1 + a4W)b1
* X 通过 M2 对 Y 的间接效应: a2b2
* X 通过 M1 和 M2 对 Y 的间接效应 (条件效应): (a1 + a4W)d1b2
* X 对 Y 的直接效应 (条件效应): c1' + c3'W

代码解读1

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term

代码解读2

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;

代码解读3

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;

代码解读4

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);

代码解读5

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);
MODEL CONSTRAINT:
 NEW(LOW_W MED_W HIGH_W
 LWa1b1 MWa1b1 HWa1b1 a2b2
 LWa1d1b2 MWa1d1b2 HWa1d1b2
 IMM_A IMM_B
 DIR_LW DIR_MW DIR_HW
 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

代码解读6

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);
MODEL CONSTRAINT:
 NEW(LOW_W MED_W HIGH_W
 LWa1b1 MWa1b1 HWa1b1 a2b2
 LWa1d1b2 MWa1d1b2 HWa1d1b2
 IMM_A IMM_B
 DIR_LW DIR_MW DIR_HW
 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
! Now calc indirect, direct and total effects for each value of W
! Conditional indirect effects of X on Y via M1 only given values of W
 LWa1b1 = a1*b1 + a4*b1*LOW_W;
 MWa1b1 = a1*b1 + a4*b1*MED_W;
 HWa1b1 = a1*b1 + a4*b1*HIGH_W;
 a2b2 = a2*b2 ;
! indirect effects of X on Y via M2 only
! Conditional indirect effects of X on Y via M1 and M2 given values of W
 LWa1d1b2 = a1*d1*b2 + a4*d1*b2*LOW_W;
 MWa1d1b2 = a1*d1*b2 + a4*d1*b2*MED_W;
 HWa1d1b2 = a1*d1*b2 + a4*d1*b2*HIGH_W;

代码解读7

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);
MODEL CONSTRAINT:
 NEW(LOW_W MED_W HIGH_W
 LWa1b1 MWa1b1 HWa1b1 a2b2
 LWa1d1b2 MWa1d1b2 HWa1d1b2
 IMM_A IMM_B
 DIR_LW DIR_MW DIR_HW
 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
! Now calc indirect, direct and total effects for each value of W
! Conditional indirect effects of X on Y via M1 only given values of W
 LWa1b1 = a1*b1 + a4*b1*LOW_W;
 MWa1b1 = a1*b1 + a4*b1*MED_W;
 HWa1b1 = a1*b1 + a4*b1*HIGH_W;
 a2b2 = a2*b2 ;
! indirect effects of X on Y via M2 only
! Conditional indirect effects of X on Y via M1 and M2 given values of W
 LWa1d1b2 = a1*d1*b2 + a4*d1*b2*LOW_W;
 MWa1d1b2 = a1*d1*b2 + a4*d1*b2*MED_W;
 HWa1d1b2 = a1*d1*b2 + a4*d1*b2*HIGH_W;
! Indices of Moderated Mediation
 IMM_A = a4*b1;
 IMM_B = a4*d1*b2;
! Conditional direct effects of X on Y given values of W
 DIR_LW = cdash1 + cdash3*LOW_W;
 DIR_MW = cdash1 + cdash3*MED_W;
 DIR_HW = cdash1 + cdash3*HIGH_W;
! Conditional total effects of X on Y given values of W
 TOT_LOWW = LWa1d1b2 + LWa1b1 + a2b2 + DIR_LW;
 TOT_MEDW = MWa1d1b2 + MWa1b1 + a2b2 + DIR_MW;
 TOT_HIW = HWa1d1b2 + HWa1b1 + a2b2 + DIR_HW;

代码解读8

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);
MODEL CONSTRAINT:
 NEW(LOW_W MED_W HIGH_W
 LWa1b1 MWa1b1 HWa1b1 a2b2
 LWa1d1b2 MWa1d1b2 HWa1d1b2
 IMM_A IMM_B
 DIR_LW DIR_MW DIR_HW
 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
! Now calc indirect, direct and total effects for each value of W
! Conditional indirect effects of X on Y via M1 only given values of W
 LWa1b1 = a1*b1 + a4*b1*LOW_W;
 MWa1b1 = a1*b1 + a4*b1*MED_W;
 HWa1b1 = a1*b1 + a4*b1*HIGH_W;
 a2b2 = a2*b2 ;
! indirect effects of X on Y via M2 only
! Conditional indirect effects of X on Y via M1 and M2 given values of W
 LWa1d1b2 = a1*d1*b2 + a4*d1*b2*LOW_W;
 MWa1d1b2 = a1*d1*b2 + a4*d1*b2*MED_W;
 HWa1d1b2 = a1*d1*b2 + a4*d1*b2*HIGH_W;
! Indices of Moderated Mediation
 IMM_A = a4*b1;
 IMM_B = a4*d1*b2;
! Conditional direct effects of X on Y given values of W
 DIR_LW = cdash1 + cdash3*LOW_W;
 DIR_MW = cdash1 + cdash3*MED_W;
 DIR_HW = cdash1 + cdash3*HIGH_W;
! Conditional total effects of X on Y given values of W
 TOT_LOWW = LWa1d1b2 + LWa1b1 + a2b2 + DIR_LW;
 TOT_MEDW = MWa1d1b2 + MWa1b1 + a2b2 + DIR_MW;
 TOT_HIW = HWa1d1b2 + HWa1b1 + a2b2 + DIR_HW;
! Use loop plot to plot total effect of X on Y for low, med, high values of W
! 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 = TOT_LOWW*XVAL;
 MEDMOD = TOT_MEDW*XVAL;
 HIMOD = TOT_HIW*XVAL;

代码解读9

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);
MODEL CONSTRAINT:
 NEW(LOW_W MED_W HIGH_W
 LWa1b1 MWa1b1 HWa1b1 a2b2
 LWa1d1b2 MWa1d1b2 HWa1d1b2
 IMM_A IMM_B
 DIR_LW DIR_MW DIR_HW
 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
! Now calc indirect, direct and total effects for each value of W
! Conditional indirect effects of X on Y via M1 only given values of W
 LWa1b1 = a1*b1 + a4*b1*LOW_W;
 MWa1b1 = a1*b1 + a4*b1*MED_W;
 HWa1b1 = a1*b1 + a4*b1*HIGH_W;
 a2b2 = a2*b2 ;
! indirect effects of X on Y via M2 only
! Conditional indirect effects of X on Y via M1 and M2 given values of W
 LWa1d1b2 = a1*d1*b2 + a4*d1*b2*LOW_W;
 MWa1d1b2 = a1*d1*b2 + a4*d1*b2*MED_W;
 HWa1d1b2 = a1*d1*b2 + a4*d1*b2*HIGH_W;
! Indices of Moderated Mediation
 IMM_A = a4*b1;
 IMM_B = a4*d1*b2;
! Conditional direct effects of X on Y given values of W
 DIR_LW = cdash1 + cdash3*LOW_W;
 DIR_MW = cdash1 + cdash3*MED_W;
 DIR_HW = cdash1 + cdash3*HIGH_W;
! Conditional total effects of X on Y given values of W
 TOT_LOWW = LWa1d1b2 + LWa1b1 + a2b2 + DIR_LW;
 TOT_MEDW = MWa1d1b2 + MWa1b1 + a2b2 + DIR_MW;
 TOT_HIW = HWa1d1b2 + HWa1b1 + a2b2 + DIR_HW;
! Use loop plot to plot total effect of X on Y for low, med, high values of W
! 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 = TOT_LOWW*XVAL;
 MEDMOD = TOT_MEDW*XVAL;
 HIMOD = TOT_HIW*XVAL;
PLOT:
 TYPE = plot2;

代码解读10

USEVARIABLES = X M1 M2 W Y XW;
! Create interaction term
DEFINE:
 XW = X*W;
ANALYSIS:
 TYPE = GENERAL;
 ESTIMATOR = ML;
 BOOTSTRAP = 10000;
MODEL:
 Y ON M1 (b1);
 Y ON M2 (b2);
 Y ON X (cdash1);
 Y ON W (cdash2);
 Y ON XW (cdash3);
 M1 ON X (a1);
 M1 ON W (a3);
 M1 ON XW (a4);
 M2 ON X (a2);
 M2 ON M1 (d1);
MODEL CONSTRAINT:
 NEW(LOW_W MED_W HIGH_W
 LWa1b1 MWa1b1 HWa1b1 a2b2
 LWa1d1b2 MWa1d1b2 HWa1d1b2
 IMM_A IMM_B
 DIR_LW DIR_MW DIR_HW
 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
! Now calc indirect, direct and total effects for each value of W
! Conditional indirect effects of X on Y via M1 only given values of W
 LWa1b1 = a1*b1 + a4*b1*LOW_W;
 MWa1b1 = a1*b1 + a4*b1*MED_W;
 HWa1b1 = a1*b1 + a4*b1*HIGH_W;
 a2b2 = a2*b2 ;
! indirect effects of X on Y via M2 only
! Conditional indirect effects of X on Y via M1 and M2 given values of W
 LWa1d1b2 = a1*d1*b2 + a4*d1*b2*LOW_W;
 MWa1d1b2 = a1*d1*b2 + a4*d1*b2*MED_W;
 HWa1d1b2 = a1*d1*b2 + a4*d1*b2*HIGH_W;
! Indices of Moderated Mediation
 IMM_A = a4*b1;
 IMM_B = a4*d1*b2;
! Conditional direct effects of X on Y given values of W
 DIR_LW = cdash1 + cdash3*LOW_W;
 DIR_MW = cdash1 + cdash3*MED_W;
 DIR_HW = cdash1 + cdash3*HIGH_W;
! Conditional total effects of X on Y given values of W
 TOT_LOWW = LWa1d1b2 + LWa1b1 + a2b2 + DIR_LW;
 TOT_MEDW = MWa1d1b2 + MWa1b1 + a2b2 + DIR_MW;
 TOT_HIW = HWa1d1b2 + HWa1b1 + a2b2 + DIR_HW;
! Use loop plot to plot total effect of X on Y for low, med, high values of W
! 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 = TOT_LOWW*XVAL;
 MEDMOD = TOT_MEDW*XVAL;
 HIMOD = TOT_HIW*XVAL;
PLOT:
 TYPE = plot2;
OUTPUT:
 STAND CINT(bcbootstrap);

资源汇总

  • 本视频讲义地址: https://mlln.cn/mplus-model-templates/model86.html
  • 图书《MPlus中介调节模型》打包下载: 点击下载
  • 图书《MPlus中介调节模型》在线看: 点击查看
  • 视频教程: 点击这里打开视频
  • Mplus 模型模板教程列表: https://mlln.cn/mplus-model-templates
  • 统计咨询: https://wx.zsxq.com/group/88888188828842