spss: the (almost) statistics-free guide

12
SPSS: The (almost) Statistics-free Guide Introduction: SPSS Fundamentals Recent Versions * SPSS 14.0: Chart builder introduced * SPSS 15.0: Improvements to the Chart Builder * SPSS 16.0: Nice cosmetic upgrades (sort cases, spell check) * SPSS 17.0: Changes to the syntax editor * PASW 17.0.2: Name change, anything else? More information: http://www.spss.com/software_version/index.cfm?product=base/ Licensing SPSS has various licensing options: Site License: annual license, based on number of copies installed Network License: Based on simultaneous users. Options for “commuter” (off-campus) access Enterprise License: unlimited site/network license instances Student Edition: SPSS offers a student version, which now doesn’t differ from SPSS Base versions at a lower cost to students. Basic Workflow You begin by defining a set of variables, and then you enter data for the variables to create a number of cases. Variables: the things we are measuring (AGE, GPA, BMI) (column) Values: the data points within each variable (cell) Cases: the set of values assigned to the collection of variables (row) Variables have types. That is, each variable is a specific kind of number. For example, a scale variable is a numeric measurement, such as weight. A nominal variable contains values that define a category; for example, a variable named gender could be a categorical variable defined to contain only values 1 for female and 2 for male. An ordinal variable uses numbers to represent concepts, but the concepts have a natural order, such as a likert scale. Things that make sense for one type of variable don't necessarily make sense for another. For example, it makes sense to calculate the weight, but not the average gender. After your data is entered into SPSS — your cases are all defined by values stored in the variables — you can run an analysis. What analysis you do is based on what data you have collected and what you want to find out. SPSS will run analyses that make no sense for your data. You can instruct SPSS to draw graphs and charts the same way you instruct it to do an analysis. You select the desired graph from the menu, assign variables to it, and click OK. When preparing SPSS to draw a graph, the OK button is unavailable until you have made all the choices necessary to produce output. Whether the output makes sense is up to you and your data, but SPSS makes certain that the choices you make can be used to produce some kind of result. All output from SPSS goes to the same place — a window named SPSS Viewer. It opens to display the results of whatever you've done. After you have output, if you perform some action that produces more output, the new output is displayed in the same dialog box. Almost anything you do produces output – including any error messages SPSS provides you.

Upload: others

Post on 05-Oct-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

SPSS: The (almost) Statistics-free Guide

Introduction: SPSS Fundamentals Recent Versions * SPSS 14.0: Chart builder introduced * SPSS 15.0: Improvements to the Chart Builder * SPSS 16.0: Nice cosmetic upgrades (sort cases, spell check) * SPSS 17.0: Changes to the syntax editor * PASW 17.0.2: Name change, anything else? More information: http://www.spss.com/software_version/index.cfm?product=base/ Licensing SPSS has various licensing options:

Site License: annual license, based on number of copies installed Network License: Based on simultaneous users. Options for “commuter” (off-campus) access Enterprise License: unlimited site/network license instances

Student Edition: SPSS offers a student version, which now doesn’t differ from SPSS Base versions at a lower cost to students. Basic Workflow You begin by defining a set of variables, and then you enter data for the variables to create a number of cases.

Variables: the things we are measuring (AGE, GPA, BMI) (column) Values: the data points within each variable (cell) Cases: the set of values assigned to the collection of variables (row)

Variables have types. That is, each variable is a specific kind of number. For example, a scale variable is a numeric measurement, such as weight. A nominal variable contains values that define a category; for example, a variable named gender could be a categorical variable defined to contain only values 1 for female and 2 for male. An ordinal variable uses numbers to represent concepts, but the concepts have a natural order, such as a likert scale. Things that make sense for one type of variable don't necessarily make sense for another. For example, it makes sense to calculate the weight, but not the average gender. After your data is entered into SPSS — your cases are all defined by values stored in the variables — you can run an analysis. What analysis you do is based on what data you have collected and what you want to find out. SPSS will run analyses that make no sense for your data. You can instruct SPSS to draw graphs and charts the same way you instruct it to do an analysis. You select the desired graph from the menu, assign variables to it, and click OK. When preparing SPSS to draw a graph, the OK button is unavailable until you have made all the choices necessary to produce output. Whether the output makes sense is up to you and your data, but SPSS makes certain that the choices you make can be used to produce some kind of result. All output from SPSS goes to the same place — a window named SPSS Viewer. It opens to display the results of whatever you've done. After you have output, if you perform some action that produces more output, the new output is displayed in the same dialog box. Almost anything you do produces output – including any error messages SPSS provides you.

SPSS Windows Syntax Editor:

