Professional Documents
Culture Documents
CHI-SQUARE TEST
By
GAURANG RAMI
grami@rediffmail.com
Chisquare testTest:
( oi ei )2
c =
i = 1
ei
k
k - 1
where,
oi = observed (actual) frequency
ei = expected (theoretical ) frequency
k = number of categories
k-1 = degrees of freedom
Two uses:
(1) Testing Goodness of Fit
i.e. how well a theoretical distribution fits the observed data.
Here,
Ho: sample data are consistent with the theoretical distribution
H1: sample data are not consistent with the theoretical distribution
Example:
The data on demand of a commodity on various days of a week are as follows:
Test the hypothesis that demand does not depend upon the day of the week.
Day:
Demand:
124
125
110
120
126
115
Ho: Demand does not depend upon the day of the week.
H1: Demand does depend upon the day of the week.
If Ho is correct, demand on each day = Total demand / 6 = 120
k
( oi ei )2
c =
i = 1
ei
= (124 120)2 / 120 + ------- + (115-120)2 / 120
= 1.683
As the table values are 11.07 and 15.09 at 5 % and 1 % levels
respectively,
Ho is not rejected
Demand does not depend upon day of the week.
(2) Test of independence
Suppose we have a two way classification according to two different
attributes (Qualitative variables) as follows:
Attribute B
Present
Absent
Total
Attribute A
Present
Absent
a
b
c
d
a+c
b+d
Total
a+b
c+d
n = a+b+c+d
Smokers
Non-smokers
Total
Suppose
Suffer from
cancer
O1 = 30
O3 = 20
50
Do no suffer
from cancer
O2 = 70
O4 = 180
250
Total
100
200
300
= 83 = e2--------
Then.
4
( oi ei )2
c =
i = 1
ei