Chi Square

Chi-Square test
PRESENTED BY:
Dr.Zhian Salah Ramzi
Head of community and
Family medicine/ sulaimani university
Chi-Square Test
Evaluates whether observed
frequencies for a qualitative variable
(or variables) are adequately
described by hypothesized or expected
frequencies.
Qualitative (or categorical) data is a set
of observations where any single
observation is a word or code that
represents a class or category.

Nonparametric Statistics
 Chi-Square
 Used
(2 )Test
to analyze data in situations where one wishes
to test whether the observed number of responses in
a category differs from the expected number that
fall in that category.
 Dependent Variable is nominal.
 Ho represents the expected proportion of responses
falling in a given category.

(
Oi

Ei
)
2

Ei
k
2
• Where k = # of categories, Oi = observed number of cases in
each category, Ei = expected number of cases in each category.
• When Ho is true, Oi  Ei and 2 will be small. If Ho is false,
then Oi  Ei and 2 will be large.
Simple
variables
and complex – one variable or multiple
Recent studies have found that most teens are
knowledgeable about AIDS, yet many continue
to practice high-risk sexual behaviors. King
and Anderson (1993) asked young people the
following question: “If you could have sexual
relations with any and all partners of your
choosing, as often as you wished, for the next
2 (or 10) years, but at the end of that time
period you would die of AIDS, would you make
this choice?” A five-point Likert scale was
used to assess the subjects’ responses. For
the following
data, the responses “probably no,” “unsure,”
“probably yes”, and “definitely yes” were pooled
into the category “other.” Using the .05 level of
significance, test for independence.
Definitely No
Other
Males
451
165
Females
509
118
Chi-Square Test for
Independence
State
the research hypothesis.
Is
willingness to participate in
unprotected sex independent of
gender?
State
the statistical hypothesis.
H0:Response to the question and gender are not related
HA:Response to the question and gender are related
Chi-Square Test for
Independence
To
find expected values:
Find
column, row, and overall totals.
Definitely No
Other
Total
Males
451
165
616
Females
509
118
627
Total
960
283
1243
Chi-Square Test for
Independence
To
find expected values:
(column to tal) (row total)
Eif e 
overall total
Ei
Ei
fe 
(960)( 616)
 475.75
1243
Definitely No
Other
Total
Males
451 (475.75) 165
616
Females
509
118
627
Total
960
283
1243
Chi-Square Test for
Independence
To
find expected values:
Ei
(column to tal) (row total)
fe 
overall total
Ei
(960)(627)
fe 
 484.25
1243
Definitely No
Other
Total
Males
451 (475.75) 165
616
Females
509 (484.25) 118
627
Total
960
1243
283
Chi-Square Test for
Independence
To
find expected values:
(column to tal) (row total)
overall total
Ei
fe 
Ei
( 283)(616)
fe 
 140.25
1243
Definitely No
Other
Total
Males
451 (475.75) 165 (140.25) 616
Females
509 (484.25) 118
627
Total
960
1243
283
Chi-Square Test for
Independence
To
Ei
Ei
find expected values:
fe 
(column to tal) (row total)
overall total
( 283)( 627)
fe 
 142.75
1243
Definitely No
Other
Total
Males
451 (475.75) 165 (140.25) 616
Females
509 (484.25) 118 (142.75) 627
Total
960
283
1243
Chi-Square Test for
Independence
Set
the decision rule.
Degrees
of Freedom
 (number
of columns - 1) (number of rows -1)
 (c-1)(r-1)
df  (2  1)( 2  1)  (1)(1)  1
Definitely No
Other
Males
451
165
Females
509
118
Chi-Square
 Set
the decision rule.
  .05
df  1

2
crit
 3.84
Chi-Square Test for
Independence

Calculate the test
statistic.Definitely No
Other
Total
Males
451 (475.75) 165 (140.25) 616
Females
509 (484.25) 118 (142.75) 627
Total
960
283
1243
(451  475.75) 2 (509  484.25) 2 (165  140.25) 2 (118  142.75) 2
 



475.75
484.25
140.25
142.75
2

(Oi  Ei)

Ei
k
2
2

612.56 612.56 612.56 612.56



475.75 484.25 140.25 142.75
 1.29  1.26  4.37  4.29
 11.21
The Chi-Square test
Chi-Square Test for
Independence
 Decide
if your result is significant.
 Reject
H0, 11.21>3.84
 Interpret
your results.
Willingness to engage in unprotected sex
and gender are not independent.
Definitely No
Other
Total
Males
451 (475.75) 165 (140.25) 616
Females
509 (484.25) 118 (142.75) 627
Total
960
283
1243