Create a scatterplot with SPSS
We would expect that the height of a person is related to (in fact, is likely a significant factor in) his/her weight. Given that we believe that height affects weight, we will assign height to be the explanatory variable and weight to be the response variable. Height and weight measurements were collected from 57 males and 24 females. Use the following instructions to create a scatterplot, and then to create a second scatterplot with the points labeled as to gender. (Labeling this third variable may or may not contribute to our understanding of the form of the relationship.) [1]
The dataset contains 81 cases and three variables:
- gender (0 = male, 1 = female)
- height (in inches)
- weight (in pounds)
Dataset
- height.xls
- an SPSS version of the dataset is available on your class website: height.sav
Open the dataset in the SPSS data editor.
The following instructions are based on the student version of PASW (SPSS) version 18.
Create a scatterplot
Use the Chart Builder to create a scatterplot:
- Click Graphs > Chart Builder....
- Note that the variables in heights.sav are appropriately defined; click OK in the Chart Builder warning dialog, if it displays.
The Chart Builder dialog box displays:
- In the Gallery area at the bottom of the box, select Scatter/Dot from the listing.
- Select the top left picture of a scatterplot, labeled Simple Scatter in the mouse over label, and drag it to the large chart preview window.
A crude preview displays and the Element Properties window opens.
- Continuing in the Chart Builder dialog, click and drag the "Height" variable (from the list on the left) to the X-Axis? box at the bottom of the preview window. (The explanatory variable goes on the x-axis.)
- Click and drag the "Weight" variable (from the list on the left) to the Y-Axis? box on the left of the preview window. (The response variable goes on the y-axis.)
Don't worry that the preview graph fails to represent your data. The preview is based on example data.
A simple scatterplot is now ready to be created.
- At the bottom of the Chart Builder dialog box, click OK.
The Chart Builder dialog box closes and SPSS activates the Output window to display the scatterplot.
Add a title to the scatterplot
To make adjustments to the resulting scatterplot, double-click the graph displayed in the output window.
The Chart Editor displays, which includes many options for customizing a graph.
To add a title:
- Select Options > Title.
A title is added to the graph with the word "Title".
- Click on the word "Title" to highlight the title box; click on the word "Title", again, to begin editing.
- Enter the title text.
- Press enter on your keyboard to add the title to the graph.
Close the Chart Editor, the changes are applied to the graph in the output window.
Add categorical variable to cluster the points in the scatterplot
As groups of adult males and females do not generally have similar heights and weights, let's label the points as to which are male and which are female, so we can examine whether the relationship between height and weight is different by gender.
Use the Chart Builder to create a second scatterplot:
- Click Graphs > Chart Builder....
- Click OK in the Chart Builder warning dialog, if it displays.
The Chart Builder dialog box displays:
- In the Gallery area at the bottom of the box, select Scatter/Dot from the listing.
- Select the top second-from-the-left picture of a scatterplot, labeled Grouped Scatter in the mouse over label, and drag it to the large chart preview window.
The preview retains the X- and Y-Axis assignments. The Element Properties window opens.
- Continuing in the Chart Builder dialog, click and drag the "Gender" variable (from the list on the left) to the new Set Color box at the top right of the preview window.
A grouped scatterplot is now ready to be created.
- At the bottom of the Chart Builder dialog box, click OK.
The Chart Builder dialog box closes and SPSS activates the Output window to display the grouped scatterplot, displaying two colors, one for males and one for females, with the legend indicating which is which.
- Use the chart editor to add a title to the graph.
Examine the gender groupings in the scatterplot to see if the categorical variable adds to our understanding of the form of the relationship.
|
Notes
- ↑ Adapted from Open Learning Initiative. Probability and Statistics: Scatterplot to provide instructions for doing the analyses using SPSS.