Presentation is loading. Please wait.

Presentation is loading. Please wait.

CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH (CSSCR) UNIVERSITY OF WASHINGTON SPRING 2013 CONSULTANT: SHIN HAENG LEE Introduction to SPSS.

Similar presentations


Presentation on theme: "CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH (CSSCR) UNIVERSITY OF WASHINGTON SPRING 2013 CONSULTANT: SHIN HAENG LEE Introduction to SPSS."— Presentation transcript:

1 CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH (CSSCR) UNIVERSITY OF WASHINGTON SPRING 2013 CONSULTANT: SHIN HAENG LEE Introduction to SPSS

2 Class Objectives Opening and managing datasets SPSS Syntax Running descriptive statistics and crosstabs Hypothesis Testing and Inferential Statistics Resources for learning more about SPSS

3 Basic Structure of SPSS SPSS has three windows for working with data  The Data Editor Window (.sav) Shows data in two forms: Data view & Variable view  The Output Viewer Window (.spv) Shows results of data analysis  The Syntax Editor Window (.sps) Shows the syntax command script. This is also where you can type and run your own syntax commands. GUI (Graphical User Interface): Commands can be issued by the mouse through menu selections that cause dialog boxes to appear Syntax: Write command language programs to store and run your statistical processes.

4 Why Use Syntax? Can save a great deal of time when running repetitive analyses. Easy to document your work. Can instantly duplicate that work with a new (or updated) data set. Can ‘tweak’ your analysis in ways not available through dialog boxes. Creating and Saving a Syntax File: Syntax files in SPSS are plain text files with an extension of ‘.sps’. 1) To open a new syntax file: File > New > Syntax 2) To save the file: File > Save> (Dialogue box will pop up. Name and designate location)

5 Importing a Data File Select File > Open > Data Locate the folder that contains your data file. Select the format of your incoming data with the “Files of type” button. Locate and select your data file, then click Open. A window will appear and ask whether the first row in the dataset represents variable names (Yes), click OK Check to see the data appears as in your original dataset Go to: Start -> Run Then Type: o:classdata spssint The files will then be automatically copied to c:\temp\spssint For the examples covered in this presentation, open “GSS2012.sav ”

6 How to Use Syntax? Archiving Procedure and Describing Data The easiest way to start using syntax is by using the ‘paste’ button available in most dialog boxes. 1) Select the options you wish from the dialog box, then, instead of clicking ‘OK’, click ‘Paste’. 2) If you already have a syntax window open, the commands will be pasted at the bottom of the currently active syntax window. 3) The Syntax Editor allows you to edit a plain text file and submit selected commands to SPSS directly. 4) To run only part of the commands, highlight the commands you wish to run 5) Hit the green arrow (run command) and you will see on your output viewer the results of your commands.

7 Structure of Commands in SPSS syntax Commands in SPSS begin with a keyword that is the name of the command followed by any subcommands and user specifications. The end of the command is marked by a period. In SPSS syntax files, commands must always be placed in the first column. Refer to the Command Syntax Reference for a discussion of available commands and options. It can be found in the menus under Help > Command Syntax Reference. You can add notes (using *), cut, paste and edit just as with any other text file. Remember not to add other periods in your documentation if you use this method, since SPSS will try to interpret everything after the period as commands. Another method is to use /* and */ to set off a comment. That is, start with /*, insert your comment of as many or as few words and lines as you want then end the comment with */.

8 Data Management: RECODE The RECODE command: Change the values of a variable. It is useful to reverse code responses to a survey (change the highest response to the lowest and vice versa). Transform > Recode into Different Variables Recode variables: happy7, sex, marital, health1, socbar, socfrend Syntax Programming: DATASET ACTIVATE DataSet1. RECODE happy7 (7=1) (6=2) (5=3) (4=4) (3=5) (2=6) (1=7) INTO happiness. VARIABLE LABELS happiness ‘HOW HAPPY YOU ARE’. VALUE LABELS happiness 1 ‘Completely unhappy’ 2 ‘Very unhappy’ 3 ‘Fairly unhappy 4 ‘Neither happy nor unhappy’ 5 ‘Fairly happy’ 6 ‘Very happy’ 7 ‘Completely happy’. RECODE sex (1=1) (2=0) INTO male. VARIABLE LABELS male ‘MALE (Yes)’. VALUE LABELS male 1 ‘Male’ 0 ‘Female’.

9 Data Management: RECODE RECODE marital (1=1) (ELSE=0) INTO married. VARIABLE LABELS married ‘MARRIED (Yes)’. VALUE LABELS married 1 ‘Married’ 0 ‘Single’. RECODE health1 (5=1) (4=2) (3=3) (2=4) (1=5) INTO health_new. VARIABLE LABELS health_new ‘HEALTH IN GENERAL’. VALUE LABELS health_new 1 ‘Poor’ 2 ‘Fair’ 3 ‘Good’ 4 ‘Very good’ 5 ‘Excellent’. RECODE socbar (7=1) (6=2) (5=3) (4=4) (3=5) (2=6) (1=7) INTO socbar_new. VARIABLE LABELS socbar_new ‘SPEND EVENING AT BAR’. VALUE LABELS socbar_new 1 “Never’ 2 ‘Once a year’ 3 ‘Sev times a year’ 4 ‘Once a month’ 5 ‘Sev time a mnth’ 6 ‘Sev times a wekk’ 7 ‘Almost daily’. RECODE socfrend (7=1) (6=2) (5=3) (4=4) (3=5) (2=6) (1=7) INTO socfrend_new. VARIABLE LABELS socfrend_new ‘SPEND EVENING WITH FRIENDS’. VALUE LABELS socfrend_new 1 “Never’ 2 ‘Once a year’ 3 ‘Sev times a year’ 4 ‘Once a month’ 5 ‘Sev time a mnth’ 6 ‘Sev times a wekk’ 7 ‘Almost daily’. EXECUTE.

