Using SPSS for Chi Square
Dr Athar Khan
MBBS, MCPS, DPH, DCPS-HCSM, DCPS-HPE, MBA,
PGD-Statistics
Associate Professor
Liaquat College of Medicine & Dentistry
Area of Residence
Total
Urban Rural
BMI Categories
Normal and
Underweight
7 11 18
Overweight and
Obesity
10 2 12
Total 17 13 30
12/7/2016 7DR ATHAR KHAN -LCMD
Assumptions
•Assumption#1:
•Twovariablesshouldbemeasuredat
an ordinal or nominal
level(i.e.,categoricaldata).
12/7/2016 8DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
•Step 3: Critical value
–Sampling distribution = χ
2
distribution
–Df = (r-1)(c-1) = 1 (a 2-by-2 table)
–χ
2
(critical) = 3.481
12/7/2016 11DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
•Step 4: Calculated Value
–1. Draw a contingency table.
–2. Enter the Observed frequencies or counts (O)
–3. Calculate totals (in the margins).
Area of Residence
Total
Urban Rural
BMI Categories
Normal and
Underweight
7 11 18
Overweight and
Obesity
10 2 12
Total 17 13 30
12/7/2016 12DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
•Step4:CalculatedValue
•4.CalculatetheExpectedfrequencies(E)a.Foreachcell:Columntotalx
Rowtotal/Nb.WritetheExpectedfrequencyintotheappropriatebox
inthetable.
•CHECK:Expectedfrequencies(E)marginaltotalsarethesameasfor
Observedfrequencies(O)Eyeballthecontingencytable,notingwhere
thedifferencesbetweenO(observed)andE(Expected)valuesoccur.If
theyareclosetoeachother,thelevelsoftheindependent(predictor)variableare
nothavinganeffect.
Area of Residence
Total
Urban Rural
BMI Categories
Normal and
Underweight
7 11 18
Overweight and
Obesity
10 2 12
Total 17 13 30
10.2 7.8
6.8 5.2
12/7/2016 13DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
Area of Residence
Total
Urban Rural
BMI Categories
Normal and
Underweight
7 11 18
Overweight and
Obesity
10 2 12
Total 17 13 30
10.2 7.8
6.8 5.2
12/7/2016 15DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
O E O-E (O-E)
2
12/7/2016 16DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
Step 4: computing the test statisticin SPSS
12/7/2016 18DR ATHAR KHAN -LCMD
Hypothesis Testing–Step by Step
•Step 5: making a decision and interpreting the
results of the testoverweight_1 * urban Crosstabulation
329 468 797
385.7 411.3 797.0
155 48 203
98.3 104.7 203.0
484 516 1000
484.0 516.0 1000.0
Count
Expected Count
Count
Expected Count
Count
Expected Count
0
1
overweight_1
Total
0 1
urban
Total Chi-Square Tests
79.699
b
1 .000
78.301 1 .000
82.696 1 .000
.000 .000
79.619 1 .000
1000
Pearson Chi-Square
Continuity Correction
a
Likelihood Ratio
Fisher's Exact Test
Linear-by-Linear
Association
N of Valid Cases
Value df
Asymp. Sig.
(2-sided)
Exact Sig.
(2-sided)
Exact Sig.
(1-sided)
Computed only for a 2x2 tablea.
0 cells (.0%) have expected count less than 5. The minimum expected count is 98.
25.
b.
Result
(χ
2
obtained)12/7/2016 19DR ATHAR KHAN -LCMD
Exercise
•Does a significant relationship exist between
Gender and BMI categories ?
12/7/2016 20DR ATHAR KHAN -LCMD
Chi-Square Tests
Value df
Asymp. Sig.
(2-sided)
Exact Sig. (2-
sided)
Exact Sig.
(1-sided)
Pearson Chi-Square
.023
a
1 .879
Continuity Correction
b
.000 1 1.000
Likelihood Ratio
.023 1 .879
Fisher's Exact Test
1.000 .588
Linear-by-Linear
Association
.022 1 .881
N of Valid Cases
30
a. 1 cells (25.0%) have expected count less than 5. The minimum expected count is
4.80.
b. Computed only for a 2x2 table
12/7/2016 22DR ATHAR KHAN -LCMD