Sabtu, 22 Maret 2008

Lesson 2:

Entering Data, Computing Descriptive Statistics, Transforming and Selecting Your Data


The first step in working with SPSS is to enter your data and to create an SPSS data file. Although we will assume in this lesson that you are typing in your data for the first time, you should be aware that SPSS can also read already established data files from other programs such as Excel and Lotus 1-2-3.

When you first open up SPSS for Windows, you will be prompted to make a decision about running the tutorial, typing in new data, opening up an existing file, etc. Because you will be creating a new datafile, click on Type in data and then click OK. This should bring you to the initial screen which is the data editor.

Initial SPSS Data Editor Screen

Key Point

The key to typing in your data is to realize that the data from each case or participant must be typed on a separate line. So, for example, if you were interested in analyzing the five test scores of the 20 students in a class, you would use one line (with five grade scores on each line) for each of the 20 students. If you collected six characteristics (e.g., average family income, average number of children, . . .) for 80 countries, you would use one line for each of the 80 countries (with the six characteristics on each line).

Example

Let's take a concrete example. Assume that you are interested in developing a profile of people who use a soup kitchen in your city. To do this you collected the following information from a random sample of 50 users of the soup kitchen.

Person

Gender

Age

Number of Siblings
Health Score
Personality Score
Activity Score

1

Male

76

0

16.64

15

-4

2

Female

28

3

60.83

22

4

3

Male

39

0

44.25

18

2

4

Male

47

1

49.13

36

0

5

Female

56

0

30.67

25

-1

6

Female

61

0

29.37

20

-3

. . .







50

Male

59

0

35.92

31

2

Other Points to Keep in Mind

As you type in your data, you will need to do each of the following.

  1. Create a separate line for each case, which in this particular example is each person.
  2. Create a column for each variable of interest. In this example, we will use seven columns, one for each of the following variables (person, gender, age, number of siblings, health score, personality score, activity score). Note that it may not be essential to create a column for a person identification number, but we will do so simply to help us keep track of the data.
  3. Develop a numerical code for the gender variable. In this case, we will assign the value of 1 to females and the value of 2 to males.

Creating the Data File

In this section, we will describe the step-by-step procedure for creating your data file.

Step 1. Notice on the bottom left hand corner of the screen that you can access either the Data View or Variable View windows. To view one window or the other, simply click on it. For now, in establishing the variables and their characteristics, you should work in the Variable View window.

Variable View Window

Step 2. In the space for Name, type the desired variable name, which can be no more than 8 characters in length. The first character must be alphabetic; the remaining characters can be alphabetic and/or numeric, and no spaces can appear in the name. So, in this case, let's type "person."

Step 3. Next press the Tab key and you will notice that SPSS assigns default values to all of the settings. You should go through the relevant column for that particular variable. Clicking on a column will often expose a shaded area. You can click on this to pursue your options.

Below we have listed the functions of the columns and the default values.

Change Settings
Default Value

Type -- allows you to define the type of variable

numeric

Width -- total number of characters

8

Decimals -- number of characters beyond the decimal point

2

Label -- allows you to list a more extensive label for your variable. Eight character variable names are difficult to remember, and we recommend that you always exercise the option of listing a more descriptive label.

none

Value -- allows you to provide labels for the various levels of a variable

none

Missing Values -- enables you to designate certain scores as missing.

none

Columns --allows you to change the maximum number of characters in a column.

8

Align -- allows you to determine the alignment of your column

right

Measure -- allows you to determine the kind of scale for that particular variable

scale

In this example, because there are no decimal points in our person variable, click on the gray portion following Numeric and change the Decimal Places to 0. Also, click on Label and type in a label like "participant number" in the Variable Label slot. Note that we could have exercised other options such as modifying the column width and whether the numbers appear left-justified, right-justified, or centered.

Step 4. Now, you should set up the next variable. Click on line 2 of the Name column, on the next var column and type "gender". Because we have decided to use the codes of 1 and 2 to represent females and males, respectively, you can click on Decimals to change the decimal places to 0 (Note that you could have done this also from the Type column). Next, click on Label to provide a label for your variable--for example, you might type "gender of the participants." In this case, because we have specified numeric codes for the different values for our variable and we are likely to forget these over time, we should specify Values. In the field for Value, type a "1," and in the field for Label, type a label such as "females." Then create the label of "males" for a value "2." At this point, your window should look like the one below.

Current Variable View Window

Step 5. You should now define each of the remaining four variables. After you do this, click on the Data View window (lower left hand corner). You should see all of the variable names that you have entered like in the figure below.

Data File (Data View)

Step 6. Now, type in the data for the first six persons in our data sheet. Start by clicking in the left-most column of the first line and type the person's number (i.e., "1"), then, press the Tab Key or the right arrow key and type the first person's gender (i.e., "2"). Continue to do this until the data are typed in. Below we have listed a copy of the data file that we created.

Data file Containing the First Six Lines of the Data

Step 7. When you are satisfied with your data file, you should save it. Click on File and Save and type in a file name (e.g., "soupkit"). Note that SPSS automatically adds the ". sav" suffix to your file name. This is the SPSS suffix that is used to designate data files.

