Professional Documents
Culture Documents
Summer 2007
Contents
Purpose of handout & Compatibility between different versions of SPSS.. 1 SPSS window & menus 1 Getting data into SPSS & Editing data.. 3 Reading an SPSS viewer/output (.spo) file & Editing your pout. 7 Saving data as an SPSS data (.sav) file..... 8 Saving your output (statistical results and graphs) 9 Exporting SPSS Output. 10 Printing your work & Exiting SPSS.. 12 Running SPSS using syntax or command language (.sps files). 13 Creating a new variable. 14 Recoding or combining categories of a variable15 Summarizing your data Frequency tables (& bar charts) for categorical variables. 20 Contingency tables for categorical variables. 21 Descriptive statistics (& histograms) for numerical variables.. 22 Descriptive statistics (& boxplots) by groups for numerical variables. 24 Using the Split File option for summaries by groups 26 Using the Select Cases option for summaries for a subgroup of subjects/observations 27 Graphing your data Bar chart 28 Histogram & Boxplot 29 Normal probability plot. 30 Error bar plot..31 Scatter plot. 32 Adding a line or loess smooth to a scatter plot.. 32 Stem-and-leaf plot..33 Hypothesis tests & Confidence intervals One sample t test & Confidence interval for a mean. 34 Paired t test & Confidence interval for the difference between means. 37 Two sample t test & Confidence interval for the difference between means 39 Sign test and Wilcoxon signed rank test....... 42 Mann Whitney U test (or Wilcoxon rank sum test).............. 45 One-way ANOVA (Analysis of variance) & Post-hoc tests......... 47 Kruskal-Wallis test.....50 One-sample binomial test...... 52 McNemars test..53 Chi-square test for contingency tables...55 Fishers exact test.......55 Trend test for contingency tables/ordinal variables....... 55 Binomial, McNemars, Chi-square and Fishers exact tests using summary data.... 59 Confidence interval for a proportion. 63 Correlation & Regression Pearson and spearman rank correlation coefficient....... 65 Linear regression........68 Liner regression via ANOVA commands..76 Logistic regression 80
Purpose of handout
SPSS for Windows provides a powerful statistical and data management system in a graphical environment. The user interfaces make statistical analysis more accessible for casual users and more convenient for experienced users. Most tasks can be accomplished simply by pointing and clicking the mouse. The objective of this handout is to get you oriented with SPSS for Windows. It teaches you how to enter and save data in SPSS, how to edit and transform data, how to explore your data by producing graphics and summary descriptives, and how to use pointing and clicking to run statistical procedures. It is also intended to serve as a reference guide for SPSS procedures that you will need to know to do your homework assignments.
Window Types
SPSS Data Editor. When you start an SPSS session, you usually see the Data Editor window (otherwise you will see a Viewer window). The Data Editor displays the contents of the working data file. There a two views in the data editor window: 1) Data View displays the data in a spreadsheet format with variable names listed for column headings, and 2) Variable View which displays information about the variables in your data set. In the Data View you can edit or enter data, and in the Variable View you can change the format of a variable, add format and variable labels, etc. SPSS Viewer/Output. Statistical results and graphs are displayed in the Viewer window. The (output) Viewer window is divided into two panes. The right-hand pane contains the all the output and the left-hand pane contains a tree-structure of the results. You can use the left-hand pane for navigating through, editing and printing your results.
2 Chart Editor. The chart editor is used to edit graphs. When you double-click on figure or graph, it will reappear in a chart editor window. SPSS Syntax Editor. The Syntax Editor is used to create SPSS command syntax for using the SPSS production facility. Usually you will be using the point and click facilities of SPSS, and hence, you will not need to use the Syntax Editor. More information about the Syntax Editor and using the SPSS syntax is given in the SPSS Help Tutorials under Working with Syntax. A few instructions to get you started are given later in the handout in the section Running SPSS using the Syntax Editor (or Command Language)
Menus
Data Editor Menu: File. Use the File menu to create a new SPSS file, open an existing file, or read in spreadsheet or database files created by other software programs (e.g., Excel). Edit. Use the Edit menu to modify or copy data and output files. View. Choose which buttons are available in the window or how the window should look. Data. Use the Data menu to make changes to SPSS data files, such as merging files, transposing variables, or creating subsets of cases for subset analysis. Transform. Use the Transform menu to make changes to selected variables in the data file (e.g., to recode a variable) and to compute new variables based on existing variables. Analyze. Use the Analyze menu to select the various statistical procedures you want to use, such as descriptive statistics, cross-tabulation, hypothesis testing and regression analysis. Graphs. Use the Graphs menu to display the data using bar charts, histograms, scatterplots, boxplots, or other graphical displays . All graphs can be customized with the Chart Editor. Utilities. Use the Utilities menu to view variable labels for each variable. Add-ons. Information about other SPSS software. Window. Choose which window you want to view. Help. Index of help topics, tutorials, SPSS home page, Statistics coach, and version of SPSS. Viewer Menu: Menu is similar to Data Editor menu, but has two additional options: Insert. Use the insert menu to edit your output Format. Use the format menu to change the format of your output. Chart Editor Menu: Use SPSS Help to learn more about the Chart Editor.
Toolbars
Most Windows applications provide buttons arranged along the top of a window that act as shortcuts to executing various functions. In SPSS, you will find such buttons (icons) at the top the of the Data Editor, Viewer, Chart Editor, and Syntax windows. The icons are usually symbolic representations of the procedure they execute when pushed, unfortunately their meanings are not intuitively obvious until one has already used them. Hence, the best way to learn these buttons is to use them and note what happens. The Status Bar The Status Bar runs along the bottom of a window and alerts the user to the status of the system. Typical messages one will see are SPSS Processor is ready, Running procedure. The Status Bar will also provide up-to-date information concerning special manipulations of the data file like whether only certain cases are being used in an analysis or if the data has been weighted according to the value of some variable.
File Types
Data Files. A file with an extension of .sav is assumed to be a data file in SPSS for Windows format. A file with an extension of .por is a portable SPSS data file. The contents of a data file are displayed in the Data Editor window. Viewer (Output) Files. A file with an extension of .spo is assumed to be a Viewer file containing statistical results and graphs. Syntax (Command) Files. A file witn an extension of .sps is assumed to be a Syntax file containing spss syntax and commands.
1. 2. 3. 4. 5. 6. 7.
Choose Cancel Choose File on the menu bar Choose Open Choose Data... Edit the directory or disk drive to indicate where the data is located. Double click on the filename or Single click on the filename and choose Open
You can also get to the Import Wizard as follows: 1. 2. 3. 4. 5. 6. 7. 8. Choose File on the menu bar Choose Open Choose Data... Choose Files of Type *.dat Edit the directory or disk drive to indicate where the data is located Double click on the filename or Single click on the filename and choose Open Follow the Import Wizard Instructions.
Instructions on how to read a text data file in fixed format are located in SPSS Help Tutorials under Reading Data from a Text File.
6 Editing Data. With the Data Editor, you can modify a data file in many ways. For example you can change values or cut, copy, and paste values, or add and delete cases. To Change a Data Value: 1. Click on a data cell. The cell value is displayed in the cell editor. 2. Type the new value. It replaces the old value in the cell editor. 3. Press then Enter key. The new value appears in the data cell. To Cut, Copy, and Paste Data Values 1. Select (highlight) the cell value(s) you want to cut or copy. 2. Pull down the Edit box on the main menu bar. 3. Choose Cut. The selected cell values will be copied, then deleted. Or 4. Choose Copy. The selected cell values will be copied, but not deleted. 5. Select the target cell(s) (where you want to put the cut or copy values). 6. Pull down the Edit box on the main menu bar. 7. Choose Paste. The cut or copy values will be ``pasted'' in the target cells. To Delete a Case (i.e., a Row of Data) 1. Click on the case number on the left side of the row. The whole row will be highlighted. 2. Pull down the Edit box on the main menu bar. 3. Choose Clear. To Add a Case (i.e., a Row of Data) 1. Select any cell in the case from the row below where you want to insert the new case. 2. Pull down the Data box on the main menu bar. 3. Choose Insert. Defining Variables. The default name for new variables is the prefix var and a sequential fivedigit number (e.g., var00001, var00002, var00003). To change the name, format and other attributes of a variable. 1. Double click on the variable name at the top of a column or, 2. Click on the Variable View tab at the bottom of Data Editor Window. 3. Edit the variable name under column labeled Name. The variable name must be eight characters or less in length. You can also specify the number of decimal places (under Decimals), assign a descriptive name (under Label), define missing values (under Missing), define the type of variable (under Measure; e.g., scale, ordinal, nominal), and define the values for nominal variables (under Values). After the data is entered (or several times during data entering), you will want to save it as an SPSS save file. See the section on Saving Data As An SPSS Save File.
8 By default in SPSS a P-value is displayed as .000 if the P-value is less than .001. You can report the P-value as <.001 or to have SPSS display more significant digits: 1. In a SPSS (output) Viewer window double click (with the left mouse button) on the table containing the p-value you want to display differently A ``editing box'' should appear around the table. 2. Click on the p-value using the right mouse button. 3. Choose Cell Properties. (If you do not get this option, you need to double click on the table to get the ragged box.) 4. Change the number of decimals to the desired number (default is 3). 5. Choose OK or 6. Double click on the p-value with the left mouse button and SPSS will display the p-value with more significant digits. If the p-value is very small, the p-value will be displayed in scientific notation (e.g., 1.745E-10 = 0.0000000001745).