Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Chi-square Test

Test of independence of Attributes- Contingency Tables


(2 x 2 CONTINGENCY YABLE)
For the 2 x 2 table,
a b
c d

chi-square test of independence gives

N (ad-bc)2
χ2 = ----------------------------- , N = a+b+c+d
(a+c)(b+d)(a+b)(c+d)
With (2-1)(2-1) = 1 d.f.

Exercise 1: Out of 8,000 graduates in a town, 800 are


females, out of 1,600 graduate employees, 120 are females.
Use χ2 to determine if any distinction is made on
appointment on the basis of sex. Value of χ 2 at 5% level for
one degree of freedom is 3.84.
Solution: Null hypothesis : No distinction is made in
appointment on the basis of sex
Alternative hypothesis : Distinction is made in
appointment on the basis of sex.

1
Observed Frequencies
Employed Not employed Total
Male 1480 5720 7200
Female 120 680 800
Total 1600 6400 8000

Expected Frequencies
Employed Not Total
employed
Male (7200*1600)/8000=144 7200- 7200
0 1440=5760
Female 1600-1440 = 160 6400-5760 800
= 640
Total 1600 6400 8000

Calculation for χ2
    Frequency    
Observe
Class   d Expected (oi - ei ) (oi - ei )2 /ei
    (oi ) (ei )    
Male employed 1480 1440 40 1.11
Male not employed 5720 5760 -40 0.28
Female employed 120 160 -40 10.00
Female not employed 680 640 40 2.50
  Total       13.89

χ2 =∑(oi - ei )2 /ei
= 13.89
d.f. = (2-1)(2-1)
=1
2
Tabulated χ 0.05 = 3.84

2
Decision: Since the calculated value of χ2 (13.89) is greater
than the tabulated value of χ2 (3.84), the value of χ2 is highly
significant and null hypothesis is rejected. Hence, we
conclude that distinction is made in appointment on the basis
of sex.
N (ad-bc) 2
Same exercise with formula : --------------------------
(a+b)(c+d)(a+c)(b+d)

8000*(1480x680 – 5720x120) 2
= ----------------------------------------
(1480+57
20)(120+680)(1480+120)
(5720+680)
8000*1024x108
7200x800x1600x6400
8000*1024
72x8x16x64
8192000
589824
χ2 =13.89
Exercise 2:
In an experiment on immunisation of cattle from tuberculosis,
the following results were obtained:

3
Affected Unaffected

Innoculated 12 28

Not inoculated 13 07

Examine the effect of vaccine in controlling the


incidence of the disease.

Solution:

Null hypothesis: There is no effect of vaccine in controlling the


incidence of the tuberculosis.

Observed frequencies

Affected Unaffected Total


Inoculated 12 28 40
Not inoculated 13 07 20
Total 25 35 60

Expected frequencies

Affected Unaffected Total


Inoculated (40*25)/60=17 40-16.67=23 40
Not inoculated 25-17=08 35-23=12 20
Total 25 35 60

4
Calculation for χ2
    Frequency    
Observe
Class   d Expected (oi - ei ) (oi - ei )2 /ei
    (oi ) (ei )    
Inoculated and
affected 12 17 -5 25/17= 1.47
Inoculated and
unaffected 28 23 5 25/23=1.09
Not inoculated and
affected 13 08 5 25/08=3.12
Not inoculated and
unaffected 07 12 -5 25/12=2.08
  Total 60 60   7.76

χ2 =∑(oi - ei )2 /ei
= 7.76
d.f. = (2-1)(2-1)
=1
2
Tabulated χ 0.05 = 3.84
Decision: Since the calculated value of χ2 (7.76) is greater
than the tabulated value of χ2 (3.84), the value of χ2 is highly
significant and null hypothesis is rejected. Hence, we
conclude that vaccine is effective in controlling the incidence
of tuberculosis.
Solution by alternative method:
60x (12x7-28x13)2
-----------------
40x20x25x35
χ2 =6.72

5
60x 78400
---------------
700000

Exercise 3:
A random sample of students of XYZ University was
selected and asked their opinions about ‘autonomous
colleges’. The results are given below. Test the hypothesis at
5% level that opinions are independent of the class
groupings.

  Numbers Total
Class Favouring Opposed to  
‘áutonomous 'áutonomous
  colleges' colleges'  
       
BA/BSc/BCom
Part I 120 80 200
BA/BSc/BCom
Part II 130 70 200
BA/BSc/BCom
Part III 70 30 100
MA/MSc/MCo
m 80 20 100
Total 400 200 600

Solution:
Null hypothesis: Opinions about autonomous colleges are
independent of the class-groupings.

6
Here, the frequencies are arranged in the form of a 4 x 2
contingency table. Hence, the d.f. is (4-1) * (2-1) = 3.

Expected frequencies
  Numbers Total
Class Favouring Opposed to  
‘áutonomous 'áutonomous
  colleges' colleges'  
       
BA/BSc/BCom (200X400)/600=
Part I 133.33 200-133.33=66.67 200
BA/BSc/BCom (200X400)/600=133.
Part II 33 200-133.33=66.67 200
BA/BSc/BCom
Part III 66.67 100-66.67=33.33 100
MA/MSc/MCo 400-133.33-133.33-
m 66.67=66.67 100-66.67=33.33 100
Total 400 200 600

oi ei oi - ei (oi - ei)2 (oi - ei)2 /ei


12
0 133.33 -13.33 177.6889 1.3327
13
0 133.33 -3.33 11.0889 0.0832
70 66.67 3.33 11.0889 0.1663
80 66.67 13.33 177.6889 2.6652
80 66.67 13.33 177.6889 2.6652
70 66.67 3.33 11.0889 0.1663
30 33.33 -3.33 11.0889 0.3327
20 33.33 -13.33 177.6889 5.3312
        12.7428

Tabulated value of χ2 for (4-1)x (2-1) = 3 d.f. at 5% level of


significance is 7.815.
Decision: Since calculated value of χ2 is greater than the
tabulated value, it is significant at 5% level of significance and

7
we reject the null hypothesis. Hence, we conclude that the
opinions about autonomous colleges are dependent on the
class-groupings.

You might also like