SPSS Tutorial
In this orientation session, we will type in a small SPSS data set, save it, and run a short appropriate analysis.
Background:
We are studying the effect of a gingko supplement on the ability of mice to learn a maze. Six mice are selected. Each mouse is timed on its third try at running the maze. Then the mouse spends four weeks on a diet that includes a gingko supplement. A new maze of similar difficulty is constructed, and the mouse is again timed on its third try at running the maze. To control for possible learning effects, a separate group consisting of another six mice undergo a similar experiment. However, in the four weeks between the two trials these mice follow a standard diet without the gingko supplement. The data is shown below.
There are four separate hypothesis tests we may wish to conduct.
#1. Were the groups initially similar in their ability to run the maze?
#2. Did the group with GINGKO show a change ?
#3. Did the group without GINGKO show a change ?
#4. Did the change in the group with GINGKO differ from the change in the group without GINGKO? (MOST IMPORTANT!)
With GingkoWithout Gingko
beforeafterbeforeafter
8.97.912.111.9
9.49.77.87.9
10.49.913.213.0
9.99.211.411.9
8.48.78.78.0
13.112.09.28.1
Be aware that the way we enter data into a statistical software program may not look like the way it is arranged on paper. As a general guideline, usually one person, subject, or respondent will correspond to a single row in the data set. Each column will correspond to a different measurement or variable. So in this case, we will have one row per mouse. It will be as if the block of data on the right has been moved to be underneath the block on the left. This means we will have to create another variable to track whether the mouse was a with or without gingko mouse.
Find the SPSS icon on the desktop and double-click, OR go to ALL PROGRAMS. You should see the Data Editor Screen, something like a spreadsheet for entering data. Note the tabs at the bottom left for Data View and Variable View.
Entering the Data:
Remember the principle: one row per 'person' in the data set.
How many rows will there be in your database? 12 ! One for each of the 12 mice.
How many columns will there be? 3 ! One to track whether the mouse was With/Without Gingko, one for the measurement BEFORE, one for the measurement AFTER.
Click on the Variable View tab, bottom left. Here you can describe the variables in your data set. You can use a row in the Variable View to give the variable a sensible name and to describe details (labels, number of decimal points in displays, etc.). Each row in the Variable View describes the details of a corresponding COLUMN in the Data View.
Call your variables GINGKO, BEFORE, and AFTER. Then move back to the Data View (click on tab at bottom of screen). Each column should now show the name you decided on in the Variable View. Enter the data for each of the 12 mice. Code GINGKO as 0 for without gingko, 1 for with (or any similar numerical code). One of the most important things is to tell SPSS what these codes mean. You do this in the Variable View. Click on the tab for Variable View and go to the row for the Gingko variable. Move to the right, to the column labeled ‘Values’. Click on this cell, and in the right part of the cell you will see a small gray box. Click on this box, and it will call up the Value labels dialog box, shown below. You can type in each possible value, and its label, clicking Add after each. When you have entered all the values and their labels, Click OK. Don’t forget the Add after each individual value!
Note that these codes appear in the computer as numeric, but this is not really quantitative data. There is a difference between numerical codes and true measurements. The value of using numerical codes is that SPSS expects numeric codes when categorizing cases in the t-test and analysis of variance.
Once you have entered your data, save it to your media (usually a thumb drive of some kind, or save it to the desktop then email it to yourself later). Choose FILE / SAVE. In the Look In: box at the top of the menu, highlight the appropriate location. Below, give an appropriate name for your data set, such as MAZES. SPSS files automatically end in the extension .SAV. If you come back later, you can use FILE / OPEN to retrieve your data set.
For future use, we would like to create a column of differences (BEFORE - AFTER). In the menu bar at the top of the screen, locate the very important TRANSFORM option.
Call up the TRANSFORM / COMPUTE VARIABLE option . You should see a dialog box like the one below.
On the left, under 'Target Variable', type the name of the new variable (call it DIFF). On the right, under Numeric Expression', type BEFORE - AFTER. Hit OK. You will see a new column appear in your worksheet.
Graphical Display:
We want to use boxplots to display the data. Use GRAPH / LEGACY DIALOGS / BOXPLOTS.
Highlight 'Simple'. We want to compare the changes (DIFF) for mice with gingko versus those without. These appear as separate cases (rows), so make sure 'summaries for groups of cases' is clicked, then click on DEFINE.
The variable we wish to boxplot is DIFF, the category axis is GINGKO. This should give us a graphical comparison of the changes in the two groups. You can also use boxplots to compare the initial values in the two groups, or the before and after values in each group.
Testing Formal Hypotheses
Of the four hypotheses identified earlier, some are paired comparisons and some are independent samples tests. The first and fourth are independent samples t-tests. What are the dependent variables?
Hypotheses #2 and #3 are paired comparisons run on separate subgroups in the data set. #2 uses only the mice with GINGKO = 1, while #3 uses only those with GINGKO = 0. To select a particular subgroup of the data set, you will need to use DATA / SELECT CASES / IF CONDITION IS SATISFIED. You will then see a screen where you can select the cases that you want:
Fill in the big box on the top right with the cases you want to work with first: GINGKO=1 (you can select variable names from the table on the left and use the arrow to move them into the box on the right, to save yourself some typing). After you have the box filled in, hit CONTINUE, then OK.
Then ANALYZE / COMPARE MEANS / PAIRED SAMPLES T-TEST will perform the test for you. You will have to fill in the dialog box giving the names of the two columns that are being paired (differenced). Here, that is the Before and After columns.
After you do it for mice with GINGKO=1 you need to go back to DATA / SELECT CASES to change the condition to select mice who did not get gingko, then re-run the analysis.
For #1 and #4, you will need to go back into DATA / SELECT CASES / ALL CASES to return to using all the data. Then ANALYZE / COMPARE MEANS / INDEPENDENT SAMPLES T-TEST will conduct the comparison.
WRITING UP YOUR RESULTS
Try writing up your results. Assume you already have a working introduction, similar, perhaps, to the background statement given in this handout. You want a brief statistical methods section, a results section, and a summary or conclusion. It is helpful to outline the results section first so you are clear on the most important points that need to be made. Obviously, you want to address each of the four formal questions posed to you. Write down your answers to these questions, and briefly note what graphs, descriptive statistics and/or formal test results you want to cite to back up your answers. Then begin writing your report.
If you are using WORD as a wordprocessor, then you can usually clip graphs out of SPSS output by right-clicking on the object and selecting COPY or COPY OBJECT, the pasting them directly in to your document. However, some versions of SPSS are not always compatible with newer versions of WORD, so this may take some experimentation.
Some style points:
- Only those tables and graphs which you specifically discuss in the text should be included in the report. Each table/graph should have a number (e.g. Table 1, Figure 1) and a descriptive caption. They should be numbered in the same order in which they are discussed in the text. Do not attempt to run the tables and graphs into the text, collect them up and put them at the end.
- Pay special attention to the structure of your paragraphs. That is, each needs a clear topic sentence, usually the first sentence. If you write down just the topic sentences from all the paragraph, they should form a coherent flow of ideas.
- Each report should be typed double-spaced in 12-point type.
- Hypothesis tests should be sufficiently well described that the reader can tell what kinds of tests were used. If a particular test is used a lot (say, a two-sample t-test), then the general method can be briefly described in the statistical methods sections. In the statistical methods section, say what significance level you will be using.
- Usually the output from SPSS is far more voluminous than you need to support your conclusions. For example, you may only pick out a t-test value, its df, and a p-value that you actually need from a large table. In that case, just include those numbers in your writeup, and drop the table from your report (but keep it in your notes).
- As you think about the SPSS results you actually need for your report, you may find that you want to re-type the main statistics into a single table – say, a table of means and standard deviations of the most important variables. This is good! Don’t want a lot of raw SPSS output!
- Reports are not written in the same style as a problem set. The goal is to communicate to a layman who does not know a lot of statistics, but still be specific enough that an expert can know precisely how you did the analysis.
A sample writeup for the Gingko data is available.
1