Diff for "FAQ/regline" - CBU statistics Wiki
location: Diff for "FAQ/regline"
Differences between revisions 12 and 14 (spanning 2 versions)
Revision 12 as of 2009-12-14 16:20:31
Size: 1274
Editor: PeterWatson
Comment:
Revision 14 as of 2011-10-07 11:44:16
Size: 1563
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
If you wish to produce separate regression lines fo individual subgroups defined by a factor e.g. group then the above syntax is easily adjusted as the below If you wish to produce separate regression lines for individual subgroups defined by a factor e.g. group then the above syntax is easily adjusted as the below
Line 34: Line 34:

Suppose you wish to add user defined lines to a plot e.g. to represent the ANCOVA assumption of equal slopes within various groups. You can do this by running the above syntax and then using the graph editor:

You should end up with something like [attachment:ancova.ppt this plot.]

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

If you wish to produce separate regression lines for individual subgroups defined by a factor e.g. group then the above syntax is easily adjusted as the below

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

On the Elements pull-down menu (referred to as above) select Fit Line at Subgroups.

Suppose you wish to add user defined lines to a plot e.g. to represent the ANCOVA assumption of equal slopes within various groups. You can do this by running the above syntax and then using the graph editor:

You should end up with something like [attachment:ancova.ppt this plot.]

None: FAQ/regline (last edited 2013-03-08 10:17:36 by localhost)