The command interface of SPSS. Anything you can do using the menus in SPSS can be done in the Syntax Editor as long as you know the command language. SPSS command language allows you to save and automate many common tasks. File extension is .sps

Data Editor: The spreadsheet-like view for creating and editing your data. The Data Editor provides two views of your data:

• Data View: This view displays the actual data values or defined value labels. • Variable View: This view displays variable definition information.

File extension is .sav Chart Editor:

The Chart Editor is an easy to use graphical interface for editing the look of, and the data behind, charts/graphs. It can only be accessed after creating a chart.

Output Window (SPSS Viewer): The Output Window displays the results of actions taken in SPSS, including analysis, charts, error messages, etc. Outputs can be edited and exported into other formats. Extensions are .spo (v15 and lower) and .spv (v16 and higher).

Module I: Getting Data into SPSS Using an existing Syntax file If you have downloaded data from IDLS, DLS or STC, you will have noticed that it comes in two parts: the raw data (extensions: .txt, .dat) and the syntax file (.sps). The syntax file contains all the specifications necessary for SPSS to properly understand and import the data, all you need to do is to point it in the direction of the raw data file. EXERCISE

1. Open the DLI folder on your desktop, then open the Session 2.1 folder 2. Open dli09data.sps by double clicking it 3. On the first line of the file not preceded by an asterisk (*), change the question marks to point the syntax to the

text file location. It should look something like the following: Data list list(tab) file='C:\Documents and Settings\tempuser.8KU1CEU8\Desktop\DLI\Session 2.1\dli09data.txt skip=1 / 1

4. Select Run - All

Module II: Defining Data The data view displays your data, the variable view describes it. In the variable view you can define the following:

Variable Names Variable name 64 character limit, combination of letters, numbers and characters. No spaces allowed.

Variable Labels Descriptive label for the variable

256 character limit, spaces allowed

Values Labels Descriptive labels for values of a variable

120 character limit

Missing Data Define values as specific user-missing

Measures Set the level of measurement for the variable

Scale/Ordinal/Nominal

Sidebar: Verifying your data Use the Frequencies command to obtain a snapshot of your data – this helps you look for suppressed variables, low response rate and other data quality problems. EXERCISE

1. Select Analyze -- Descriptive Statistics – Frequencies

2. In the dialog box that appears, click the following four variables and use the arrow to move them into the Variable (s) box (you can use CTRL+click to select multiple variables at once).

3. Click OK Module III: Manipulating Data There are many ways to organize your data to make it easier to analyze your results. You can reorder your cases, filter cases, and even recode variables. Sorting cases Sorting just reorganizes your cases (rows) in the data view so that appear in the order you want – it doesn’t in any way change your data. To sort cases, select Data – Sort Cases… Then select the variable you would like to sort by, click ascending or descending and select OK. Recoding Variables Sometimes you will want group values in a variable in a different way (for example, aggregate the values for an AGE variable into age groups). The recoding command is a powerful tool for just that. EXERCISE Let’s recode the BMI variable into standard BMI classes (underweight, normal weight, overweight and obese). Here’s what you need to know:

Underweight = BMI less than 18.50 Normal weight = BMI between 18.50 and 24.99 Overweight = BMI between 25.00 and 29.99 Obese= BMI over 30.00

1. Select Transform – Recode into Different Variables… 2. Click on HWTDGBMI and move it into the Numeric Variables…box

3. Select Old and New Values… To recode the variables:

Select Range LOWEST through Value

Type in 18.49

Under New Value type in 1

Click on Add

Select Range

Type 18.50 in the first box and 24.99 in the second

Under New Value type in 2

Click on Add

Select Range

Type 25.00 in the first box and 29.99 in the second

Under New Value type in 3

Click on Add

Select Range

Type 30.50 in the first box and 999.00 in the second

Under New Value type in 4

Click on Add Now let’s deal with the missing values

Select All other values

Select Copy old value(s)

Click Add

4. Click Continue 5. Under output variable enter BMIGRP for Name and BMI Classification for Label 6. Click Change 7. Click OK

Define the value labels for our new variable BMIGRP.

1. Click in the values box for BMIGRP. When the icon appears, click it. 2. In the Value Labels dialog box type 1 in to the Value box, then type Underweight in the Label box. Click the Add

button. 3. Add the rest of the value labels the same way: 2=Normal Weight, 3=Overweight, 4=Obese

One you have added all the values, click OK

Filtering cases Filtering cases temporarily removes the cases that don’t meet a certain criteria from your dataset so that you can perform analysis on only the selected cases. NOTE: you can use the Select Cases command to delete cases that don’t meet a condition, but this isn’t recommended by me unless you know exactly what you’re doing! EXERCISE

