Understanding Graphing Interactions Using the PROCESS Macro in SPSS
Explore how to graph interactions using the PROCESS macro in SPSS for moderation models without mediation. Learn about installing the PROCESS macro, downloading datasets, SPSS commands in the log file, and defining interaction terms in regression models. Utilize resources like the PROCESS macro website and Andrew F. Hayes' book for further insights.
Download Presentation
![](/assets/img/so-down.gif)
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Graphing Interactions Using Graphing Interactions Using the PROCESS Macro in SPSS the PROCESS Macro in SPSS Christine R. Wells, Ph.D. UCLA Office of Advanced Research Computing Statistical Methods and Data Analytics
Introduction We will cover only some of what can be done in the PROCESS macro in SPSS. We will focus on moderation models (no mediation). We will be using version 4.0 of the PROCESS macro. Information about the PROCESS macro can be found at https://www.processmacro.org/index.html Much of the material in this workshop is based on Introduction to Mediation, Moderation and Conditional Process Analysis: A Regression-based Approach, Third Edition by Andrew F. Hayes (2022).
Installing PROCESS Go to processmacro.org and then to the Downloads tab (at the top of the page). Download the zipped file, and then unzip the file. Read the Installing PROCESS custom dialog PDF. Finally, open and run the process.sps file. The custom dialog will remain installed as you open and close the SPSS program, but you must run the process.sps file each time you open SPSS and want to use the PROCESS macro.
Download the datasets Please go to the webpage and download the datasets hsbmoderation.sav and exercise.sav. Save them somewhere that it is easy for you to access (such as C:\). NOTE: SPSS will allow long variable names, but PROCESS has trouble with variable names longer than eight characters. To avoid these potential difficulties, the names of all variables used in the examples are eight characters or less.
Getting the SPSS commands in the log file Log file = output file Some versions of SPSS have the syntax echoed in the output by default. If you don t see SPSS syntax above the output, click on Edit, Options, the Viewer tab, and then click to check the box in lower left corner to Display the Commands in the Log.
Definition of interaction term Interaction terms are common in regression models. Without an interaction term in a regression model, the effect of one predictor on the outcome is independent of all other predictors in the model. The interaction term is the product of two predictors. The inclusion of an interaction term in a regression model means that the effect of one predictor on the outcome depends on the level of the other predictor.
Definition of interaction term (continued) Interaction terms are symmetric: the effect of Predictor A on the outcome depends on the level of Predictor B, and the effect of Predictor B on the outcome depends on the level of Predictor A. For simplicity, some authors refer to one predictor as the predictor and the other as the moderator . The important thing to remember is that those names are used only to help people; there is no difference mathematically and your statistical software does not care what you call any of the predictors.
In this workshop You will learn how to interpret the coefficients of the interaction terms and the lower-order effects (to be explained later), how to probe the interaction and how to graph it. Many researchers find the interpretation of the coefficients of the interaction terms to be difficult, so they simply report whether or not the term is statistically significant and then present the graph of the interaction.
SPSS procedures to run linear regression There are many procedures that can be used to run linear regression analyses in SPSS, e.g., REGRESSION, GLM, MIXED, LINEAR. However, most procedures that run regression analyses in SPSS lack the ability to graph interactions. One exception to this is the GLM command, which can graph binary- by-binary interactions. This is a big limitation, so we will use PROCESS to graph interactions that SPSS can t.
Graphing interactions with PROCESS The PROCESS macro, written by Andrew Hayes, provides a way to get the information necessary to graph a variety of different types of interactions, including binary-by-binary, binary-by-continuous, continuous-by-continuous, two two-way interactions in a model and even three-way interactions. This workshop will focus on graphing different types of interactions in linear regression models.
The datasets Hsbmoderation outcome = opinion predictors = detail, age, etc. Exercise outcome = loss predictors = hours, effort, female
DATASET NAME and DATASET ACTIVATE Before we start using the PROCESS macro, we need to quickly discuss some SPSS commands that we will need to keep everything running correctly. The SPSS command DATASET NAME is used to name a dataset that has been created (but not necessarily saved anywhere). The SPSS command DATASET ACTIVATE makes active a particular dataset, and this will be used to ensure that the correct dataset is active just before we execute the SPSS syntax.
The GET FILE command The get file command is used to open an SPSS dataset. We will issue the DATASET NAME command immediately after the GET FILE command so that we can activate the dataset when we need it. get file "D:\data\Seminars\Graphing_Interactions_SPSS_PROCESS\hsbmoderation.sav". dataset name hsbm. get file "D:\data\Seminars\Graphing_Interactions_SPSS_PROCESS\exercise.sav". dataset name exercise.
Interaction and lower-order terms The interaction term is the product of two predictors, binaryvr and bcovar. The variables binaryvr and bcovar will also be included in the model; they are called lower-order terms. Their presence in the model is necessary to make the coefficient of the interaction term interpretable. Hence there are three predictor variables: binaryvr, bcovar and their interaction. Do not use recoded versions of the lower-order effects.
Conceptual diagram W Y X
Statistical model X W Y XW
Using the SPSS GLM command glm opinion by binaryvr bcovar /design binaryvr bcovar binaryvr*bcovar /print parameter /emmeans = tables(binaryvr*bcovar) /plot = profile(binaryvr*bcovar) errorbar = se. By default, SPSS uses the highest-numbered category as the reference group, and this default cannot be changed.
Interpretation The overall model is not statistically significant (from the table of Tests of Between Subjects Effects, p = 0.357). Because of this, interpretation of the rest of the output would normally cease. However, for this example, let s continue. Given that the overall model is not statistically significant, it should not be surprising that the R-squared value is small (below the table of Tests of Between Subjects Effects, R-squared = 0.016). In the table of Parameter Estimates, we find the unstandardized coefficients (called B) and their standard errors, the t test statistics, the p-values (in the column Sig.) and the 95% CIs.
Interpretation The coefficient of 53.883 for the intercept (AKA constant) is the expected value of the outcome variable (opinion) when all of the predictors in the model are held at 0. In this model, 0 is a reasonable value for both predictors, binaryvr and bcvoar. However, in many models, 0 is not in the range of one or more of the predictor variables, and the expected value of the outcome may not be in the range of the outcome variable. In such situations, researchers should report the coefficient for the intercept but not interpret it. (pages 242-245)
Interpetation The coefficient of -1.097 for binaryvr is the effect of binaryvr when bcovar = 1. Because the coefficient is negative, we know that this predictor variable and the outcome are negatively associated (given this model; the coefficient may have a different sign in a different model). Hence, we would say that for a one-unit increase in binaryvr, the expected change (or decrease) in the outcome is approximately 1 unit, holding all other variables in the model constant. Because binaryvr has only two values, 0 and 1, we can also say that the difference between these two groups is approximately 1 unit when bcovar = 1. Because this coefficient is not statistically significant, in practice, we would not interpret it; in fact, it may be 0.
Interpetation In some research situations, this value may be of interest, and in other research situations, it will not be. Researchers should always report the coefficient, but it is the researcher s decision whether or not to interpret this value. The coefficient for bcovar is 2.167. This is the effect of bcovar when binaryvr = 1. Again, it is not statistically significant, so, in practice, this coefficient would not be interpreted, but it is the difference between the group coded 0 and the group coded 1 when binaryvr is equal to 1. Both of these coefficients are called simple effects or conditional effects. (page 254)
Caution! Remember that these coefficients are simple effects. When writing about these lower-order terms, the phrases main effects and average effects should be avoided. NOTE: The term main effect comes from ANOVA. It is used because the coding of the lower-order effects is different in ANOVA than in regression.
Interpetation The coefficient for the interaction term is -3.877 and is not statistically significant (p = 0.353). This coefficient describes how much the difference in the outcome, opinion, between two cases that differ by one unit on binaryvr changes as bcovar changes by one unit, and vice versa. Because this is difficult for many researchers and consumers of research to understand, graphs are particularly helpful.
Graph of interaction This example was used because the graph apparently shows a cross-over interaction, but notice the size of the error bars. Both error bars cover both points on both sides, and this is another way of showing that the interaction is statistically non- significant.
Try it yourself What is the difference between a dichotomous variable and a binary variable? Why would this matter in a regression analysis? Given that the interaction term is not statistically significant, should the interaction term remain in the model or be removed?
The SPSS GLM command with keyword with with Notice that binaryvr and bcovar come after with; notice change to the reference group. Notice that the emmeans and plot subcommands have been removed. Those subcommands can only be used with variables that follow the SPSS keyword by. glm opinion with binaryvr bcovar /design binaryvr bcovar binaryvr*bcovar /print parameter.
Binary by binary interaction with PROCESS process y = opinion /x = binaryvr /w = bcovar /model = 1 /plot = 1. To run a moderation model, (at least) three variables need to specified: y, which is the outcome; x, which is one of the predictors; and w, which is the other predictor and also called the moderator. The model number must be specified, and for this model, we specify model 1. Models 1, 2 and 3 are moderation models (with no mediation). We add the plot = 1 subcommand to add to the output the SPSS syntax needed for creating the graph of the interaction.
PROCESS output Model : 1 Y : opinion X : binaryvr W : bcovar Sample Size: 200
PROCESS output OUTCOME VARIABLE: opinion Model Summary R R-sq MSE F df1 df2 p .1277 .0163 115.1128 1.0832 3.0000 196.0000 .3573 Model coeff se t p LLCI ULCI constant 51.0260 1.2227 41.7325 .0000 48.6147 53.4373 binaryvr 4.9740 3.1173 1.5956 .1122 -1.1737 11.1217 bcovar 1.7103 1.6613 1.0295 .3045 -1.5660 4.9866 Int_1 -3.8770 4.1686 -.9300 .3535 -12.0981 4.3442
PROCESS output Product terms key: Int_1 : binaryvr x bcovar Test(s) of highest order unconditional interaction(s): R2-chng F df1 df2 p X*W .0043 .8650 1.0000 196.0000 .3535
PROCESS output Focal predict: binaryvr (X) Mod var: bcovar (W) Data for visualizing the conditional effect of the focal predictor: Paste text below into a SPSS syntax window and execute to produce plot. DATA LIST FREE/ binaryvr bcovar opinion . BEGIN DATA. .0000 .0000 51.0260 1.0000 .0000 56.0000 .0000 1.0000 52.7363 1.0000 1.0000 53.8333 END DATA. GRAPH/SCATTERPLOT= binaryvr WITH opinion BY bcovar .
PROCESS output *********************** ANALYSIS NOTES AND ERRORS ************************ Level of confidence for all confidence intervals in output: 95.0000 ------ END MATRIX -----
SPSS syntax to graph interaction DATA LIST FREE/ binaryvr bcovar opinion . BEGIN DATA. 1.0000 .0000 51.0260 2.0000 .0000 56.0000 1.0000 1.0000 52.7363 2.0000 1.0000 53.8333 END DATA. GRAPH/SCATTERPLOT= binaryvr WITH opinion BY bcovar .
GPL syntax GGRAPH /GRAPHDATASET NAME="GraphDataset" VARIABLES= opinion bcovar binaryvr /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource( id( "GraphDataset" ) ) DATA: opinion=col( source(s), name( "opinion" ) ) DATA: bcovar=col( source(s), name( "bcovar" ), unit.category() ) DATA: binaryvr = col(source(s), name("binaryvr"), unit.category()) GUIDE: axis( dim( 1 ), label( "binaryvr" ) ) GUIDE: axis( dim( 2 ), label( "opinion" ) ) ELEMENT: point( position( binaryvr * opinion )) , shape(bcovar)) ELEMENT: line(position(smooth.linear(binaryvr * opinion)), shape(bcovar)) END GPL.
Comments about GGRAPH and GPL The GRAPH command given in the PROCESS output is from the legacy dialogs in the point-and-click interface. GGRAPH and GPL are from the Chart Builder and are the newer graphing commands. For more information about using GPL to customize your graphs, please see https://www.ibm.com/docs/en/SSLVMB_28.0.0/pdf/GPL_Reference_ Guide_for_IBM_SPSS_Statistics.pdf and https://stats.oarc.ucla.edu/spss/library/spss-librarymaking-graphs- with-the-ggraph-command-and-gpl/
Comments on GPL Note that GPL is unlike SPSS syntax in that the statements must be in a particular order and are case sensitive. If you want to make a graph appropriate for publication, you probably need to use GPL. GPL is similar to the way graphs are made in R using ggplot2.
SPSS GLM syntax for binary by three-level dataset activate hsbm. glm opinion by binaryvr detail3 /design = binaryvr detail3 binaryvr*detail3 /print = parameter /emmeans = tables(binaryvr*detail3) /plot = profile(binaryvr*detail3) errorbar = se.