Chi-Square Test
Dr. R. MUTHUKRISHNAVENI
SAIVA BHANU KSHATRIYA COLLEGE
ARUPPUKOTTAI
Chi-Square Test
 The Chi- square (c2) test (Chi-pronounced as ki) is one
of the simplest and most widely used non-parametric
tests in statistical work. The c2 test was first used by
Karl Pearson in the year 1900. The quantity c2
describes the magnitude of the discrepancy between
theory and observation.
Chi-Square Test
 It is defined as c2 =
(𝑂−𝐸)2
𝐸
 O – Observed Frequency (is given in Problem)
 E – Expected Frequency ( is computed with following
formula
 E =
𝑅𝑜𝑤 𝑇𝑜𝑡𝑎𝑙 𝑥 𝐶𝑜𝑙𝑢𝑚𝑛 𝑇𝑜𝑡𝑎𝑙
𝐺𝑟𝑎𝑛𝑡 𝑇𝑜𝑡𝑎𝑙
Use of Chi-square test
 Test of independence
 Testing whether two or more attribute are associated or not
 Ex. Quinine (drug) is effective in controlling fever or not
 Test of goodness of fit
 Testing Whether the theoretical distributions (Binomial, Poisson, Normal, etc)
empirically fit or not
 Ex. Tossed coin is bias or not
 Test of homogeneity
 Testing whether two or more independent random sample are drawn from the same
population or not.
Test of independence - Procedure
 Frame the hypothesis - Either null (H0)or alternate hypothesis(H1)
 Apply the Chi-square c2 =
(𝑂−𝐸)2
𝐸
 Get calculated value of chi-square
 Test the hypothesis using degrees of freedom (d.f. =(R – 1) (C-1) R – No. of
Row C – No.of Column)and find the table value at 1% or 5% level of
significance
 Inference
 If Calculated value is less than table value, the Null hypothesis will be accepted
and alternate hypothesis will be rejected
 If Calculated value is more than table value, the Null hypothesis will be rejected
and alternate hypothesis will be accepted
Test of independence –Example 1
 In an anti-malarial campaign in a certain area, quinine was administered to
812 persons out of a total population of 3248. The number of fever cases in
shown below
 Discuss the usefulness of quinine in checking malaria at 5% level of
significance. (d.f. = 1 table value of chi- square =3.84)
Treatment Fever No fever Total
Quinine 20 792 812
No Quinine 220 2216 2436
Total 240 3008 3248
Test of independence –Solution
 Hypothesis: H0: The quinine is not effective in checking malaria (H1: The
quinine is effective in checking malaria) applying chi-square test
 c2 =
(𝑂−𝐸)2
𝐸
O E
20 792 812
220 2216 2436
240 3008 3248
60 752 812
180 2256 2436
240 3008 3248
 Expected frequency =
𝑅𝑇 𝑥 𝐶𝑇
𝐺𝑇
 E1=
812 𝑥 240
3248
=60
 E2=
2436 𝑥 240
3248
= 180
 E3 =
812 𝑥 3008
3248
= 752
 E4 =
2436 𝑥 3008
3248
= 2256
60 752 812
180 2256 2436
240 3008 3248
O E O-E (𝑶 − 𝑬) 𝟐
(𝑶 − 𝑬) 𝟐
𝑬
20 60 -40 1600 26.67
220 180 -40 1600 8.89
792 752 +40 1600 2.13
2216 2256 +40 1600 0.71
0 (𝑶 − 𝑬) 𝟐
𝑬
38.39
 d.f = (R-1)(C-1) = (2-1)(2-1) = 1 x1 =1
 Table value of Chi-square(referring c2 table) = 3.84
 Calculate value of c2 = 38.89
 Calculated Value(38.39) is more than Table Value(3.84)
 Therefore Null hypothesis is rejected and alternate hypothesis is accepted
 Inference
 The Quinine is effective in checking malaria

Chi square test

  • 1.
    Chi-Square Test Dr. R.MUTHUKRISHNAVENI SAIVA BHANU KSHATRIYA COLLEGE ARUPPUKOTTAI
  • 2.
    Chi-Square Test  TheChi- square (c2) test (Chi-pronounced as ki) is one of the simplest and most widely used non-parametric tests in statistical work. The c2 test was first used by Karl Pearson in the year 1900. The quantity c2 describes the magnitude of the discrepancy between theory and observation.
  • 3.
    Chi-Square Test  Itis defined as c2 = (𝑂−𝐸)2 𝐸  O – Observed Frequency (is given in Problem)  E – Expected Frequency ( is computed with following formula  E = 𝑅𝑜𝑤 𝑇𝑜𝑡𝑎𝑙 𝑥 𝐶𝑜𝑙𝑢𝑚𝑛 𝑇𝑜𝑡𝑎𝑙 𝐺𝑟𝑎𝑛𝑡 𝑇𝑜𝑡𝑎𝑙
  • 4.
    Use of Chi-squaretest  Test of independence  Testing whether two or more attribute are associated or not  Ex. Quinine (drug) is effective in controlling fever or not  Test of goodness of fit  Testing Whether the theoretical distributions (Binomial, Poisson, Normal, etc) empirically fit or not  Ex. Tossed coin is bias or not  Test of homogeneity  Testing whether two or more independent random sample are drawn from the same population or not.
  • 5.
    Test of independence- Procedure  Frame the hypothesis - Either null (H0)or alternate hypothesis(H1)  Apply the Chi-square c2 = (𝑂−𝐸)2 𝐸  Get calculated value of chi-square  Test the hypothesis using degrees of freedom (d.f. =(R – 1) (C-1) R – No. of Row C – No.of Column)and find the table value at 1% or 5% level of significance  Inference  If Calculated value is less than table value, the Null hypothesis will be accepted and alternate hypothesis will be rejected  If Calculated value is more than table value, the Null hypothesis will be rejected and alternate hypothesis will be accepted
  • 6.
    Test of independence–Example 1  In an anti-malarial campaign in a certain area, quinine was administered to 812 persons out of a total population of 3248. The number of fever cases in shown below  Discuss the usefulness of quinine in checking malaria at 5% level of significance. (d.f. = 1 table value of chi- square =3.84) Treatment Fever No fever Total Quinine 20 792 812 No Quinine 220 2216 2436 Total 240 3008 3248
  • 7.
    Test of independence–Solution  Hypothesis: H0: The quinine is not effective in checking malaria (H1: The quinine is effective in checking malaria) applying chi-square test  c2 = (𝑂−𝐸)2 𝐸 O E 20 792 812 220 2216 2436 240 3008 3248 60 752 812 180 2256 2436 240 3008 3248
  • 8.
     Expected frequency= 𝑅𝑇 𝑥 𝐶𝑇 𝐺𝑇  E1= 812 𝑥 240 3248 =60  E2= 2436 𝑥 240 3248 = 180  E3 = 812 𝑥 3008 3248 = 752  E4 = 2436 𝑥 3008 3248 = 2256 60 752 812 180 2256 2436 240 3008 3248
  • 9.
    O E O-E(𝑶 − 𝑬) 𝟐 (𝑶 − 𝑬) 𝟐 𝑬 20 60 -40 1600 26.67 220 180 -40 1600 8.89 792 752 +40 1600 2.13 2216 2256 +40 1600 0.71 0 (𝑶 − 𝑬) 𝟐 𝑬 38.39
  • 10.
     d.f =(R-1)(C-1) = (2-1)(2-1) = 1 x1 =1  Table value of Chi-square(referring c2 table) = 3.84  Calculate value of c2 = 38.89  Calculated Value(38.39) is more than Table Value(3.84)  Therefore Null hypothesis is rejected and alternate hypothesis is accepted  Inference  The Quinine is effective in checking malaria