basics of spss, part 1
DESCRIPTION
Getting started with SPSS, defining variables, entering data and importing data from ExcelTRANSCRIPT
Part 1: Getting started entering data and defining variables
Dr.
Ch
rist
ine
Pere
ira
1
Dr.
Ch
rist
ine
Pere
ira
» Purpose and use of SPSS
» Open SPSS
» What is a Variable?
» Defining variables in SPSS
» Entering Data
» Open and save data files
» Import data from Excel
» Handling missing data
ASK at Brunel (2014) 2
Dr.
Ch
rist
ine
Pere
ira
» SPSS is a Statistical Software Package
» SPSS is a tool
It only does what it’s ‘told’ to do.
It does not think for you
It is not a black box
» You need to know the correct statistics for your research BEFORE using SPSS.
» If you understand the statistics, then you are ready to do analysis in SPSS.
ASK at Brunel (2014) 3
Click on the Windows Start Icon
Type SPSS 20 into the search box
Select SPSS 20 from the list
1
2
3
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 4
Open NEW data file
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 5
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 6
Enter variable names in the first column of Variable View.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 7
Enter the data for each variable.
Each variable name will appear as a column heading replacing var.
What is a variable? How do we define variables in SPSS?
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 10
Dr.
Ch
rist
ine
Pere
ira
» A measurement:
A characteristic + E.g., Gender, Age, Height, Weight…
Time points + E.g., pre-test, post-test, T0, T1, T2…
Experimental Condition + E.g., Condition, Experimental group…
Opinion/belief + E.g., A survey question which asks for a respondent’s level of
agreement with a statement
Etc…
ASK at Brunel (2014) 11
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 12
What is your gender?
Male or Female
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 13
How long does it take, on average, to commute into Uni?
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 14
What is your main mode of transport to Uni?
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 15
Indicate your level of agreement with this statement:
“Most days, my commute causes me to feel stressed when I arrive at university”.
Dr.
Ch
rist
ine
Pere
ira
» Random sample of 200 residents of Uxbridge.
» Asked respondents’ their view on stem cell research using a 3 pt. Likert Scale (Disagree, No Opinion, Agree).
» Asked respondents’ if they believed global warming was an important issue using a 5 pt. Likert Scale (Strongly Disagree to Strongly Agree).
ASK at Brunel (2014) 16
Questionnaire Responses
Dr.
Ch
rist
ine
Pere
ira
» Random sample of 200 residents of Uxbridge.
» Asked respondents’ their view on stem cell research using a 3 pt. Likert Scale (Disagree, No Opinion, Agree).
» Asked respondents’ if they believed global warming was an important issue using a 5 pt. Likert Scale (Strongly Disagree to Strongly Agree).
ASK at Brunel (2014) 17
Questionnaire Responses
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 18
Resident StemCell GlobalWarming
1 Agree Strongly Agree
2 Undecided Agree
3 Undecided Strongly Disagree
4 Disagree Undecided
… … …
Questionnaire Responses
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 19
Experimental Condition Cond 1 and 2 are independent,
NOT repeated measures.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 20
Score on a test
Dr.
Ch
rist
ine
Pere
ira
» 30 participants were used to investigate the effect of caffeine on their ability to sleep.
» The 30 participants were randomly assigned to one of 2 conditions: No caffeine (control) or one dose of caffeine every 3 hours from 9am-6pm.
» The study measured participants ability to sleep by taking the average number of hours slept per night over a 2 week period.
ASK at Brunel (2014) 21
Caffeine and Sleep
Dr.
Ch
rist
ine
Pere
ira
» 30 participants were used to investigate the effect of caffeine on their ability to sleep.
» The 30 participants were randomly assigned to one of 2 conditions: No caffeine (control) or one dose of caffeine every 3 hours from 9am-6pm.
» The study measured participants ability to sleep by taking the average number of hours slept per night over a 2 week period.
ASK at Brunel (2014) 22
Caffeine and Sleep
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 23
Participant Condition AvgHoursSlept
1 Control 7.2
2 Caffeine 6.7
3 Caffeine 6.3
4 Control 6.9
… … …
Caffeine and Sleep
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 24
Status when admitted to care facility
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 25
Anxiety level measured at 3 time points for each participant
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 26
Why not enter TIME as 1 variable like we
did for STATUS?
Dr.
Ch
rist
ine
Pere
ira
» 50 participants of varying fitness levels were used to investigate whether personal trainers make a significant difference in ones fitness.
» Participants were randomly assigned to one of two training groups: self training or professional trainer.
» Each participants 1 mile time (in mins) was recorded 2 days prior to the start of the study.
» Each group then followed a specific training regime for 30 days and their 1 mile time (in mins) recorded again.
ASK at Brunel (2014) 27
Fitness Regime
» 50 participants of varying fitness levels were used to investigate whether personal trainers make a significant difference in ones fitness.
» Participants were randomly assigned to one of two training groups: self training or professional trainer.
» Each participants 1 mile time (in mins) was recorded 2 days prior to the start of the study.
» Each group then followed a specific training regime for 30 days and their 1 mile time (in mins) recorded again.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 28
Fitness Regime
Pre-test and Post-test
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 30
Fitness Regime
Participant Training Pre_Mile Post_Mile
1 Self 15.3 14.1
2 Professional 16.1 14.9
3 Self 20.5 16.8
4 Self 16.8 16.2
… … … …
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 31
Variables
Categorical Qualitative
Scale Quantitative
Nominal
(Unranked categories)
Marital Status
Political Party Eye Color
Ordinal
(Ranked categories)
Satisfaction level
Level of agreement
Not grouped Height
Weight
Age
No. of cars
No. of students
• In SPSS, data is either Nominal, Ordinal or Scale. • It is essential to classify data correctly.
- Incorrect classification… may result in incorrect analyses.
Code categorical variables
Enter data
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 32
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 33
Level of Measurement?
Categorical variables need to be coded Scale variables do not need to be coded
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 34
Level of Measurement?
0 = Male 1 = Female
1
0
1
1
1
1
0
0
0
0
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 35
Level of Measurement?
Scale, does not need to be coded
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 36
1 = tfl (i.e. public transport) 2 = Car 3 = Cycle 4 = Walk
1
2
3
4
2
1
1
1
1
1
Level of Measurement?
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 37
Indicate your level of agreement with the following statement:
“Most days, my commute causes me
to feel stressed when I arrive at university”.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 38
1 = Strongly Disagree 2 = Disagree 3 = I don’t know 4 = Agree 5 = Strongly Agree
Level of Measurement?
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 39
Data has been coded Now we’re ready to enter it in SPSS
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 40
1. Enter & define variables from Variable View.
• Variable names • Must begin with a letter • No spaces and no special characters (except _ )
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 41
1. Enter & define variables from Variable View.
• Type • Should (almost) always be numeric • SPSS cannot analyse non-numeric data
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 42
1. Enter & define variables from Variable View.
• Decimals • How many decimal places do you want to see in the Data View?
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 43
1. Enter & define variables from Variable View.
• Label • IMPORTANT!!! Make good labels! • Short description of the variable • This is what will be written on all graphs & tables
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 44
1. Enter & define variables from Variable View.
• Values (i.e., Value labels) • IMPORTANT!!! - Tell SPSS what all the codes represent! • This is what is written on all graphs & tables
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 45
1. Enter & define variables from Variable View.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 46
1. Enter & define variables from Variable View.
• Missing • Missing data can be coded too • Chose a number not in the data, like 99 or 999 • Replace all missing values in your data with this code first
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 47
1. Enter & define variables from Variable View.
• Measure • Level of Measurement (Nominal, Ordinal, Scale) • By default ALL new variables are unknown • YOU must choose the appropriate measure
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 48
2. Enter data from Data View.
• Variable names • Will become column headings in Data View.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 49
Now, let’s enter some data
Saving and Opening Data or Output Files
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 50
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 51
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 52
Locate a folder to save it in:
On your H drive OR On your pen drive
Name it appropriately Extension .sav
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 53
Everything done in SPSS is shown here,
in outline form.
Shows output for ALL analysis run in SPSS Keeps a log of all activity of open data files Saved with the extension .spv
A data file was saved as SPSS Workshop Example.sav and logged in the output file.
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 54
New data file
New output file
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 55
Existing data file
Existing output file
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 56
Importing data from Excel
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 57
Click here
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 58
Click here
Save this file to your H: drive
or pen drive
Dr.
Ch
rist
ine
Pere
ira
» Log onto Blackboard
» Go to the Organisation Academic Skills
» In the left column, under Workshop Presentations
Click on Statistics and SPSS
» Find the SPSS Workshop
Download the Excel File: “CommutingSurvey.xlsx”
» Save this file somewhere you can find it later.
» Do not open it. You cannot import the file if it’s open.
ASK at Brunel (2014) 59
Dr.
Ch
rist
ine
Pere
ira
» Can be .xls OR .xlsx
» Variable names CAN be imported too
Must be in row 1 of the worksheet
They will be imported to the Variable View
» Data will appear in SPSS Data View
ASK at Brunel (2014) 60
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 61
Variable names (Row 1)
Filename
(.xlsx)
This sheet contains the dataset
ASK at Brunel (2014) 62
Existing data file
Dr.
Ch
rist
ine
Pere
ira
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 63
Choose Excel file type to see your .xlsx
Find the folder where you
saved the file Select the Excel file
3
1
2
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 64
Choose the correct
worksheet
View all data Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 65
Variable Names
(from Row 1)
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 66
This variable name from Excel could not be used. SPSS made it a label and
created a new variable name
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 67
How to handle missing data
Dr.
Ch
rist
ine
Pere
ira
» Any blank (i.e., missing) data is automatically considered missing by SPSS.
It will not be included in the analysis.
This means you DO NOT have to code missing data
» Why code missing values if you don’t have to?
Sometimes data accidently gets deleted. If missing values are coded then you know a blank space shouldn’t be there.
There is more than one reason data is missing and you want to distinguish between them.
+ E.g., A participant chose not to answer a survey question or question was not applicable to them – you may want to record these as different kinds of missing data.
ASK at Brunel (2014) 68
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 69
There are 3 missing values for
TravelTimemin
• Replace missing values with a code • Use a code that will not occur for the variable • Let’s use -1, as negative time is not possible
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 70
1
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 71
3
Select the variable you
want to recode
Click here to recode the
variable
2
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 72
4
Enter the code as the new value
Click Add. MISSING -> -1
will appear here
5
6
Click Continue then Click OK
7
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 73
Missing values have been
replaced with -1 for TravelTimemin
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 74
Remember… From Variable View
Define the missing values 8
• Discrete (whole numbers) • Enter missing value codes used for the variable (e.g., -1) • Click OK
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 75
This is only a code – it tells SPSS what value(s) represent missing values. It does not replace missing values with the code for you!
Dr.
Ch
rist
ine
Pere
ira
» Variables go in columns
» Categorical data should be coded first
» If you import data from Excel, make sure to:
Put variable names in the first row
Code your categorical data first, then import codes
» If you choose to code missing data:
First, replace all missing values with the code
Second, define the missing value code in the Variable View
ASK at Brunel (2014) 76
Dr.
Ch
rist
ine
Pere
ira
» SPSS Survival Manual, 4th Edition (2010) by Julie Pallant.
» SPSS Survival Manual, 5th Edition (2013) by Julie Pallant.
» Discovering Statistics Using SPSS, 3rd Edition (2009) by Andy Field.
» Discovering Statistics Using SPSS, 4th Edition (2013) by Andy Field.
ASK at Brunel (2014) 77
Dr.
Ch
rist
ine
Pere
ira
ASK at Brunel (2014) 78