Authors: Yiwei Wang & Amanda Montoya
A researcher wrote to our team inquiring if it is possible to fit a model which combines both serial and parallel mediation in the SPSS and SAS Macro MEMORE. These models have been increasing in popularity due to their recent release in the PROCESS Macro as Models 80, 81, and 82.
The original inquiry was regarding a specific model:
In this blog, we walk through how someone could extract information from multiple MEMORE models to get the results for this specific model. While we acknowledge that this is somewhat of a "hack" and future versions of MEMORE will incorporate these models, it also demonstrates how one can combine information across models to get models that are not programmed into MEMORE. This is a useful skill!
In the desired model there are 4 regression equations:
To run the mediation model in the image above, we need to break it up into two models:
and
The arrows in red indicate the specific paths which will be used from each model to represent the desired model. Notice that in the serial model above this provides the correct predictors for ΔM₁ and ΔM₂, but not ΔM₃ (which is not included in the model) or ΔY.
In the parallel model the equations for ΔM₂ and ΔY are correctly specified.
Below we provide instructions for how to fit each model in SPSS and SAS, extract the bootstrap estimates for each path, and combine these bootstrap estimates to test hypotheses about the indirect effects in the desired model.
For clarity purpose, codes are highlighted in steps of the instructions. Additionally, here is an 8-variables fake dataset for parallel serial for reference.
Variable name reference table
SPSS Instruction
The following guidelines illustrate how to complete this proposed analysis in SPSS.
Run the MEMORE macro in SPSS Syntax to set up analysis commands. The package is free-downloadable here: https://www.akmontoya.com/spss-and-sas-macros.
2. To run this, double click on the syntax file below, select Run -> All
3. Input all variables into SPSS Data and open a new Syntax window.
4. Use the following line to run a mediation analysis of the Serial Model in the Syntax:
MEMORE y = y1 y2 /m = m1_1 m1_2 m2_1 m2_2 /model = 1 /serial = 1 /save = 1 /seed = 12345
The variables y1 and y2 are subtracted to create ΔY, the variables m1_1 and m1_2 are subtracted to create ΔM₁, etc.
5. This will generate an "untitled" file with the bootstraps of all variables in the Serial Model. Save this file as "Serial Model Bootstraps".
6. For the Parallel Model, input this line in Syntax:
MEMORE y = y1 y2 /m = m1_1 m1_2 m2_1 m2_2 m3_1 m3_2 /model = 1 /save = 1 /seed = 12345
7. You may save the output Data file as “Parallel Model Bootstraps”.
8. In the same data file, paste the bootstrapped variables (marked red on the diagrams)
from the two separate models.
Serial model: take a1, a2, f1, d1
Parallel model: take a3, b1, b2, b3, Direct (c’1)
You may do this by the following codes (substitute purple lines with your own files):
DATASET ACTIVATE DataSet1.
MATCH FILES /FILE=*
/RENAME (a1 Ind1 a2 Ind2 Ind3 TotalInd Total = d0 d2 d3 d4 d5 d6 d7)
/FILE='C:\Users\01\Desktop\serial bootstrap.sav'
/RENAME (b1 b2 Ind1 Ind2 Ind3 Total TotalInd Direct = d8 d9 d10 d11 d12 d13 d14 d15)
/DROP= d0 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15.
EXECUTE.
9. To analyze the indirect effect of the path [a1, f1, b1], open Syntax and compute a new
variable by multiplying a1 from Serial, f1 from Serial, and b2 from Parallel:
compute a1f1b2 = a1*f1*b2.
execute.
10. To generate relevant statistics with a 95% confidence interval, use the following code
in Syntax (change the purple line to your own dataset number):
DATASET ACTIVATE DataSet7.
FREQUENCIES VARIABLES=a1f1b2
/PERCENTILES=2.5 97.5
/ORDER=ANALYSIS.
11. To analyze each indirect effect, repeat steps 9 and 10 with different bootstrapped
variables. You may also change the percentiles to generate different levels of CI.
SAS Instruction
The following guidelines illustrate how to complete this proposed analysis in SAS.
Run the MEMORE macro in SAS code window to set up analysis commands. The package is free-downloadable here: https://www.akmontoya.com/spss-and-sas-macros.
Different from SPSS, the following codes in highlights can be run at once. You may copy this entire code and paste to your SAS window (substitute purple items with your own file name and directory).
SAS Code
2. Import file with the variables and type in the file name under WORK space. If you
have a csv file, you may use the following codes (replace purple lines with your
own file name and directory):
proc import out=filename
datafile="/home/SASID/filename.csv"
dbms=csv
replace;
getnames=YES;
run;
3. Use the following lines to run mediation analysis for the Serial and the Parallel Model:
%memore(y = y1 y2, m = m1_1 m1_2 m2_1 m2_2, model = 1, data = filename, save = serial, serial = 1);
%memore(y = y1 y2, m = m1_1 m1_2 m2_1 m2_2 m3_1 m3_2, model = 1, data = filename, save = parallel);
The variables y1 and y2 are subtracted to create ΔY, the variables m1_1 and m1_2 are subtracted to create ΔM₁, etc.
4. The output bootstraps of the two models will be stored in the following window.
5. You want to take the following variables (marked red on the diagrams) from the two
separate models:
Serial model: take a1, a2, f1, d1
Parallel model: take a3, b1, b2, b3, Direct (c’1)
To do this, run the following lines in the code window. This will create a merged
dataset:
data merged;
set serial (drop=b1 Ind1 b2 Ind2 Ind3 TotalIndire Direct Total);
set parallel (drop=a1 Ind1 a2 Ind2 Ind3 TotalIndire Total);
run;
6. To analyze the indirect effect of each path, for example [a1, f1, b1], create a new
variable in merged by multiplying a1, f1, and b1. Insert this line in between set and run:
…
set parallel ();
a1f1b1 = a1*f1*b1;
/* you may add more indirect effect paths here */
run;
7. To generate relevant statistics with a 95% confidence interval, use the following codes
for each indirect effect:
proc ttest data=merged alpha=0.05;
var a1f1b1;
/* var ...; (you may add more variables here) */
run;
Summary
Overall, this process demonstrates how researchers using MEMORE can take multiple models and combine them together to get models which were not originally implemented in MEMORE. These principles can be used to fit different models, and open up the universe of opportunities for models to fit in MEMORE. But don't forget, you can always email us to request certain models, as this will help us decide what to implement next!
These ideas will be particularly valuable for the upcoming release of MEMORE 3.0, which incorporates Models 4 - 18 (Moderated Mediation). Feel free to reach out to request a Beta version (akmontoya@ucla.edu).
Comments