Welcome to the Institute for Digital Research and Education

Example 3d Graphs from
Multiple Regression: Testing and Interpreting Interactions
by Leona Aiken and Stephen West

These examples show how you can use SAS to produce
three dimensional spin plots corresponding to the figures shown in Aiken and
West. A 2-dimensional page sometimes cannot convey the nature of a three
dimensional relationship, so these examples are aimed to help further illustrate
the examples in Aiken and West and to show how you can demonstrate the
relationships that you find using three dimensional plots as shown in the
examples below.

This first example shows how to make a spin plot of
the graph shown on page 41 in Figure 2.1a. The outfile parameter
specifies where the output file will be stored. It is stored as a .gif
file that you can view with a web browser (the output is not viewable from
within SAS). The bx1=1.14,bx2=3.58,bx1x2=2.58,cons=2.54 parameters
provide the regression equation to be plotted (which matches the one from
Figure 2.1a.). The x1lo=-2,x1hi=2,x1by=.2,x2lo=-1,x2hi=1,x2by=.2
parameters specify the range of values to be plotted for x1 and x2
(note that we refer to the axes as x1 and x2, whereas Aiken and West refer to
them as X and Z, so X corresponds to x1 and Z corresponds to x2).
Finally, the title parameter is used to provide a title (no title) and
the plot= zmin=-12 zmax=18 parameter provides options to specify the
high and low values on the y axis (but SAS refers to it as the Z axis).

This example below shows how to get Figure 5.2a as a
3d spin plot. We supply the coefficients as we have above, except that
this also includes bx1x1 which reflects the coefficient for
x1-squared. As you can see, the plane is curved with respect to x1.

This example below shows how to get Figure 5.2b as a
3d spin plot. This example adds the bx1x2 term which causes the
plane to flare upward as x1 and x2 jointly increase and to dip as x1 and x2
jointly decrease.

The example below shows how to get Figure 5.2c, which
adds the bx1x1x2 term, the interaction of x1-squared by x2. To
better see the subtleties of this relationship, we increased the size of this
plot (via the gopt=vsize=4 hsize=6
option). As you can see, this additional term makes the curve U shaped
between X1 and Y when X2 is high, but the relationship becomes a slight
inverted U when X2 is low.