* Encoding: UTF-8. * Graphing Interactions Using the PROCESS Macro in SPSS. * slides 12 and 13. get file "D:\data\Seminars\Graphing_Interactions_SPSS_PROCESS\exercise.sav". dataset name exercise. * slides 12 and 13. get file "D:\data\Seminars\Graphing_Interactions_SPSS_PROCESS\hsbmoderation.sav". dataset name hsbm. dataset activate hsbm. * slide 18. glm opinion by binaryvr bcovar /design binaryvr bcovar binaryvr*bcovar /print parameter /emmeans = tables(binaryvr*bcovar) /plot = profile(binaryvr*bcovar) errorbar = se. * notice that binaryvr and bcovar come after "with"; notice change to ref group. * slide 31. dataset activate hsbm. glm opinion with binaryvr bcovar /design binaryvr bcovar binaryvr*bcovar /print parameter. * two binary predictors. * slide 33. dataset activate hsbm. process y = opinion /x = binaryvr /w = bcovar /model = 1 /plot = 1. 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 . * within the graph editor, select fit line for subgroups to get the lines to connect the dots and remove label. * slide 42. 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. * binary by three-level. * slide 46. 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. * slide 51. dataset activate hsbm. process y = opinion /x = binaryvr /w = detail3 /mcw = 1 /model = 1 /plot = 1. DATA LIST FREE/ binaryvr detail3 opinion . BEGIN DATA. 1.0000 .0000 43.9804 2.0000 .0000 47.2500 1.0000 1.0000 51.3500 2.0000 1.0000 53.3333 1.0000 2.0000 59.7193 2.0000 2.0000 58.7692 END DATA. GRAPH/SCATTERPLOT= binaryvr WITH opinion BY detail3 . * binary by continuous interaction. * slide 58. dataset activate hsbm. glm opinion with age binaryvr /design = age binaryvr age*binaryvr /print = parameter. * slide 62. dataset activate hsbm. process y = opinion /x = age /w = binaryvr /model = 1 /plot = 1. DATA LIST FREE/ age binaryvr opinion . BEGIN DATA. 41.0000 .0000 43.7102 54.0000 .0000 53.2345 62.0000 .0000 59.0956 41.0000 1.0000 52.2194 54.0000 1.0000 54.5113 62.0000 1.0000 55.9217 END DATA. GRAPH/SCATTERPLOT= age WITH opinion BY binaryvr . * where do the values of age of 41, 54 and 62 come from?. * they are the 16th, 50th and 84th percentile. * slide 67. dataset activate hsbm. freq var = age /statistics = median /percentiles = 16.0 84.0 /format = notable. * continuous by 3-level. * slide 70. dataset activate hsbm. glm opinion with age by detail3 /design = age detail3 age*detail3 /print = parameter. * we can see from the above output that the interaction term is not stat sig. * so we will include the intprobe = 1 option. * slide 73. dataset activate hsbm. process y = opinion /x = age /w = detail3 /mcw = 1 /model = 1 /plot = 1 /intprobe = 1. DATA LIST FREE/ age detail3 opinion . BEGIN DATA. 41.0000 .0000 42.0830 54.0000 .0000 48.2141 62.0000 .0000 51.9870 41.0000 1.0000 46.9477 54.0000 1.0000 52.4784 62.0000 1.0000 55.8819 41.0000 2.0000 48.5857 54.0000 2.0000 56.4992 62.0000 2.0000 61.3690 END DATA. GRAPH/SCATTERPLOT= age WITH opinion BY detail3 . * two continuous predictors with the pick-a-point approach. * slide 81. dataset activate exercise. process y = loss /x = hours /w = effort /model = 1 /plot = 1. DATA LIST FREE/ hours effort loss . BEGIN DATA. 1.5165 24.5391 6.2483 2.0051 24.5391 6.3835 2.4859 24.5391 6.5165 1.5165 29.6340 8.8784 2.0051 29.6340 9.9930 2.4859 29.6340 11.0894 1.5165 34.7141 11.5008 2.0051 34.7141 13.5919 2.4859 34.7141 15.6489 END DATA. GRAPH/SCATTERPLOT= hours WITH loss BY effort . * adds a small section to the output. * slide 90. dataset activate exercise. process y = loss /x = hours /w = effort /model = 1 /plot = 1 /jn = 1. * moments = 1 means that the mean, +/- sd are used instead of percentiles 16, 50, 84. * slide 92. dataset activate exercise. means var = effort. process y = loss /x = hours /w = effort /model = 1 /plot = 1 /moments = 1. * wmodvalu = #, # allows the user to provide values at which the predicted values are calculated. * slide 96. dataset activate exercise. process y = loss /x = hours /w = effort /model = 1 /plot = 1 /wmodval = 15,40. * the resulting graphing commands. * same as before, as expected. DATA LIST FREE/ hours effort loss . BEGIN DATA. 1.5165 15.0000 1.3241 2.0051 15.0000 -.3743 2.4859 15.0000 -2.0451 1.5165 40.0000 14.2295 2.0051 40.0000 17.3366 2.4859 40.0000 20.3932 END DATA. GRAPH/SCATTERPLOT= hours WITH loss BY effort . * slide 100. GGRAPH /GRAPHDATASET NAME="GraphDataset" VARIABLES= hours loss effort /GRAPHSPEC SOURCE=INLINE. BEGIN GPL SOURCE: s=userSource( id( "GraphDataset" ) ) DATA: loss=col( source(s), name( "loss" ) ) DATA: hours=col( source(s), name( "hours" ), unit.category() ) DATA: effort = col(source(s), name("effort"), unit.category()) GUIDE: axis( dim( 1 ), label( "hours" ) ) GUIDE: axis( dim( 2 ), label( "effort" ) ) ELEMENT: point( position( hours * loss )) , shape(effort)) ELEMENT: line(position(smooth.linear(hours * loss)), color(effort)) END GPL. * two interaction terms in the same model. * slide 105. dataset activate exercise. glm loss with hours effort female /design = hours effort female hours*effort hours*female /print = parameter. * slide 108. dataset activate exercise. process y = loss /x = hours /w = effort /z = female /model = 2 /intprobe = 1 /plot = 1. DATA LIST FREE/ hours effort female loss . BEGIN DATA. 1.5165 24.5391 .0000 6.8235 2.0051 24.5391 .0000 6.3407 2.4859 24.5391 .0000 5.8658 1.5165 24.5391 1.0000 5.7279 2.0051 24.5391 1.0000 6.4139 2.4859 24.5391 1.0000 7.0888 1.5165 29.6340 .0000 9.4508 2.0051 29.6340 .0000 9.9717 2.4859 29.6340 .0000 10.4841 1.5165 29.6340 1.0000 8.3552 2.0051 29.6340 1.0000 10.0449 2.4859 29.6340 1.0000 11.7071 1.5165 34.7141 .0000 12.0705 2.0051 34.7141 .0000 13.5921 2.4859 34.7141 .0000 15.0889 1.5165 34.7141 1.0000 10.9748 2.0051 34.7141 1.0000 13.6653 2.4859 34.7141 1.0000 16.3119 END DATA. GRAPH/SCATTERPLOT= hours WITH loss BY effort /PANEL ROWVAR= female . * a three-way interaction. * slide 122. dataset activate exercise. process y = loss /x = hours /w = effort /z = female /model = 3 /plot = 1. DATA LIST FREE/ hours effort female loss . BEGIN DATA. 1.5165 24.5391 .0000 6.5816 2.0051 24.5391 .0000 5.9660 2.4859 24.5391 .0000 5.3604 1.5165 24.5391 1.0000 5.9598 2.0051 24.5391 1.0000 6.7880 2.4859 24.5391 1.0000 7.6028 1.5165 29.6340 .0000 9.4641 2.0051 29.6340 .0000 9.9590 2.4859 29.6340 .0000 10.4457 1.5165 29.6340 1.0000 8.3551 2.0051 29.6340 1.0000 10.0374 2.4859 29.6340 1.0000 11.6924 1.5165 34.7141 .0000 12.3383 2.0051 34.7141 .0000 13.9403 2.4859 34.7141 .0000 15.5162 1.5165 34.7141 1.0000 10.7434 2.0051 34.7141 1.0000 13.2773 2.4859 34.7141 1.0000 15.7699 END DATA. GRAPH/SCATTERPLOT= hours WITH loss BY effort /PANEL ROWVAR= female . * adding covariates. * slide 131. dataset activate hsbm. process y = opinion /x = detail /w = age /cov = ccovar bcovar /model = 1 /plot = 1. * using heterscedastic SEs. * slide 134. dataset activate hsbm. process y = opinion /x = detail /w = age /hc = 4 /model = 1 /plot = 1. * changing the number of decimal places shown, decimals = F8.4. * slide 136. dataset activate hsbm. process y = opinion /x = detail /w = age /decimals = f10.2 /model = 1 /plot = 1.