Basics of SPSS, Part 1

Page 1

+

Basics of SPSS: Part 1

ASK Week – Autumn 2012


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


PURPOSE & USE OF SPSS  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.


3

Select SPSS 18 from the list

2

Type SPSS 18 into the search box

1

Click on the Windows Start Icon


Open NEW data file

Always open SPSS first, then open or type in data.


DEFINE VARIABLES

Enter variable names in the first column. We will look at all the columns in more detail shortly.


ENTER DATA

Each variable name will appear as a column heading replacing var.

Enter the data for each variable from the Data View. We will also look at entering data in more detail shortly.


W H AT HOW

I S A VA R I A B L E ?

D O W E D E F I N E VA R I A B L E S I N S P S S ?


WHAT IS A VARIABLE? 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 grp…)

 Opinion/belief (e.g., A survey question which asks for a respondent’s level of agreement with a statement)

 Etc…


Variables go in Columns

What is your gender?

Male or Female


Variables go in Columns

How long does it take, on average, to commute into Uni?


Variables go in Columns

What is your main mode of transport to Uni?


Variables go in Columns

Indicate your level of agreement with the following statement: “Most days, my commute causes me to feel stressed when I arrive at university�.


IDENTIFYING VARIABLES Questionnaire Responses  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).


IDENTIFYING VARIABLES Questionnaire Responses Resident

StemCell

GlobalWarming

1

Agree

Strongly Agree

2

Undecided

Agree

3

Undecided

Strongly Disagree

4

Disagree

Undecided


Variables go in Columns

Experimental Condition Cond 1 and 2 are independent, NOT repeated measures.

Score on a test


IDENTIFYING VARIABLES CAFFEINE AND SLEEP  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.


IDENTIFYING VARIABLES Caffeine and Sleep Participant

Condition

AvgHoursSlept

1

Control

7.2

2

Caffeine

6.7

3

Caffeine

6.3

4

Control

6.9


Variables go in Columns

Status at entrance to care facility


Variables go in Columns

Anxiety level measured at 3 time points for each participant


Variables go in Columns

Why not enter like we did for

?


IDENTIFYING VARIABLES 

  

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.

Identify the variables for this problem


LEVELS OF MEASUREMENT Variables

Categorical

Scale

Qualitative

Quantitative

Nominal

Ordinal

(Unranked categories)

(Ranked categories)

  

Marital Status Political Party Eye Color

 

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.


CODING

C AT E G O R I C A L VA R I A B L E S

OPEN SPSS E N T E R D ATA S AV E F I L E S


Coding Categorical Variables

Level of Measurement?

Categorical variables need to be coded Scale variables do not need to be coded


Coding Categorical Variables

0 0 1 0 1 1 0 1 0 1

Level of Measurement?

0 = Male 1 = Female


Coding Categorical Variables

Level of Measurement?

Scale, does not need to be coded


Coding Categorical Variables

1

Level of Measurement?

1 2 1 1 1 3 4 1 2

1 = tfl (i.e. public transport) 2 = Car 3 = Cycle 4 = Walk


Coding Categorical Variables

Indicate your level of agreement with the following statement: “Most days, my commute causes me to feel stressed when I arrive at university�.


Coding Categorical Variables

3

Level of Measurement?

2 4 5 5 4 2 1 3 2

1 = Strongly Disagree 2 = Disagree 3 = I don’t know 4 = Agree 5 = Strongly Agree


Coding Categorical Variables

Data has been coded Now we’re ready to enter it in SPSS


Entering Data 1. Enter & define variables from Variable View.

• Variable names • Must begin with a letter • No spaces and no special characters (except _ )


Entering Data 1. Enter & define variables from Variable View.

• Type • Should (almost) always be numeric • SPSS cannot analyse non-numeric data


Entering Data 1. Enter & define variables from Variable View.

• Decimals • How many decimal places do you want to see in the Data View?


Entering Data 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


Entering Data 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


Entering Data 1. Enter & define variables from Variable View.


Entering Data 1. Enter & define variables from Variable View.

• Missing • We will come back to this one shortly.


Entering Data 1. Enter & define variables from Variable View.

• Measure • Level of Measurement (Nominal, Ordinal, Scale) • By default ALL new variables are scale • YOU must choose the appropriate measure


Entering Data 2. Enter data from Data View.

• Variable names • Will become column headings in Data View.


Entering Data 2. Enter data from Data View.

• Rows • Subject entries • For example, participant responses to survey questions. Row 1 is participant 1, etc…


Entering Data

Now, let’s enter some data


SAVING YOUR SPSS FILES


SAVING YOUR SPSS FILES Locate a folder to save it in:  On your H drive OR  On your pen drive

 Name it appropriately  Extension .sav


OUTPUT FILE  Shows output for ALL analysis run in SPSS  Keeps a log of all activity of open data files  Saved with the extension .spv

Everything done in SPSS is shown here, in outline form.

A data file was saved as SPSS_Part1_Ex7.sav. This was recorded in the log here.


CREATING A NEW SPSS FILE New data file New output file


OPEN AN EXISTING SPSS FILE Existing data file Existing output file ALWAYS open SPSS first! If you try opening a data file from a folder, SPSS will NOT work


…FROM EXCEL


THE EXCEL FILE…  Log onto Blackboard.  Go to the ASK section.  “Workshop slides”  “Statistics and SPSS Workshops”  Download the Excel File: “CommutingSurvey.xlsx”


FOR EXAMPLE.

IMPORTING DATA FROM EXCEL.

Filename (.xlsx)

Variable names (Row 1)

Sheet1 contains the dataset


IMPORTING AN EXCEL FILE…  Can be .xls OR .xlsx

 Variable names CAN be imported too  Must be in row 1 of the worksheet

 Data will appear in SPSS Data View


IMPORTING DATA INTO SPSS 18

Existing data file


FOR EXAMPLE.

IMPORTING DATA FROM EXCEL.

3

Select the Excel file

1

Choose Excel file type to see your .xlsx

2

Find the folder where you saved the file


FOR EXAMPLE.

IMPORTING DATA FROM EXCEL.

Is this range correct?

If NOT Enter correct range here


FOR EXAMPLE. Variable Names (from Row 1)

View all data

IMPORTING DATA FROM EXCEL.


FOR EXAMPLE.

IMPORTING DATA FROM EXCEL.

View and Define variables This variable name from Excel could not be used. SPSS made it a label and created a new variable name


H O W T O H A N D L E M I S S I N G D ATA


REPLACE MISSING VALUES

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


REPLACE MISSING VALUES

Missing values have been replaced with -1 for TravelTimemin


CODE MISSING VALUES

8

Remember‌ From Variable View Define the missing values


CODE MISSING VALUES

• Missing • Missing data must 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


CODE MISSING VALUES

 This is only a code – it tells SPSS what values represent missing values.  It does not replace missing values with the code for you!


SPSS Survival Manual, 4th Edition (2010) by Julie Pallant. (For SPSS Version 15 or later)

Discovering Statistics Using SPSS, 3rd Edition (2009) by Andy Field. (For SPSS Version 15 or later)


ASK Week – Autumn 2012

+

Find the slides (and much more) on Blackboard


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.