来自图书《MPlus中介调节模型》
! Predictor variable(s) - X, XX
! Mediator variable(s) M
! Moderator variable(s) - none
! Outcome variable - Y
USEVARIABLES = X XX M Y;
ANALYSIS:
TYPE = GENERAL;
ESTIMATOR = ML;
BOOTSTRAP = 10000;
MODEL:
Y ON M (b1);
Y ON X (cdash1);
! direct effect of X on Y
Y ON XX (cdash2);
! direct effect of X on Y
M ON X (a1);
M ON XX (a2);
! Predictor variable(s) - X, XX
! Mediator variable(s) M
! Moderator variable(s) - none
! Outcome variable - Y
USEVARIABLES = X XX M Y;
ANALYSIS:
TYPE = GENERAL;
ESTIMATOR = ML;
BOOTSTRAP = 10000;
MODEL:
Y ON M (b1);
Y ON X (cdash1);
! direct effect of X on Y
Y ON XX (cdash2);
! direct effect of X on Y
M ON X (a1);
M ON XX (a2);
MODEL CONSTRAINT:
NEW(LOW_X MED_X HIGH_X
IIE_LOWX IIE_MEDX IIE_HIX
IDE_LOWX IDE_MEDX IDE_HIX);
LOW_X = #LOWX;
! replace #LOWX in the code with your chosen low value of X
MED_X = #MEDX;
! replace #MEDX in the code with your chosen medium value of X
HIGH_X = #HIGHX;
! replace #HIGHX in the code with your chosen high value of X
! Calc instantaneous indirect effects for low, medium, high values of X
IIE_LOWX = (a1 + 2*a2*LOW_X)*b1;
IIE_MEDX = (a1 + 2*a2*MED_X)*b1;
IIE_HIX = (a1 + 2*a2*HIGH_X)*b1;
! Calc instantaneous direct effects for low, medium, high values of X
IDE_LOWX = cdash1 + 2*cdash2*LOW_X;
IDE_MEDX = cdash1 + 2*cdash2*MED_X;
IDE_HIX = cdash1 + 2*cdash2*HIGH_X;
! Predictor variable(s) - X, XX
! Mediator variable(s) M
! Moderator variable(s) - none
! Outcome variable - Y
USEVARIABLES = X XX M Y;
ANALYSIS:
TYPE = GENERAL;
ESTIMATOR = ML;
BOOTSTRAP = 10000;
MODEL:
Y ON M (b1);
Y ON X (cdash1);
! direct effect of X on Y
Y ON XX (cdash2);
! direct effect of X on Y
M ON X (a1);
M ON XX (a2);
MODEL CONSTRAINT:
NEW(LOW_X MED_X HIGH_X
IIE_LOWX IIE_MEDX IIE_HIX
IDE_LOWX IDE_MEDX IDE_HIX);
LOW_X = #LOWX;
! replace #LOWX in the code with your chosen low value of X
MED_X = #MEDX;
! replace #MEDX in the code with your chosen medium value of X
HIGH_X = #HIGHX;
! replace #HIGHX in the code with your chosen high value of X
! Calc instantaneous indirect effects for low, medium, high values of X
IIE_LOWX = (a1 + 2*a2*LOW_X)*b1;
IIE_MEDX = (a1 + 2*a2*MED_X)*b1;
IIE_HIX = (a1 + 2*a2*HIGH_X)*b1;
! Calc instantaneous direct effects for low, medium, high values of X
IDE_LOWX = cdash1 + 2*cdash2*LOW_X;
IDE_MEDX = cdash1 + 2*cdash2*MED_X;
IDE_HIX = cdash1 + 2*cdash2*HIGH_X;
! Use loop plot to plot instantaneous indirect effect of X on Y
! 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(IIEX);
LOOP(XVAL,1,5,0.1);
IIEX = (a1*b1 + 2*a2*b1*XVAL)*XVAL;
! Predictor variable(s) - X, XX
! Mediator variable(s) M
! Moderator variable(s) - none
! Outcome variable - Y
USEVARIABLES = X XX M Y;
ANALYSIS:
TYPE = GENERAL;
ESTIMATOR = ML;
BOOTSTRAP = 10000;
MODEL:
Y ON M (b1);
Y ON X (cdash1);
! direct effect of X on Y
Y ON XX (cdash2);
! direct effect of X on Y
M ON X (a1);
M ON XX (a2);
MODEL CONSTRAINT:
NEW(LOW_X MED_X HIGH_X
IIE_LOWX IIE_MEDX IIE_HIX
IDE_LOWX IDE_MEDX IDE_HIX);
LOW_X = #LOWX;
! replace #LOWX in the code with your chosen low value of X
MED_X = #MEDX;
! replace #MEDX in the code with your chosen medium value of X
HIGH_X = #HIGHX;
! replace #HIGHX in the code with your chosen high value of X
! Calc instantaneous indirect effects for low, medium, high values of X
IIE_LOWX = (a1 + 2*a2*LOW_X)*b1;
IIE_MEDX = (a1 + 2*a2*MED_X)*b1;
IIE_HIX = (a1 + 2*a2*HIGH_X)*b1;
! Calc instantaneous direct effects for low, medium, high values of X
IDE_LOWX = cdash1 + 2*cdash2*LOW_X;
IDE_MEDX = cdash1 + 2*cdash2*MED_X;
IDE_HIX = cdash1 + 2*cdash2*HIGH_X;
! Use loop plot to plot instantaneous indirect effect of X on Y
! 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(IIEX);
LOOP(XVAL,1,5,0.1);
IIEX = (a1*b1 + 2*a2*b1*XVAL)*XVAL;
PLOT:
TYPE = plot2;
! Predictor variable(s) - X, XX
! Mediator variable(s) M
! Moderator variable(s) - none
! Outcome variable - Y
USEVARIABLES = X XX M Y;
ANALYSIS:
TYPE = GENERAL;
ESTIMATOR = ML;
BOOTSTRAP = 10000;
MODEL:
Y ON M (b1);
Y ON X (cdash1);
! direct effect of X on Y
Y ON XX (cdash2);
! direct effect of X on Y
M ON X (a1);
M ON XX (a2);
MODEL CONSTRAINT:
NEW(LOW_X MED_X HIGH_X
IIE_LOWX IIE_MEDX IIE_HIX
IDE_LOWX IDE_MEDX IDE_HIX);
LOW_X = #LOWX;
! replace #LOWX in the code with your chosen low value of X
MED_X = #MEDX;
! replace #MEDX in the code with your chosen medium value of X
HIGH_X = #HIGHX;
! replace #HIGHX in the code with your chosen high value of X
! Calc instantaneous indirect effects for low, medium, high values of X
IIE_LOWX = (a1 + 2*a2*LOW_X)*b1;
IIE_MEDX = (a1 + 2*a2*MED_X)*b1;
IIE_HIX = (a1 + 2*a2*HIGH_X)*b1;
! Calc instantaneous direct effects for low, medium, high values of X
IDE_LOWX = cdash1 + 2*cdash2*LOW_X;
IDE_MEDX = cdash1 + 2*cdash2*MED_X;
IDE_HIX = cdash1 + 2*cdash2*HIGH_X;
! Use loop plot to plot instantaneous indirect effect of X on Y
! 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(IIEX);
LOOP(XVAL,1,5,0.1);
IIEX = (a1*b1 + 2*a2*b1*XVAL)*XVAL;
PLOT:
TYPE = plot2;
OUTPUT:
STAND CINT(bcbootstrap);