FAQ/regline - CBU statistics Wiki

Revision 11 as of 2009-07-10 10:38:54

Clear message
location: FAQ / regline

Putting a regression line on a scatterplot

Putting a regression line on a scatterplot in SPSS can be done using the interactive graph in SPSS. The syntax below draws a regression line using reading score to predict writing score. Fuller details are given [http://www.ats.ucla.edu/stat/spss/faq/scatter.htm here.]

IGRAPH
 /X1 = VAR(READ)
 /Y = VAR(WRITE)
 /FITLINE METHOD = REGRESSION LINEAR LINE = TOTAL
 /SCATTER.

Alternatively you can run the following syntax which produces a scatterplot:

GRAPH
  /SCATTERPLOT(BIVAR)=READ WITH WRITE
  /MISSING=LISTWISE .

To add the fit line, you need to open the graph editor (by double-clicking on the graph), and then select the Elements pull-down menu at the top, and then select Fit Line at Total.

You just need to change the variable names in the above syntax examples substituting the variable names in your SPSS data for 'read' and 'write'.