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.

See the SAS FAQ on Visualizing interactions among continuous variables in multiple regression for information on downloading and using the SAS macros used here.

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).

* figure 2.1a, page 41, plane ;
          title=" ",
          plot= zmin=-12 zmax=18 );

This next example shows how to get Figure 2.1b.  It is essentially the same as Figure 2.1a, except that the coefficients are different and the scale is different for the Y axis.

* figure 2.1b, page 41, plane ;
          title=" ",
          plot= zmin=-60 zmax=80 );

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.

* figure 5.2a page 68, plane ;
          title=" ",
          plot= zmin=-6 zmax=20 yticknum=3);

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.

* figure 5.2b page 68, plane ;
          title=" ",
          plot= zmin=-10 zmax=30 yticknum=3);

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.

* figure 5.2c page 68, plane ;
          title=" ",
          plot= zmin=-16 zmax=20 yticknum=3, gopt=vsize=4 hsize=6);

How to cite this page

Report an error on this page or leave a comment

The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.