10 Data Management: COMPUTE The COMPUTE command: Create new numeric variables or modify the values of existing string or numeric variables. Transform > Compute Variable Create a new numeric variable: sociability Syntax Programming: COMPUTE sociability=socbar_new+socfrend+new. VARIABLE LABELS sociability ‘HOW SOCIABLE YOU ARE’. EXECUTE.

11 Descriptive statistics Go to Analyze > Descriptive Statistics > Descriptives Select the variables for which you want descriptives. Then click Paste. By default, SPSS will paste syntax with commands and specifications in all caps, and will display variables as you have entered them. Variable names in SPSS are generally separated by spaces. Don’t forget the period at the end of the command. Syntax Programming: DESCRIPTIVES VARIABLES=happiness age childs health_new sociability /STATISTICS=MEAN STDDEV MIN MAX.

12 Frequencies for categorical data Go to Analyze > Descriptive Statistics > Frequencies FREQUENCIES produces tables of frequency counts and percentages of the values of individual variables. FREQUENCIES is used to obtain frequencies and statistics for categorical variables and to obtain statistics and graphical displays for continuous variables. Syntax Programming: FREQUENCIES VARIABLES=sex income married degree /BARCHART PERCENT /ORDER=ANALYSIS.

13 Cross tabulation To look at frequencies of data nested across multiple variables (an run a Chi-Square test): Analyze > Descriptive Statistics > Crosstabs Move the variables of interest over with the arrows (ex: sex & degree). Select the options you would like to apply to the Crosstabs output (Statistics, etc.). Click Paste. Syntax Programming: CROSSTABS /TABLES=degree BY sex /FORMAT=AVALUE TABLES /CELLS=COUNT EXPECTED COLUMN /COUNT ROUND CELL /BARCHART.

14 Hypothesis Testing: t-test There are three types of t-tests: 1) One-Sample T test- to compare a single sample with a population value, 2) Independent-Samples T test- to compare two groups’ scores on the same variable, and 3) Paired-Sample T test- to compare the means of two variables within a single group. To compare the means of happiness for two groups of cases: Go to Analyze > Compare means > Independent-samples t-test Syntax Programming: DATASET ACTIVATE Dataset1. T-TEST GROUPS=married(0 1) /MISSING=ANALYSIS /VARIABLES=happiness /CRITERIA=CI(.95).

15 Hypothesis Testing: correlation Go to Analyze > Correlate. Select Bivariate, if you are interested only in the relationships between two variables, or Partial, if you are measuring the association between two variables but want to factor out the effect of other variables. Select the variables for which you want the correlation. Ex) happiness age, income, & degree Then click Paste. Syntax Programming: NONPAR CORR /VARIABLES=happiness age income degree /PRINT=SPEARMAN TWOTAIL NOSIG /MISSING=PAIRWISE.

16 Hypothesis Testing: linear regression To run a multiple linear regression (OLS) Go to Analyze > Regression > Linear. Select your dependent variable ( happiness ) and your independent variables ( age, male, income, degree, married, childs, health_new, sociability ) from the list on the left, then click Paste. We can make a prediction using the regression equation (Y=βX + α) Syntax Programming: REGRESSION /MISSING LISTWISE /STATISTICS COEFF OUTS R ANOVA /CRITERIA=PIN(.05) POUT(.10) /NOORIGIN /DEPENDENT happiness /METHOD=ENTER age male income degree married childs helath_new sociability.

17 Exporting Outputs To export outputs, go to File > Export Specify the type of output you want to export from the File Type drop- down menu. You can export the outputs in Html, Text, Excel, Word, PDF, or PowerPoint format. Specify your file destination and name in the File Name box. Then click OK.

18 Helpful Resources Quicktime SPSS classes and SPSS handouts on the CSSCR website:  http://julius.csscr.washington.edu/software.htm http://julius.csscr.washington.edu/software.htm Many other resources online to help you learn SPSS (tutorials, blogs, etc.). Some examples: http://www.stat.tamu.edu/spss.php http://www.ats.ucla.edu/stat/SPSS/ http://www.lrz.de/~wlm/wlmspss.htm CSSCR offers classes on SPSS every quarter or call us to schedule an appointment with one of the CSSCR consultants!


Download ppt "CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH (CSSCR) UNIVERSITY OF WASHINGTON SPRING 2013 CONSULTANT: SHIN HAENG LEE Introduction to SPSS."

Similar presentations


Ads by Google