250 likes | 432 Views
Introduction to SPSS (and tips and tricks). CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH ( CSSCR) UNIVERSITY OF WASHINGTON Fall Quarter, 2012 Prepared by Eric Hamilton. Topics Covered in this Introductory Course. -SPSS basic structure & layout -Importing data
E N D
Introduction to SPSS(and tips and tricks) CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH (CSSCR) UNIVERSITY OF WASHINGTON Fall Quarter, 2012 Prepared by Eric Hamilton
Topics Covered in this Introductory Course -SPSS basic structure & layout -Importing data -GUI vs. Syntax use -Managing and recoding your data -Descriptive statistics & intro analysis– frequencies, explore, crosstabs, correlations -Tips and tricks for data management and analysis -Resources for learning more about SPSS
SPSS at a glance SPSS (Statistical Package for the Social Sciences) offers a user-friendly data analysis platform. Go to START, PROGRAMS, and click on the SPSS version of your choice or The computers in the CSSCR labs typically have SPSS on the desktop. Double click on the icon of the version that you want to use.
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. Note: Perform separate save procedures for the data editor (.sav), output viewer (.spv), and syntax editor (.sps) windows. Remember to save your work frequently, under names that will have meaning for you in the future.
The Editor Window:Data view vs. Variable view Data view Rows are cases (participants in the study) Columns are variables You can toggle between data values and labels Variable view Rows define the variable characteristics: Name, Type, Width, Decimals, Label, Values, Missing, Columns, Align, Measure. The Measure of variables in the dataset is important: • Scale = “continuous” – e.g., age, weight, income • Ordinal = “ordered” – categories that can be ranked (e.g., level of satisfaction or agreement, Likert-type scales) • Nominal = “names” – categories that cannot be ranked (e.g., ID number)
Importing a data file -You can work with the Wizard, or click Cancel, and -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 data set represents variable names (Yes), click OK -Check to see that the data appear as in your original data set *For the examples covered in this presentation, select “Files of type: Excel”, then open “CSSCR_Aut12_SPSSintro.xls”
Gui vs. syntax The GUI (graphical user-interface, “gooey”) allows you to interact with SPSS via images and buttons, rather than text. You can “draw-down” commands from menus at the top of the window. The Syntax window executes commands that you enter as text. Open a syntax window (File > Open > Syntax), and type or paste text to call functions. Select specific sections of text and click “Run Selection” to execute commands.
selecting cases With the select cases command, you can select subsets of cases for analysis DATA> SELECT CASES > IF CONDITION IS SATISFIED -select the variable of interst -enter the logical command to select the cases you want to analyze e.g., “Select Cases IF Grade = 12”
Compute Variable Example: create a new, transformed variable from an already existing variable -click Transform > Compute Variable -Assign the new “Target Variable” (this will be attached at the end of the variables list) Let’s call it: TestScore_Ex -fill in the numeric expression: TestScore = SQRT(TestScore) To compute, for example, only the 12th grade scores, you can create an If-Then statement by clicking on the IF button -click INCLUDE IF CASE SATISFIES CONDITION, and enter (e.g.) Grade = 12, then click OK
Compute Variable (Contin.) -if you need to find how to write the function, there is a list of functions on the right This procedure will create a new variable at the end of the variable list that is the means of the variables that you chose to include in the computation. -again, you can select a subset of cases by by clicking on the IF button
Recoding variables Recoding allows a researcher to create a new variable with, for example, a different set of parameters -Decide which Variable(s) you want to recode TRANSFORM> RECODE INTO DIFFERENT VARIABLE -move variable of interest to the right-create a name for the new variable-click Old and New Values
Recoding variables (contin.) -Select and enter the appropriate data recode modifications: -Enter an already existing Old Value, then enter its New Value, and click Add(note: these must be typed exactly as they appear in the data view. Copy/paste is ok.) -Alternatively, click RANGE to create ranges of old values -If you’ve recoded all the values you want changed, click on “Copy old value(s)” -Click OK and check that your new values were created correctly.
The Variable View:editing Value Labels After recoding your variables, you may want to record the values assigned to each category of the variables. You can note in SPSS what your numeric values stand for in the “Value Labels” area. -Select the Values drop-down,and record the values and labels for your range of new data. -If you forget how you recoded your data, your labels should be available in your output (.spo) file.
The Variable View:Accounting for missing data Many data sets have a few, or a lot, of missing data points. SPSS lets you account for missing data in two ways: system-missing (indicated by one period in the data cell); and user-defined (specified by you, User). Click on a variable’s “missing” drop-down, and enter the specific, discrete values (998, 999, etc.) that will represent missing data in your data set. A range can also be used if, for example, you only want to use half of a scale. Also, system-missing data is assigned by SPSS when a function cannot be performed. (e.g., dividing a number by zero)
Descriptive Statistics: Frequencies -Select desired statistical output (Central Tendency, Dispersion, etc.) from the Statistics button. -Select the type of chart you’d like SPSS to produce (e.g., Histogram) with the Charts button. -Click OK, or Paste (then Run), and review the output. -Lets say we want output on the number of cases (the frequencies) subjected to each type of curriculum in the example dataset. Click ANALYZE > DESCRIPTIVE STATISTICS > FREQUENCIES -Choose Curriculum from the list.
Descriptive Statistics: Explore You can also generate a variety of descriptive statistics on multiple variables at once. SPSS can produce a lot of useful statistical output with the Explore command. Click ANALYZE > DESCRIPTIVE STATISTICS > EXPLORE -Decide which relationships, independent variables (Factors) to outcomes (Dependent), you’d like SPSS to produce, and move them over with the arrows -Click Statistics/Plots/Options to choose which statistics and forms of output you are interested in producing, then click OK or Paste to Syntax. -Review your output.
Descriptive Statistics: Crosstabs To look at frequencies of data nested across multiple variables (and run a Chi-Square test): ANALYZE> DESCRIPTIVE STATISTICS > CROSSTABS -Move the variables of interest over with the arrows -Select the options you would like to apply to the Crosstabs output (Statistics, etc.) -Click OK (or PASTE to syntax)
Correlation Analysis This measures the dependence between two variables, by the Pearson product-moment correlation coefficient, or "Pearson's correlation” -ANALYZE > CORRELATE > BIVARIATE -Move the variables of interest over with the arrow -Select the options you would like to apply to the correlation analysis (Statistics, etc.) -Select Two-tailed significance test, if the direction of the relationship between your variables is unknown -Click OK (or PASTE to syntax)
Saving your work After all the data cleaning and various forms of analyses you’ve run, you want to be sure to save all of your work, in an organized fashion (and regularly)! -Give your data files names that are sufficiently descriptive of what you are working on, and that you will recognize when you come back to the data at some time in the future. -Backup your data (save in multiple locations: memory sticks, computers, ext. hard drives, etc.), in case one source should become lost or corrupted.
Saving your work (contin.) Remember that each file format (.sav, .spv, .sps) should be saved as a uniquely-identified element of your data cleaning/analyses. It may be useful, during the process of data cleaning and analyzing, to save your work with ascending file names. for example: School1_datacleaning_A1.sav School1_datacleaning_A2.sav … School1_datacleaning_B1.sav This way, you can delete older, unneeded files, and you have a backup if something goes wrong (the program stalls, earthquake, etc.).
Tips and tricksFOR using spss • Keep Variable Names short. Use Labels as a more detailed description of your data • Toggle between data values and labels: • Double-click margins to move between Data and Variable Views • Right-click in drawdown menus (e.g., transform operations) to toggle between values/labels • Moving variables within the list in Variable View • “clearing the cursor” • Click-and-hold, move right to move a new variable to the top of the file • Utilities option: Data File Comments tool (very useful!). This function auto-dates your entries, and remains in files saved from previous files • Other ideas?
Helpful Resources CSSCR has a Quicktime SPSS class and SPSS handouts on the CSSCR website. There are many resources online to help you learn SPSS (tutorials, blogs, etc.). Here are a few 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 frequently– come back for an Intermediate SPSS class or call us to schedule an appointment with one of the CSSCR consultants!
What we have covered: -SPSS basic structure & layout -GUI vs. syntax use -Importing data -Managing and recoding your data -Descriptive statistics – frequencies, explore, crosstabs, correlations -Tips and tricks for data management and analysis -Resources for learning more about SPSS
Introduction to SPSS(and tips and tricks) Thanks! CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH (CSSCR) UNIVERSITY OF WASHINGTON Fall Quarter, 2012 Prepared by Eric Hamilton