1. Select Data – Select Cases… 2. In the dialog box that appears, click If Condition is Satisfied, then click If…

FREQUENCY TIME!

3. Highlight BMIGRP and use the arrow to move it into the calculator window. 4. Click on the ‘greater than’ (>) sign, and type in 1.00

5. Click Continue 6. Click OK

FREQUENCY TIME!

Module V: Graphing Data

Graphs display your data in a visual format that helps others and yourself better understand your data.

With the development of the Chart Builder, SPSS possesses robust and easy to use graphing capabilities. The Chart Builder checks what you're doing as you proceed and won't allow you to try things that won't work. The OK button won’t appear until you’ve done what SPSS needs to produce a graph.

EXERCISE

1. Click on Graphs – Chart Builder 2. Select Pie/Polar on the right, then drag the pie chart icon up into the chart preview window 3. Highlight Number of Hours per week watching Television/videos (SACD_3) and move it on the Slice By box

4. Click on Element Properties until the Element Properties dialog box pops up 5. Click on GroupColor 6. Under Order, highlight Not Stated and click on the x icon to move it to the Exclude box

7. Click Apply 8. Click Ok in the Chart Builder window

The Chart should appear in your Output file. To edit the look of your pie chart, double click on it. This will open the Chart Editor window where you can change colours, borders, backgrounds, and more. EXERCISE

1. Click on Graphs – Chart Builder 2. Select Histogram on the right, then drag the simple histogram icon up into the chart preview window 3. Highlight Body Mass Index (BMI): Self reported and move it on the Slice By box 4. Click on Element Properties until the Element Properties dialog box pops up 5. Select Display Normal Curve 6. Click Apply 7. Click Ok in the Chart Builder window

BONUS Module

Building a Syntax file to Import Data Everything you do with the menus in SPSS, you can do with command language in the Syntax editor. Most of the time, it’s easier for us to use the menus available in the Data Editor, but if you have data file that you want to import into SPSS, it can be more efficient to use the Syntax Editors. Commands: the Syntax editor works on a relatively simple command language. A full list of commands and definitions is available through Help – Command Syntax Reference. Here are the codes we will be using today:

Data list Reads text data files.

Variable labels Assigns descriptive labels to variables.

Value Labels Assigns descriptive labels to data values.

Missing values Specifies values to be treated as missing.

Constructing command statements Every statement has the following order: Command, subcommand, specifications, period.

EXERCISE

1. Open cchs2_2new.txt from Session 2.1 2. Answer the following questions:

- Is the file tab delimited? - What are the variable names?

3. Open SPSS 4. Select File – New - Syntax 5. Type in the DATA LIST command as follows, putting in the correct file path:

Data list list(tab) file='FILEPATH\cchs2_2new.txt' skip=1 / 1

ID (F6.0)

COMP (F2.0)

VIDEO (F2.0)

TV (F2.0)

BMI (F6.2)

WTSD1 (F8.2)

WTSD2 (F8.2)

. Next, enter the Value labels command for the variable COMP

6. Type the value labels for COMP to the syntax file so that it looks like this:

Value labels COMP

1 ‘None’

2 ‘Less 1 Hour’

3 ‘1 To 2 Hours’

4 ‘3 To 5 Hours’

5 ‘6 To 10 Hours’

6 ‘11 To 14 Hours’

7 ‘15 To 20 Hours’

8 ‘More Than 20 Hours’

96 ‘Not Applicable’

97 ‘Don't Know’

98 ‘Refusal’

99 ‘Not Stated’

Example: Data list list(tab) file='c:\data\ftp27825.dat' skip=1 / 1 ADMD_RNO (F6.0) GEOD_PRV (F2.0) GEODDPMF (F5.0) SACD_3 (F2.0) HWTDGBMI (F6.2) HWTDGISW (F1.0) WTSD_MHW (F8.2) WTSD_M (F8.2) .

.

7. Repeat step 8 for the VIDEO and TV Variables 8. Type in the missing values command as follows: Missing Values 9. Type in missing values look like this:

Missing values

COMP (96, 99)

VIDEO (96, 99)

TV (96, 99)

BMI (999.96, 999.99)

WTSD1 (-1.00)

WTSD2 ()

.

10. Type Execute. (Double-check to make sure you aren’t missing any periods.)

11. Select Run - All

The Paste Command

In almost all of the SPSS dialog boxes next to the OK button, you will see an option called Paste. This generates the

command syntax from the dialog box selections and pastes the syntax into a syntax window. You can then

manipulate the syntax file or save the syntax to run the analysis later.