Create a two-way table with SPSS
In 1999 the news media ran a number of stories about a recently released research study which suggested that using a nightlight during a child's first years may lead to nearsightedness. Researchers from University of Pennsylvania and Children's Hospital of Philadelphia collaborated on a study of 479 children as to the lighting conditions under which they slept between birth and 2 years of age (lamp, night light, or no light) and whether or not they developed nearsightedness. The researchers were interested in the relationship between a young child's nighttime exposure to light and his/her later nearsightedness.
The dataset contains 479 observations and two variables:
- Light: lamp, night light, no light
- Nearsightedness: no, yes
- an SPSS version of the dataset is available on your class website: nightlight.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 two-way table of nightlight vs. nearsightedness
Before beginning the analysis, you will need to determine which variable is explanatory and which is response.
Use the Crosstabs (short for crosstabulation) routine in SPSS to create the two-way table.
- Select Analyze > Descriptive Statistics > Crosstabs....
The Crosstabs dialog box opens.
- Move the explanatory variable into the Column(s): field.
- Move the response variable into the Row(s): field.
To include conditional percents in the table:
- Select the Cells... button.
The Crosstabs: Cell Display dialog box opens.
- Check the box for Columns. (This will create percents conditioned on the column variable, which we set as the explanatory variable.)
- Click Continue.
The cells dialog closes.
- Click OK.
The Crosstabs dialog box closes and SPSS activates the Output window to display the two-way table.
Create a clustered bar graph
To further describe the relationship, consider creating a clustered bar graph showing the conditional percents.
- In Chart Builder, under the options for Bar, drag the Clustered Bar image to the preview window.
- Drag the response variable to the X-Axis? field.
- Drag the explanatory variable to the box in the upper right labeled Cluster on X: set color.
In the Element Properties dialog box:
- Click the down arrow under Statistic: to change the y-axis statistic from Count to Percentage(?).
- Click the Set Parameters button.
The Element Properties: Set Parameters dialog box displays. To specify a conditional percentage, in the Denominator for Computing Percentage field:
- Select Total for Each Legend Variable Category (same fill color).
- Click Continue.
In the Element Properties dialog:
- Click Apply.
In the Chart Builder dialog:
- Click OK.
The graph displays in the Output window. Use the Chart Editor to add a title, adjust the y-axis label to indicate percentage of lamp, night light, or no light, and add the percentage label to each bar (Elements > Show Data Labels).
- Adapted from Open Learning Initiative. Probability and Statistics: Case C → C to provide instructions for doing the analyses using SPSS.