Computing Means and Standard Deviations

Once you have typed in your data, performing statistical procedures is relatively simple. To give you a sense of how to do so, as well as to expose you to some of the powerful SPSS tools for analyzing data, we will take you through several examples. In the first example, we will compute the mean and standard deviations for each of the variables from our soup kitchen study. In the second, we will do this separately for males and females. Finally, in a third example, we will compute a new variable that is a composite of the Health Activity and Personality Scores and compute the mean and standard deviation for this measure.

Computing the Mean and Standard Deviation for All Scores

Step 1. Click on Analyze, then Descriptive Statistics, then Descriptives.

Step 2. Highlight each of the variables for which you are interested in computing descriptive statistics (e.g., Age, Number of Siblings, Health Score, Personality Score, and Activity Score) and move them into the Variable(s) column. Note that you can move all of these variables over at one time by clicking and dragging over the items that you want to select.

Step 3. Click on Options and select the desired statistics. At minimum, you should select the Mean and Std. deviation. Now, click on Continue and then OK.

Step 4. Your output should look like that below. You may have fewer or more statistics depending on your selection in the Options menu. Note that the variable labels appear on your printout.

Output from the Analysis

Step 5. If you would like a hard copy of this output, you can print it by clicking on the print icon on the tool bar. Also, you can save the output by clicking on the disk icon. Note that SPSS automatically adds the ".spo" suffix to your output file name.

Computing Means and Standard Deviations for Males and Females Separately

Step 1. From the output screen, you cannot get to all of the options that you might be interested in. If the option that you are interested in is not available, click on Window, and then SPSS Data Editor to return to the Data Editor window. You will need to do this to do the following exercises.

Step 2. First click on Data and then Split File. This allows you to split the file according to a particular variable and conduct separate analyses for each level of the variable.

Step 3. Next you should select Organize output by groups and move Gender from the variable list to the Groups Based on list. When you have done this, click on OK.

Step 4. Now, click on Analyze, Descriptive Statistics, and Descriptives. Select the desired variable(s) and Options.

Step 5. Note in your output that two sets of data summaries are presented--one for females and one for males.

Computing a New Variable and Then Performing Descriptive Statistics

Assume that in addition to our interest in calculating the means and standard deviations for the collected variables, we wish to compute a composite score that roughly represents some overall measure of physical and mental health. Specifically, assume that we wish to compute the mean and standard deviation for a new variable called overall health that represents the average of each person's Health Score and Personality Score. You can do this by performing the following steps.

Step 1. Click on Transform and then Compute. This should produce the screen shown below.

Compute Variable Screen

Step 2. Type the name of the variable that you wish to create (in this case, we will name it "ohealth") in the Target Variable field. Now, you need to type in the computation that you wish to have performed in the Numeric Expression field. You can use all the operations listed on the bottom of this screen, and it is important to realize that operations within parentheses are performed first. Thus, if we wish to compute the mean of the Health and Personality Scores, we need to add these together before we divide by 2. To do so, simply type (or move over) variable names for the Health and Personality Scores and enclose these within parentheses. Next, click on the / button (or type it-- this is the symbol for division) and follow this with the number "2." Your target variable and your numeric expression fields might look like the following:

Target Variable

Numeric Expression

ohealth =

(health + personal)/2

Step 3. Now you should click on the Type&Label field. This will enable you to create a longer label for your variable and modify the type and width of the variable. Once you have done this, press Continue. Then press OK.

Step 4. Once you have done this, notice that the new variable appears in your data file. Now you are ready to calculate the mean and standard deviation for this new variable by using the procedures outlined above.

Another Example to Help You Practice Creating a Data File for a Data Set

If you would like further practice creating a data file and computing descriptive statistics, work your way through the following example. Assume that you have conducted an experiment to determine if newborn infants prefer patterned or plain stimuli. In the study, 10 infants were presented with both plain and patterned figures. The amount of time spent in looking at each type of stimulus was measured. In addition, the race of the infants and the age (in days) were recorded. The data sheet for this experiment appears below.

Participant
Race
Age
Time Viewing Patterned Figure
Time Viewing Plain Figure

1

Am. Indian

3

15

7

2

Asian

7

13

8

3

White

4

17

9

4

White

6

10

11

5

Afr. Amer.

6

14

7

6

Hispanic

5

16

9

7

White

3

9

7

8

White

4

14

12

9

Asian

7

21

6

10

Afr. Amer.

7

13

9

Below is one possible way to create your data file. Note that you have to create a numeric code for the race variable and in this case we used 1 = American Indian, 2 = Asian, 3 = African American, 4 = Hispanic, and 5 = White. Once you have typed the data file, compare it with the one below. Then, try to compute means and standard deviations for the time viewing the patterned figure and the time viewing the plain figure variables. The results should look like those in the output file below.

Data File for the Infant Viewing Experiment

Data File for the Data

Output File for the Infant Viewing Experiment

Ouput File for the Data

Tidak ada komentar:

Name:*

Email Address:*

Feedback: