SPSS Handout V2
SPSS Handout V2
SPSS
1 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Part I
2 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
3 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
4 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
5 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
1- Defining Variables
First, assign variable names based on your research questionnaire. If variable names are not
assigned, SPSS Statistics provides default names that may not be recognizable
3. Under the Type column, click Numeric, and then click the Ellipses utton that
5. Type Sex in row two under the Name column, and then press the Enter key.
6. Click the cell in row two under the Decimals column and change the entry to 0 using the
spin box.
7. Type What is your sex? in row two under the Label column, and then press the Enter
key.
8. Click None in row two under the Values column, and then click the Ellipses button. The
9. Type 1 in the Value box, type Female in the Label box, and then click the Add button.
6 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
in row four under the Label column, and then press the Enter key.
16. Click None in row four under the Values column, and then click the Ellipses button. The
Value Labels dialog box opens (see Figure 6).
17. Type 1 in the Value box, type 19 or younger in the Label box, and then click the Add button.
18. Repeat step 17 for values 2 through 5 and label them as shown in Table 3 (you may also
refer back to the sample questionnaire). See Figure 6 for the results.
19. Click the OK button
7 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
2- Data Entry
After defining the variables, users can enter data for each case. If variables are defined with the
Numeric data type, then numeric data should be entered. SPSS Statistics will only accept
numeric digits (0-9) for a Numeric data type. If variables are defined as String data, any
keyboard character can be entered.
To enter data:
1. Click the Data View tab in the lower-left corner of the Data Editor window (see Figure 7).
2. Click in a cell and type the corresponding data. The entry also appears in the Cell Editor
(see Figure 8).
8 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Descriptive Statistics
1- Fequency analysis: frequancy
analysis is used to describe one variable.
9 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
2- Cross tabes: Crosstabs are used to examine the relationship between two
variables.
1- In Data View, click the Analyze menu, point to Descriptive Statistics, and then click
Crosstabs (see Figure 13). The Crosstabs dialog box opens.
2. Select the the first variables and move it to the Row(s) box. Then select the second
one then move it to the Column(s) box. (see Figure 14)
3- Click the OK button. An Output Viewer window opens and displays two tables: Case
Processing Summary and the Crosstabulation matrix.
10 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Data Manipulation
Data files are not always organized to meet specific user needs. For example, users
may wish to select a specific subject or split the data file into separate groups for
analysis.
11 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
12 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Splitting a File
To split a file for analysis:
1- Click the Data menu, and then click Split File (see Figure 19). The Split File dialog box
opens (see Figure 20).
2- Select the sex variable in the left box.
3- Select the Compare groups option.
4- Click the transfer arrow button to move the sex variable to the Groups Based on box.
5- Click the OK button.
13 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
14 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
15 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Part II
How to choose the best Statistical Test
16 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
17 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
18 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
19 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
20 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
1. In Data View, click the Analyze menu, point to Compare Means, and then click
OneWay ANOVA. The One-Way ANOVA dialog box opens.
2. Select the Hemoglobin variable in the box on the left and move it to the Dependent List
box.
3. Select the Drug variable in the box on the left and move it to the Factor box.
4. Click the Options button. The One-Way ANOVA: Options dialog box opens.
5. Select the Descriptive, Homogeneity of variance test, and Means plot check boxes.
6. Click the Continue button.
21 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
In ANOVA, if the null hypothesis is rejected, then it is concluded that there are differences
between the means (μ1, μ2,…, μa). It is useful to know specifically where these differences exist.
Post hoc testing identifies these differences.
22 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
23 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
As before
1- Data coding
2- In Data View, click the Analyze menu, point to Descriptive Statistics, and then click
Crosstabs. The Crosstabs dialog box opens.
4- Select Gender to move it to the Row(s) box.
5- Select the Smoking to move it to the Column(s)
6- Select Cells dialog box
7- Select Expected from content list then continue.
8- Select Statistics dialog box
9- Select Chi-square then continue
24 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Mann–Whitney test
Non-parametric statistics are used when the data are not normally distributed and so are not
appropriate for “independent t-test” tests.
25 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
26 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Wilcoxon test
Non-parametric statistics are used when the data are not normally for two paired group. It is
similar to paired sample t-test tests for normally distributed data.
27 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
28 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Part III
Regression and Correlation Analysis
29 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Correlation Analysis
When is it used?
Where there is a linear relationship between two variables there is said to be a correlation between them.
Examples are height and weight in children, or BMI and the dose of anesthesia.
The strength of that relationship is given by the “correlation coefficient (denoted r)”.
The most effective way to assessing the nature of any association between two variables is by
considering a scatterplot
Scatter Plot
30 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
31 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Pearson r correlation
It is the most widely used correlation statistic to measure the degree of the relationship between:
32 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
33 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
34 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Regression Analysis
Regression analysis is a statistical process for estimating the relationships among variables by creating a
prediction equation; used to estimate how the value of dependent variable (Y) can be predicted based
on the value of one independent variable (X).
(Regression analysis is a statistical tool used in prediction of value of unknown variable from known
variable)
Simple Regression
Simple regression estimates how the value of one dependent variable (Y) can be predicted based on
the value of one independent variable (X). The linear equation for simple regression is as follows:
Y = X*b + a
35 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Figure 5 – Analyze Menu When Selecting Linear Figure 6 – Linear Regression Dialog Box
Model Summary
Coefficientsa
Standardized
Unstandardized Coefficients Coefficients
b a
36 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
37 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Part IV
Diagnostic test using SPSS
38 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
1. In Data View, click the Analyze menu, point to Descriptive Statistics, and then click
Crosstabs. The Crosstabs dialog box opens.
2. Select screening test to move it to the Row(s) box.
3. Select the diagnostic test to move it to the Column(s)
4- select Cells dialog box
5- Select column from percentage list then continue. >> Ok
39 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
True False
negative negative
diagnostic test
Positive Count 1 28 29
False True
positive positive
specificity NPV
diagnostic test
Positive Count 1 28 29
PPV Sensitivity
40 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
2- You will have a dialog box that says ROC Curve. In this box, you should drag your screening
measure to the box that says “Test Variable”. You should drag your dichotomized outcome (+ve and –
ve) variable into the “State Variable” box.
3- In the box that asks for the “Value of the State Variable”, put “1” – (The coding of positive results
of screening test).
4- In the box labeled “Display” check the options for “ROC Curve” “with Diagonal reference line”
and “Standard Error and Confidence Interval”
5- In the upper right corner of the ROC Curve dialog box, you’ll see the word “Options” – click on it.
6- A new dialog box should open called “ROC Curve Analysis; Options”. In this box, under “Test
Direction” select the appropriate option.
7- Select “Continue” and you should be returned to the ROC Curve dialog box, select “Ok” and the
analysis will run.
41 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
42 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
43 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
44 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Part V
Odds ratio (OR) and Relative risk (RR)
45 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Case Control
Exposed a b
Unexposed c d
46 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
• If the odds ratio is 1, the odds of disease is the same in the exposed and
unexposed groups.
• If the odds ratio is 2, the exposure of interest doubles the odds of disease.
• If the odds ratio is 0.5, the exposure of interest halves the odds of disease.
• If the odds ratio is 0.25, the exposure of interest reduces the odds of disease by
75%.
NB (If the OR<1, it means that this risk factor protects against this disease).
47 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Relative risk is used in “cohort studies”, prospective studies that follow a group
(cohort) over a period of time and investigate the effect of a treatment or risk
factor.
Diseased a C a+c
Not diseased b d B+c
total a+b c+d
48 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
• If the risk ratio is 1, the risk of disease is the same in the exposed and unexposed
groups.
• If the risk ratio is 2, the exposure of interest doubles the risk of disease.
• If the risk ratio is 0.5, the exposure of interest halves the risk of disease.
• If the risk ratio is 0.25, the exposure of interest reduces the risk of disease by
75%.
What is the difference between the odds ratio and risk ratio?
“The odds ratio is interpreted in the same way as the risk ratio”
• When the disease is rare, the odds ratio is approximately equal to the risk ratio.
In case–control studies, the incidence rate of disease cannot be calculated, as we
don’t know the size of the population from which the cases were drawn.
However, in cohort studies, a set number of ‘healthy’ individuals susceptible to
the disease are recruited at the start of the study period. These subjects are then
followed up longitudinally over time, and new cases of disease recorded, thus
allowing us to calculate the incidence rate and risk ratio.
In case–control studies, provided the outcome event is rare, the odds is
approximately the same as the risk and so the odds ratio is an estimate of the risk
ratio, and is interpreted in a similar way.
49 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
1- Data coding
2- Click Data menu, point weight cases, the weight cases by (frequency)
3- In Data View, click the Analyze menu, point to Descriptive Statistics, and then click
Crosstabs. The Crosstabs dialog box opens.
4- Select exposure to move it to the Row(s) box.
5- Select the disease to move it to the Column(s)
6- Select Cells dialog box
7- Select Rows from percentage list then continue.
8- Select Statistics dialog box
9- Select Risk then continue
50 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
51 Mobile: 01006037334
Medical Statistics Using SPSS Dr. Hussien Ahmed Hussien
Risk Estimate
52 Mobile: 01006037334