SPSSIntroduction
SPSSIntroduction
UNIVERSITÄTSMEDIZIN BERLIN
1
Contents
Time Day 1
9.15 – 9.30 Introduction
Starting SPSS
SPSS windows: Data editor, SPSS viewer, Syntax
9.30 – 10.15 Getting the data into SPSS Data management
- Manually entering data - Variable name
- Opening from SPSS file - Value label
- Opening from Excel file - Compute
- Recode into same
- Recode into difference
- Visual Bander (Cont. -> Cat.)
10.15 – 11.00 Describing Data
- Frequency - Histogramm
- EXAMINE - Skewness/Kurtosis
- Barchart/Graphic
11.00 – 11.15 Pause
2
Contents
Time Day 2
9.15 – 10.15 Comparing >2 Groups
- One-Way Analysis of Variance (ANOVA) + Post-hoc tests
- Kruskal-Wallis test (non-parametric)
10.15 – 11.00 Correlation
- Pearson correlation
- Spearman‘s rank correlation
- Linear regression
- Scatter plots with adding a regression line
11.00 – 11.15 Pause
3
Introduction to SPSS
SPSS
1. 2. 3. 4. 5. 6. 7.
Variable Variable Variable Variable Variable Variable Variable
1. 1.Record 1.Record 1.Record 1.Record 1.Record 1.Record 1.Record
Record 1.Variable 2.Variable 3.Variable 4.Variable 5.Variable 6.Variable 7.Variable
8 1 83 86
Independent Samples
For Independent Tests, the existing Cases must be divided into two or more Groups.
The variable values "Verum" Or "Placebo" must be defined and entered as a Variable.
1 1 75 73 73
2 1 88 79 79
3 2 69 71 71
4 1 93 88 88
5 1 71 71 71
6 2 65 63 63
7 2 80 75 75
8 1 83 86 86
7
Log-in to the Computer
8
9
Download
SPSS data file
Download Handout
10
Changing the language in SPSS
Menu bar
Edit
Options…
11
SPSS Windows: Data View
12
SPSS Windows: Variable View
13
SPSS Windows: Output
14
SPSS Windows: Syntax
15
Save SPSS files
In each window:
16
Getting the data into SPSS
17
Manually entering data
Baseline:
Enrollment date [DD, MM, YYYY] □□.□□.□□□□ Enroll_date
Low blood count:
- after 1 hr □□ LBC_1h_v0
- after 2 hrs □□□ LBC_2h_v0
GOT [U/l] □□□ GOT_v0
GPT [U/l] □□□ GPT_v0
18
Manually entering data
Menu Bar
File
New
Data
19
20
Ref: https://www.ibm.com/support/knowledgecenter/en/SSLVMB_25.0.0/statistics_mainhelp_ddita/spss/base/idh_defvar_type.html 21
22
23
Opening from Excel file
24
Getting the data into SPSS
Manually entering data
Opening from SPSS file
Opening from Excel file
Data management
Variable name
Value label
Compute
Recode into same
Recode into difference
Visual Bander (Cont. -> Cat.)
25
Compute
26
Compute BMI (kg/m2) =
( )
Variable name:
Height = Height (cm)
Weight = Weight (kg)
Syntax:
COMPUTE bmi=Weight / ((Height / 100) ** 2).
EXECUTE.
27
Recode
Recode into same: to reassign the values of existing variables
gender gender
Old variable name
0=Male 1=Male !!lose the old value
0 1
1=Female 2=Female
1 2
Recode into difference: to assign the values into new variables, but
keep the existing variables as original. (Recommend!)
gender gender_n
New variable name
0=Male 1=Male !!keep the old valiable
0 1
1=Female 2=Female
1 2
28
Recode into difference
From the menus choose:
Transform
Recode into Different Variables…
29
Recode into same
From the menus choose:
Transform
Recode into Same Variables…
30
Create categorical variables from continuous variables
Age Age_g
23 1 = <40 yrs
35 1
40 2 = 40 – 49 yrs
45 2
50 3 = ≥50 yrs
60 3
Commands:
Recode into difference
Visual binning
31
Create categorical variables from continuous variables
From the menus choose:
Transform
Recode into Different Variables…
32
Create categorical variables from continuous variables
From the menus choose:
Transform
Visual Binning…
33
Create categorical variables from continuous variables
From the menus choose:
Transform
Visual Binning…
34
Getting the data into SPSS
Manually entering data
Opening from SPSS file
Opening from Excel file
Data management
Variable name
Value label
Compute
Recode into same
Recode into difference
Visual Bander (Cont. -> Cat.)
35
Exercise 1:
Using SPSS_course.sav
BMI (kg/m2) =
( )
Create new variable:
36
Compute BMI (kg/m2) =
( )
Variable name:
Height = Height (cm)
Weight = Weight (kg)
Syntax:
COMPUTE bmi=Weight / ((Height / 100) ** 2).
EXECUTE.
37
Create BMI as Category variable with label value
From the menus choose:
Transform
Visual Binning…
38
Recode BMI group into new variable
Normal vs. Overweight+Obese
39
Syntax
***Exercise 1
*Calculate BMI.
COMPUTE bmi=weight / ((height / 100) ** 2).
EXECUTE.
40
Break!
https://pixabay.com/de/lehre-klassenzimmer-lehrer-bildung-311356/
12
Describing data
Frequency
Explore
Histogramm
Skewness/Kurtosis
Barchart/Graphic
42
Frequency: Categorical variables
From the menus choose:
Analyze
Descriptive Statistics
Frequencies…
43
44
From the menus choose:
Analyze
Descriptive Statistics
Frequencies…
45
46
Frequency: Continuous variables
From the menus choose:
Analyze
Descriptive Statistics
Frequencies…
47
48
Descriptive separate by Category Variable
From the menus choose:
Analyze
Descriptive Statistics
Explore…
49
50
51
52
Statistics overview
53
Data analysis: Crosstab + Chi-square test
To compare BMI groups between Male and Female
From the menus choose:
Analyze
Descriptive Statistics
Crosstabs…
54
55
Data analysis: Independent t-test and Paired t-test
56
Data analysis: Independent t-test
From the menus choose:
Analyze
Compare Means
Independent-Samples T Test…
57
Report
There was no statistically difference of BMI between Male and Female,
Mean difference=0.41 (95%CI: -0.57 to 1.39); p-value=0.405
58
Data analysis: Paired t-test
From the menus choose:
Analyze
Compare Means
Paired-Samples T Test…
59
60
Data analysis: Mann-Whitney U Test
From the menus choose:
Analyze
Nonparametric tests
Legacy Dialogs
2 Independent Samples
61
𝒁
𝑪𝒐𝒉𝒆𝒏 𝒔 𝒓 =
𝑵
Z n Effect size
63
From the menus choose: From the menus choose:
Data Analyze
Split files… Descriptive Statistics
Frequencies…
64
Without Split file With Split file by gender
65
From the menus choose:
Data Don‘t forget to set Analyze all cases
Split files… In Split files back!!!
66
Data analysis: Wilcoxon-signed rank test
From the menus choose:
Analyze
Nonparametric tests
Legacy Dialogs
2 Related Samples
67
𝒁
𝑪𝒐𝒉𝒆𝒏 𝒔 𝒓 =
𝑵
Z n Effect size
Time Day 2
9.15 – 10.15 Comparing >2 Groups
- One-Way Analysis of Variance (ANOVA) + Post-hoc tests
- Kruskal-Wallis test (non-parametric)
10.15 – 11.00 Correlation
- Pearson correlation
- Spearman‘s rank correlation
- Linear regression
- Scatter plots with adding a regression line
11.00 – 11.15 Pause
69
Statistics overview
70
Statistics overview: Regression models
Continuous outcome
Linear regression model
Binary outcome
Logistic regression model
Ordinal outcome
Ordinal logistic regression model
Multiple categorical outcome
Multinomial logistic regression model
Time-to-event outcome
Cox-proportional hazard model
Longitudinal study
Generalized Estimating Equation (GEE)
Mixed/Multilevel model
71
From the menus choose:
Transform
Visual Binning…
72
Data analysis: One-Way ANOVA
From the menus choose:
Analyze
Compare Means
One-Way ANOVA…
73
74
75
Data analysis: Kruskal-Wallis Test
From the menus choose:
Analyze
Nonparametric tests
Legacy Dialogs
K Independent Samples
76
77
From the menus choose:
Analyze
Nonparametric tests
Independent Samples…
78
79
Double click at result table!
To show editor window
81
82
Data analysis: Linear regression
From the menus choose:
Analyze
Regression
Linear…
83
84
From the menus choose:
Graphs
Chart Builder…
85
86
From the menus choose:
Graphs Scatter plot by gender
Chart Builder…
87
88
Break!
https://pixabay.com/de/lehre-klassenzimmer-lehrer-bildung-311356/
12
Data analysis: ROC
From the menus choose:
Analyze
ROC Curve…
90
91
Data analysis: Logistic Regression
From the menus choose:
Analyze
Regression
Binary Logistic…
92
93
The odds of alcohol drinking in female were 87% less than Male.
The odds of alcohol drinking in male was 7.58 (1/0.132) times higher than female.
The odds of alcohol drinking in Pt.who was younger than 50 were 1.2 times higher than
the Pt. who was older than 60 years.
94
Calculation Time from Date Variable
95
96
Data analysis: Kaplan-Meier Curve
From the menus choose:
Analyze
Survival
Kaplan-Meier…
97
98
From the menus choose:
Analyze
Survival
Kaplan-Meier…
99
100
Data analysis: Cox-regression
From the menus choose:
Analyze
Survival
Cox regression…
101
102
Male at any time point during the study period were likely to die 1.94 times compared
to female, and we are 95% confident that the true value is lying between 0.86-4.37.
Pt. who had BMI overweight at any time point during the study period had the risk of
death 3.33 times and Pt. who had BMI obese had 4.29 times compared to the Pt.
who had normal BMI.
103
http://www.picserver.org/images/highway/phrases/exercise.jpg
13
Create „Group variable“ from „No“
1= <45
2= 45 – 100
3= >100
Compare „Chol_v0“, „TG_v0“ and „Hb_v0“ between groups by
choosing the appropriate statistical test
ANOVA or Kruskal-Wallis test
Performing the correlation between „Age“ and „Chol_v0“ separately
by groups
Pearson correlation and Scatter plot separately by groups
Create „Cholesterol group“ from „Chol_v0“
0 = Normal (Chol_v0<200)
1 = High Cholesterol (Chol_v0>=200)
Which factors (Age, gender, bmi_2g) associate with High
Cholesterol?
Which statistics will you perform?
105
From the menus choose:
Transform
Visual Binning…
106
From the menus choose:
Analyze
Descriptive Statistics
Explore…
107
108
109
110
111
112
From the menus choose:
Analyze
Compare Means
One-Way ANOVA…
113
114
115
From the menus choose:
Analyze
Nonparametric tests
Legacy Dialogs
K Independent Samples
116
117
From the menus choose: From the menus choose:
Data Analyze
Split files… Correlate
Bivariate…
118
119
From the menus choose:
Transform
Visual Binning…
120
From the menus choose:
Transform
Visual Binning…
121
From the menus choose:
Analyze
Regression
Binary Logistic…
122
123