1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
*(Q) How can I produce a graph showing an interaction in multiple
	regression .

*(A) Posted to SPSSX-L on 2002/01/27 by Heather L. Urry.
Following you'll find
some syntax that uses the IGRAPH command for a quick and dirty approach to
plotting a significant interaction between two continuous predictors
(although you'll
see that the graph is actually what you'd find if you dichotomized one of
the IVs).
For the slower and cleaner method, see Cohen & Cohen's (1983)
chapter on interactions in regression, which will explain how to determine
regression
equations for representative values on the IVs of interest so you can
generate predicted
Y values and graph the findings.  Also see the "Graphing Interactions"
section of the
following web page:
http://www.princeton.edu/~data/analysis/introreg.html#int, which I thought
was pretty useful.


DATA LIST LIST /iv1 (F6.2) iv2 (F6.2) dv (F6.2) group (A4).
BEGIN DATA
3 2 23 LOW
2 4 19 LOW
3 6 13 LOW
9 9 22 HIGH
10 6 18 HIGH
8 5 12 HIGH
END DATA.
LIST.

* If you don't have a variable like "group", then you'll need to create it
* at this point.

* Create interaction term and run a hierarchical regression to see if
* interaction is significant.

COMPUTE interact = iv1*iv2.
EXE.
REGRESSION
/STATISTICS COEFF OUTS R ANOVA COLLIN TOL ZPP CHA
/CRITERIA=PIN(.05) POUT(.10)
/NOORIGIN
/DEPENDENT dv
/METHOD=ENTER iv1 iv2
/METHOD=ENTER interact.

* Plot the interaction. This code essentially plots two separate
* regression lines (one each for HIGH and LOW) and generates a
* color-coded scatterplot. You can edit the plot if you want to get
* rid of the datapoints and/or regression equations.

IGRAPH /VIEWNAME='Scatterplot' /X1 = VAR(iv2) TYPE = SCALE /Y =
VAR(dv) TYPE = SCALE /COLOR = VAR(group) TYPE = CATEGORICAL
/COORDINATE = VERTICAL /FITLINE METHOD = REGRESSION LINEAR LINE = MEFFECT
SPIKE=OFF /X1LENGTH=3.0 /YLENGTH=3.0 /X2LENGTH=3.0 /CHARTLOOK='NONE'
/CATORDER VAR(group) (ASCENDING VALUES OMITEMPTY) /SCATTER COINCIDENT =
NONE.
EXE.