Professional Documents
Culture Documents
Chapter#8 Association
Chapter#8 Association
Introduction
Chi-Square Test for Independence
Contingency Table
Relative Risk
Odds Ratio
2 × 2 Contingency Table
Fisher’s Exact Test
Exercise
TEST OF INDEPENDENCE
The use of chi-square distribution is to test the null
hypothesis* that two criteria of classification, when
applied to the same set of entities, are independent.
For Example:
➢ If socioeconomic status and area of residence of the
inhabitants of a certain city are independent.
Note:
➢ If the difference is sufficiently small, the null hypothesis
is accepted.
➢ If the difference is sufficiently large, the null hypothesis
is rejected, and we conclude that the two criteria of
classification are not independent.
OBSERVED VS. EXPECTED FREQUENCIES
➢ The decision will be made on the basis of the size of
quantity as:
𝑛
𝑜 − 𝑒 2
𝑖 𝑖
χ2 =
𝑒𝑖
𝑖=1
➢ This follows χ2 − distribution with (𝑟 − 1)(𝑐 − 1)
degrees of freedom.
where
𝑜𝑖 represents the observed frequencies
𝑒𝑖 represents the expected frequencies
Note:
➢ When we apply the 𝑟 − 1 𝑐 − 1 rule for finding
degrees of freedom to a 2 × 2 table, the result becomes 1
degree of freedom.
EXAMPLE OF THE 2 × 2 CONTINGENCY TABLE
Example: The falls are of major concern among polio
survivors. Researchers wanted to determine the impact of
a fall on lifestyle changes. Table 12.4.6 shows the results
of a study of 233 polio survivors on whether fear of
falling resulted in lifestyle changes. Construct a 2 × 2
contingency table to test the results.
EXAMPLE OF THE 2 × 2 CONTINGENCY TABLE
Solution: Assumption: Sample is selected randomly
from the population.
(i) Hypothesis:
𝐻0 : Fall status and lifestyle change because of fear of
falling are independent.
𝐻𝐴 : Fall status and lifestyle change because of fear of
falling are dependent.
(ii) Level of Significance:
𝛼 = 0.05
(iii) Test Statistics:
𝑛 𝑎𝑑 − 𝑏𝑐 2
χ𝑐 2 =
𝑎+𝑐 𝑏+𝑑 𝑎+𝑏 𝑐+𝑑
(iv) Calculation:
Compute the observed and expected frequencies.
EXAMPLE OF THE 2 × 2 CONTINGENCY TABLE
2
2
233 131 36 − 52 14
χ𝑐 = = 31.7391
145 88 183 50
(v) Statistical Decision:
Reject 𝐻0 if χ𝑐 2 ≥ χ2 𝑡=𝛼, 𝑟−1 𝑐−1
χ2 𝑡=0.05,(2−1)(2−1) = 3.841 (Table Value)
where
𝛼 = 0.05, 𝑟 = 2, and 𝑐=2
(vi) Conclusion:
Reject 𝐻0 /null hypothesis as 31.7391 ≥ 3.841 so
we conclude that there is a relationship between Fall
status and lifestyle change because of fear of falling .
SMALL EXPECTED FREQUENCIES
𝑎Τ 𝑎 + 𝑏
=
𝑅𝑅
𝑐Τ 𝑐 + 𝑑
𝐻0 : 𝑝1 = 𝑝2
𝐻1 : 𝑝1 ≠ 𝑝2
(ii) Level of Significance:
𝛼 = 0.05
(iii) Test Statistics:
𝑝 − 𝑣𝑎𝑙𝑢𝑒
where
𝑝 − 𝑣𝑎𝑙𝑢𝑒 = 𝑝𝑜 + 𝑝1 + ⋯ + 𝑝𝑘
𝑎𝑖 + 𝑏𝑖 ! 𝑐𝑖 + 𝑑𝑖 ! 𝑎𝑖 + 𝑐𝑖 ! 𝑏𝑖 + 𝑑𝑖 !
𝑝𝑖 =
𝑎𝑖 ! 𝑏𝑖 ! 𝑐𝑖 ! 𝑑𝑖 ! 𝑛!
EXAMPLE – FISHER EXACT TEST
(iv) Calculation of test statistic:
Program
Class Correct Incorrect Total
Conventional 23 𝑎𝑜 7 𝑏𝑜 30 𝑎𝑜 + 𝑏𝑜
Experimental 27 𝑐𝑜 3 𝑑𝑜 30 𝑐𝑜 + 𝑑𝑜
Total 50 𝑎𝑜 + 𝑐𝑜 10 𝑏𝑜 + 𝑑𝑜 60 𝑛
30 ! 30 ! 50 ! 10 !
𝑝𝑖 = =∞
23!7!27!3!60!
(v) Statistical decision:
Reject 𝐻0 if *𝑝 − 𝑣𝑎𝑙𝑢𝑒 ≤ 𝛼
We cannot solve this question by Fisher exact test so we
apply chi-square test of homogeneity.
EXAMPLE – FISHER EXACT TEST
OR
𝒐𝒊 𝒆𝒊 𝒐𝒊 − 𝒆𝒊 𝟐 𝒐𝒊 − 𝒆𝒊 𝟐 Τ𝒆𝒊
23 25 4 0.16
27 25 4 0.16
7 5 4 0.8
3 5 4 0.8
EXAMPLE – FISHER EXACT TEST
𝑛
𝑜𝑖 − 𝑒𝑖 2
χ𝑐 2 = = 1.92
𝑒𝑖
𝑖=1
(v) Statistical Decision:
Reject 𝐻0 if χ𝑐 2 ≥ χ2 𝑡=𝛼, 𝑟−1 𝑐−1
χ2 𝑡=𝛼, 𝑟−1 𝑐−1 = 3.841 (Table Value)
where
𝛼 = 0.05, 𝑟 = 2, and 𝑐=2
(vi) Conclusion:
Accept 𝐻0 /null hypothesis as 1.92 ≥ 3.841 so
we conclude that both the populations are equally
effective.
EXAMPLE – FISHER EXACT TEST
Example – Following table contains results of a study
comparing radiation therapy with surgery in
treating cancer. Use Fisher Exact Test to test the
hypothesis that surgery is better treatment:
Cancer
Treatment Controlled Not-Controlled Total
Surgery 21 2 23
Radiation
15 3 18
Therapy
Total 36 5 41
EXAMPLE – FISHER EXACT TEST
Solution: Assumption: Sample is selected randomly
from the population.
(i) Hypothesis:
𝑝1 : Probability of cancer control among the patient treated
with surgery.
𝑝2 : Probability of cancer control among the patient treated
with radiation therapy.
𝐻0 : 𝑝1 = 𝑝2
𝐻1 : 𝑝1 > 𝑝2
(ii) Level of Significance:
𝛼 = 0.05
(iii) Test Statistics:
𝑝 − 𝑣𝑎𝑙𝑢𝑒
where
𝑝 − 𝑣𝑎𝑙𝑢𝑒 = 𝑝𝑜 + 𝑝1 + ⋯ + 𝑝𝑘
𝑎𝑖 + 𝑏𝑖 ! 𝑐𝑖 + 𝑑𝑖 ! 𝑎𝑖 + 𝑐𝑖 ! 𝑏𝑖 + 𝑑𝑖 !
𝑝𝑖 =
𝑎𝑖 ! 𝑏𝑖 ! 𝑐𝑖 ! 𝑑𝑖 ! 𝑛!
EXAMPLE – FISHER EXACT TEST
(iv) Calculation of test statistic:
Cancer
Treatment Controlled Not-Controlled Total
Surgery 21 𝑎𝑜 2 𝑏𝑜 23 𝑎𝑜 + 𝑏𝑜
Radiation Therapy 15 𝑐𝑜 3 𝑑𝑜 18 𝑐𝑜 + 𝑑𝑜
Total 36 𝑎𝑜 + 𝑐𝑜 5 𝑏𝑜 + 𝑑𝑜 41 𝑛
23 ! 18 ! 36 ! 5 !
𝑝𝑜 = = 0.2754
2!2!15!3!41!
Now to calculate 𝑝1 the 2×2 contingency table will be
adjusted as:
EXAMPLE – FISHER EXACT TEST
Cancer
Treatment Controlled Not-Controlled Total
Surgery 22 𝑎𝑜 1 𝑏𝑜 23 𝑎𝑜 + 𝑏𝑜
Radiation Therapy 14 𝑐𝑜 4 𝑑𝑜 18 𝑐𝑜 + 𝑑𝑜
Total 36 𝑎𝑜 + 𝑐𝑜 5 𝑏𝑜 + 𝑑𝑜 41 𝑛
23 ! 18 ! 36 ! 5 !
𝑝1 = = 0.09391
22!1!14!4!41!
Now to calculate 𝑝2 the 2×2 contingency table will be
adjusted as:
EXAMPLE – FISHER EXACT TEST
Cancer
Surgery 23 𝑎𝑜 0 𝑏𝑜 23 𝑎𝑜 + 𝑏𝑜
Radiation Therapy 13 𝑐𝑜 5 𝑑𝑜 18 𝑐𝑜 + 𝑑𝑜
Total 36 𝑎𝑜 + 𝑐𝑜 5 𝑏𝑜 + 𝑑𝑜 41 𝑛
23 ! 18 ! 36 ! 5 !
𝑝2 = = 0.0114
23!0!13!5!41!
𝑝 − 𝑣𝑎𝑙𝑢𝑒 = 𝑝𝑜 + 𝑝1 + 𝑝2
= 0.2754 + 0.09391 + 0.0114 = 0.38071
(v) Statistical decision:
Reject 𝐻0 if 𝑝 − 𝑣𝑎𝑙𝑢𝑒 ≤ 𝛼
0.38071 ≤ 0.05
(vi) Conclusion:
Accept 𝐻0 /null hypothesis as 0.38071 ≤ 0.05 so we conclude
that probability of cancer control among the patient treated
with surgery is better treatment.
EXERCISE (NUMERICAL QUESTIONS)
Q-1: In the study by Silver and Aiello, a secondary objective
was to determine if the frequency of falls was independent
of wheelchair use. The following table gives the data for
falls and wheelchair use among the subjects of the study.