1 1 Lecture 1 Introduction to SPSS 2 What is SPSS ? S tatistical Package for the Social Sciences (SPSS) ? SPSS has been the most commo n ly used program for quantitative data analysis in the so cial scien ces. ? It provides a powerf ul statistical analysis and data management system. 2 3 What is SPSS ? SPSS can take data fro m almost any typ e of file and use them to generate tabulated report s, chart s , a n d plots of distrib u tions and trends, descriptive statistics, and complex statistical analysis. ? SPSS make s sta t istical a nalysis convenient for the experienced user and approachable for the beginner. 4 Using SPSS ? G etting Started with SPSS ? O pen a Data File ? SPSS Windows ? B asic Data File Structure ? S ourc e s and Organization of Data ? C reating and Editing a Data File 3 5 Using SPSS ? D efine Data ? I nsert and select Case/Variable ? I mport Data ? D ata Analysis ? D ata Process and Trans formation 6 Getting Started with SPSS 4 7 After starting Windows, double clicking on the SPSS icon . Or From the Start menu choose: Programs > SPSS for Windows > SPSS for Windows. 8 When “SPSS 11.0 for windows” is first entered the display will be similar to Figure 1 below 5 9 ? SPSS is a Windows package. The Data Editor displays the contents of the w orking data file. Each window has its own toolbar. When you put the mouse c ursor on a tool, a brief description of the tool pops up. 10 Main Menu ? SPSS for Windows is menu driven. Most of the features are accessed by selections from the menus. The main menu bar contains 10 menus are similar to other Windows applications, e.g. Microsoft Excel. 6 11 To define Toolbars, t o change Fonts, Grid Lines, Value Lab e ls. View To m odify or copy text from the output or syntax windows. Edit To create a new SPS S file ; ope n an existing file; or read in spreadsheet or database files created by other software program . File 12 To m a ke changes t o sel ected variables in the data file and to com pute new variables ba sed on the val u es of existing ones. These changes do not affe ct the perm anent file unless you explic itly save the changes. Transform To m a ke global change s to SPSS data files, such as m e rging files, transposing variables and cases, or creating subsets of cases for analysis. Data 7 13 To create t h e various graphs, such as bar charts, pie charts, hist ogram s, scatterplots. A ll graphs can be customized with the Chart Editor. Graphs To select the various statistical procedures you want t o use, suc h as crosstabs, analysis of variance, correlation, and linear regression. Analy z e 14 Help window contai ning inform ation on how to use the m a ny features of SPSS. Context- sen s itiv e h e lp is also available through the dialog boxes. Help To switch between SPSS windows or to m i nim i ze all open SPSS windows. Window Display inform ation on the contents of SPSS data files, define Vari able Sets, Run Script. Utilities 8 15 Open a data file 16 Open a data file ? From the Menus, Choose File Open Data ? Alter n ati v el y, you can use t h e Open File butt o n on t h e tool bar. The Open File dialog box will appears. ? By d e fa ult, SPSS-for mat data files (.sav extension) are displayed. You can di splay other file for m ats using t h e Files of Type drop- d o w n list. Se lec t a d a ta file a n d c l ic k O p e n . The data file will disp la y in th e D a ta Ed ito r 9 17 SPSS Window 18 The Data Editor Window 10 19 The Data Editor provide s a convenient, spreadshe e t-like m e thod for creating and edit ing data files. When you start a session, the Data Edit or window opens autom a tically. The Data Editor provides two views of your data: Data view - Displays t h e actual dat a values or define value labels. Variable view - Displays variable defini tion inform ation, includi ng de fined varia b le and val u e labels, data type (for exam ple, string, date, and nu meric), meas urement scal e (nom inal, ordinal, or scale), and user-defined missing values. In both views, you can add, change, and delete inform ation contained in the da ta file. 20 Output Window ? The Viewer window displays the tables, statistics, and char ts. T h e Viewer opens automatically the first time you run a command t h at pr oduces out put . 11 2122 Basic Data File Structure 12 23 The Data Editor reflects the basic data file structure.Each r o w repres ents a case or an obs e rvations , each row corresponds to a un it t o be anal yzed. 24 Each col u mn repr esents a vari abl e or characteristic bei n g measured. E ach cell cont ains a singl e value of a vari able for a case. 13 25 ? You can enter and edit data in the Data Editor and use many different data types, i.e. Numeric, String (alphanumeric), Date, Dollar (currency). However, you can ’ t enter formulas or perform calculations in the Data Editor. Please use the Transform menu to calculate new values and variables and recode data. 26 Sourc e s and Organization of Data 14 27 A sample survey of in c o m e . A n d th e questionnair e s h own bel o w: 28 Suppose we have a data set. There are 10 sample rows of the data below: 15 29 Design a Coding Scheme A codi ng scheme i s a way t o ass o ciate a parti c ul ar dat a code with a questionnaire response. The codes are what you enter into a data file. Codi ng s chemes are arbi trary. F o r example, for nomi nal va riables, either coding way is acceptable for SPSS. 30 ? In questi on 4 (i .e. Sex) i n s a mple questionnai re, you can defi ne the “ Sex ” as two strings value (i.e. f=female, m=male). ? In questi on 3 (i .e. Income per month) in sample questionnaire, you can define the “ In co me ” as four numeric va lue (i.e. 1=below $8000, 2=$8000-$150 00, 3=$15001-25000, 4=above $25001) ? In questi on 2 (i .e. Edu cation Level) in sample questionnaire, you can define the “ Educati on ” as four numeric valu e (i.e. 1=Diploma, 2=Bachelor, 3=Master, 4=Others) 16 31 Creating and Editing a Data File 32 Entering Data 1. S e lec t a c e ll and enter the number . The data value appears in the cell and in the cell editor.2. Press Enter to record the value. If you haven't named the variable, The Data Editor assigns a unique variable name. 17 33 Entering Data 1. To enter non-numeric data, you need to define the variable.2. Doubl e-click on the var i able name at t h e top of the column. Or click the Variable View tab. The Variable View appears as bel o w. 34 3. Click the Type cell in the row for the variable, and then click the button in the cell. 18 35 4. Select the data type in the Define "Variable Type" dialog box. For example, to enter data values that contain letters, select String.5. Then click OK . 36 Define Data 19 37 In addition to defining data type, you can also define descriptive variable and value labels for data values. 38 A. Variable Names The following rules apply to valid Variable Names:? T he name must begin with a letter. ? V ariable names cannot end with a period ? T he length of the name cannot exceed eight characters. ? V ariable names must be unique; duplication is not allowed. ? B lank & Special characters cannot be used. 20 39 B. Variable Label To define a variable label , click the Label cell in the row for the variable and then enter thedescriptive label. Give more detail description but not over 120 charac ters. These labels are used in statistical reports and charts. 40 F o r ex ample: ? Q uestion 1 - Y ou can type "Age" in the Label cell in the row 1. ? Q uestion 2 - Y ou can type "Education" in the Label cell in the row 2. ? Q uestion 3 - Y ou can type "Income per month" in the Label cell in the row 3. ? Q uestion 4 - Y ou can type "Gender" in the Label cell in the row 4. 21 41 C. Values Label 1. To define a values label, click the Values cell in the row for the variable, and then click button in the cell. 42 2. When the "Value Labels" dialog box appears, enter the data value and the descriptive label. 22 43 3. For example, In question 2 in sample questionnaire, you can define the "Education" as four numeric values.1=Diploma 2=Bachelor 's degree 3=Master's degree 4=Others 4. Click on Add to record the value label for the each data value, and then click on OK when you are finished. 44 D. Missing Value In SPSS, there are two types of missing values: System-missing values and User-missing values. ? S ystem-missing values Any blank numeric cells are assigned the system- missing value, which is indicated with a period(.). ? U ser-missing values. You can assign values that identify information missing for specific reasons and then instruct SPSS to flag these valu es as missing. 23 45 To De fine Miss ing Values for a Variable 1. Make the Data Editor the active window.2. If the Data view is displayed, double-click the variable name at th e top of the column in the Data view or click the Variable View tab. 46 3. Click the button in the "M issing" cell for the v a riable, which you want to define.4. When the "Missing Values" dialog box appears, select "Discrete missing values" a nd enter the values that represent m i ssing data. (or se lect the "Range pl us one opt i onal discrete m i ssi ng valu e" and en ter the range of values that represent missing data.) 24 47 Insert and select Case/Variable 48 A. To Insert a New case between Existing Cases 1. Select any cell in the case (row) below the position where you want to insert the new case.2. From the menus bar choose Data > Insert Case. 25 49 B. To Insert a New Variables 1. Select any cell in the variable (column) to the right of the position where you want to insert the new variable.2. From the menus bar choo se Data > Insert Variable. 50 C. Select the cases ? Y ou ca n rest rict your a n alysis t o spe c ific group (e.g. only female, only Master's degree, etc..) 26 51 1. From the menus choose Data > Select Case. The "Select Case" dialog box as shown below. 52 2. Check the "If condition is satisfied" ratio button and click on "If .." button. The "Select Cases If" dialog as shown below. 3. In this sample, enter the conditional expression (over 25 year old). Select "Age[age]" and click on button. 27 53 4. For example, type '> 25'.You can use the calculator pad, variable list, and function list to paste these elements into the expression. 5. Click "Continue" button. 54 If you have selected a case but have not discarded unselected cases, unselected cases are marked in the Data Editor with a diagonal line through the row number. 28 55 Import Data 56 Assume you have Excel file as like as below 29 57 To Convert Excel file:? 1 . From the menu, choose File > Open > Data, then the 'File Open' dialog box appears. ? 2 . Choo se Exce l from 'files of type'. An d then select the drive and the directory in which your Excel file is located. 58 3. The 'Opening File Options' dialog box appears, check 'Read variable names' and type "A1:E11" in the Range. 30 59 5. After the data are converted, it will appear in a spreadsheet-link windows titled untitled. Check all cases a nd variable s ha ve been read into the data set. 4. Click OK button. And then minimize the Output1 window. 60 Now, you can define data? I n the "Variable Type" dial og box, set the appropriat e format, number of decimal places, column width, and alignment. ? I n the Labels cel l , type in a descri p tive label for the variabl e. e.g. type in Eudcation Level for the educ variable. And also, you can define the "Educat ion Level" as four numer ic values. 1=Diploma 2 = Bach elor's deg re e 3 = Ma ste r ' s d egree 4 = Oth e rs ? 7 . Click on the Data View wor k sheet to check the data set. ? 8 . From t h e menu, choose F ile > Save. Mar k sure you have select SPSS for your file type (SPSS system file), the SAV extension added to your filename (e.g. MYDATA.SAV). ? N ow, if you quit SPSS program, you can reopen i t without having to read in the Excel spreadsheet and define the variabl e. 31 61 Data Analysis 62 ? T he Ana l yze me nu conta i ns stati s tical analysis categories and a list of general reporting. Most of the categories are followed by an arrow. There are several analysis procedures available within the category. When the category is picked, they will appear on a submenu. 32 6364 ? I n statist i cal analysi s, yo u must d i stinguish between two types of variables: continuous and discreet. The continuous variables can take any real number value, including fractional values, e.g. age and income. The discreet variables can only take one of se ver a l integer value s . These are used to represent the categorical information: e.g. education level. 33 65 A. Summary information about continuous Variables 1. From the menu, choose Analyze > Descriptive Statistics > Descriptives..., the dialog box appears as shown below. 66 ? 2 . Select a variable (e.g., select 'Age' and 'Income' variables.) and then click on button. ? 3 . Click on the Options button, you can select the following options: Mean, Std deviation, Minimum, Maximum, etc...) in the resulting dialog box. ? 4 . Click on the Continue button to close the dialog box. 34 67 5. In the "Descriptives " dialog box, click on the OK button. The Output window appears as shown the results below. 68 B. Summary information about Discrete Variables ? T he mo st popular of u s ing SPSS is creating frequency table. The frequencies procedure produces frequency table, measures of central tendency and dispersion, bar charts and histograms. you can sort frequency tables by count or by value. In this example, you can also use this to generate a graphic summary of continuous variables. 35 69 1. From the menu, choose Analyze > Descriptive Statistics > Frequencies..., the dialog box appears as shown below. 70 ? 2 . Select a variable (e.g., select 'educ' variables.) and then click on button. ? 3 . Click on the Statistics button. ? 4 . In the "Frequencies: Statistics" dialog box, choose Median and Mode in the Central tendency group, and choose Minimum and Maximum in the Dispersion group. Click on the Continue button. 36 71 5. Click on the Charts button. In the "Frequencies: Charts" dialog box, choose Histogra m. 6. Click on the Continue button. 72 7. When you return to the "Frequencies" dialog box, click on the OK button. Results are displayed in the viewer window. You can go to any item in the Viewe r qui ckl y si mply b y selecting it in the outline pane. 37 73 Data Process and Transformation 74 Computing Values ? F or example, create a Variable named Bonus and base on 15% of the income. 38 75 1. To compute values for a variable based on numeric transformations of other variables, from the menus choose Transform > Compute. The Compute dialog box appears as below. 76 2. In the Compute dialog box, give "Target variable" (like you define variable), you can type "Bonus" into the Target Variable. And also you can click on the "Type & Label" button, give more description for the "Target Variable". 39 77 3. Select the data type (this is required for new st ring varia b les). A nd then Click on Continue button. 4. When return to the "Compute Variable" dialog box, select and then click on button. 5. Type '* .15' in the "Numeric Expression" box. 6. Click OK button. 78 We will also look at details afterwards on many other functions and tools in SPSS when having this course