Aui Sta201&203 Lecture8
Aui Sta201&203 Lecture8
Dr ADENIRAN, Adefemi T.
N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan)
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Table of Contents
2 Contingency Table
3 Worked Examples
5 General Assignment
6 Appreciation
2/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
The chi-square distribution arises in tests of hypotheses concerning the independence of two
random variables and concerning whether a discrete random variable follows a specified distribution.
χ2 Test-statistic
k
(Oi − Ei )2
χ2calculated = ∑ Ei
(1)
i =1
where,
Oi = observed frequencies, and
Ei = expected frequencies
3/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Contingency Table
Contingency table is a table that shows the frequencies for two or more variables simultaneously. It
is widely used in various disciplines.
(i) Medicine: In a clinical trial, proportion cured under treatments A and B may be compared
with gender of the patients or experimental materials
(ii) Education: academic performance of students may be compared with their geo-political
zone. Ho : There is no association between students academic performance and their
geo-political zones
(iii) Social Sciences: marriage dissolution and religion practices, family planning practices and
the religion of the couples, intelligent quotient of people and place of residence (urban or
rural) and the likes may be compared.
Table 1: A typical example of contingency table
Attribute B Attribute A Total
Present Absent
Present a b a+b
Absent c d c+d
Total a+c b+d N
Each of the entries a, b, c, d are observed values, then the expected value for a particular cell is
computed using the formula
ith Row Total× jth Column Total
Eij = (2)
Overall Total
For example,
(a + b )(a + c )
E11 = 4/16
N
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Example
Is being left-handed hereditary? To answer this question, 250 adults are
randomly selected and their handedness and their parents’ handedness are
noted. The results are summarized in the table provided. Test, at the 1% level
of significance, whether there is sufficient evidence in the data to conclude that
there is a hereditary element in handedness.
5/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
6/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
The test-statistics is
k
(Oi − Ei )2
χ2calculated = ∑ Ei
= 41.0372
i =1
The critical-value is
χ2tabulated = χ2α,v = χ20.05,(r −1)(c −1) = χ20.05,(2−1)(3−1) = χ20.05,2 = 5.991
Decision Rule: Since χ2calculated = 41.0372 > χ2tabulated = 5.991 and consequently fall in the critical
region, we therefore reject Ho .
Conclusion: There is association between the parent’s hand and children being left handed. That
is, left-handed is hereditary. 7/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Example
In a biochemical experiment 20 insects were put each into 100 jars and were subjected to fumigant.
After 3 hours the number of living insects in each jar was counted. The distribution is shown below:
Can this be fitted by a binomial distribution. Source: University of Ibadan, Dept. of Statistics, 2016/2017 P.G.D.S
Second Semester Examination, STA 721: Statistical Method
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
i fi pi Ei
cell number: Observed cell fre- Cell probability un- Expected cell frequency
Number of quency: Observed der Ho : Probabil- under Ho : Expected
living insects number of jars ity of i fires if Ho number of jars with i
with i accidents is true living-insects if Ho is
true.
0 3 0.007038144 0.7038144
1 8 0.039586742 3.9586742
2 11 0.105763298 10.5763298
3 15 0.178462861 17.8462861
4 16 0.213303705 21.3303705
5 14 0.191959670 19.1959670
6 12 0.134962035 13.4962035
7 11 0.075910741 7.5910741
8 9 0.034691111 3.4691111
9 1 0.013008241 1.3008241
Note that observed frequencies less than 5 have been grouped together in the next table to
represent a single category before calculating the test statistic.
10/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
(fi −ei )2
i fi pi Ei ei
cell number: Observed cell fre- Cell probability un- Expected cell frequency
Number of quency: Observed der Ho : Probabil- under Ho : Expected
living insects number of jars ity of i fires if Ho number of jars with i
with i accidents is true living-insects if Ho is
true.
0 11 0.007038144 4.662489 8.614293
1 0.039586742
2 11 0.105763298 10.5763298 0.01697153
3 15 0.178462861 17.8462861 0.45395129
4 16 0.213303705 21.3303705 1.33203730
5 14 0.191959670 19.1959670 1.40644504
6 12 0.134962035 13.4962035 0.16587072
7 11 0.075910741 7.5910741 1.53084734
8 10 0.034691111 4.769935 5.734581
9 0.013008241
Total 19.255
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
where m is the number of cells (or the number of terms in the summation). Therefore,
χ2tabulated = χ2α,m−t −1 = χ20.05,8−1−1 = χ20.05,6 = 12.592
Therefore, we reject the null hypothesis that the distribution is binomial, at the 0.05 level of
significance, because χ2computed = 19.255 ≥ χ2tabulated = 12.592.
12/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Example
Prey animals killed by lions in the Serengeti were classified according to species
and principal habitat where the kill was recorded.
Table 5: Type of habitat and prey species
Test the hypothesis that habitat type is independent of prey species. Source: Schaller,
G.B. (1972) The Serengeti Lion. Chicago: University of Chicago Press, p.434.
13/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Example
A telephone company claims that the service calls which they receive are equally distributed among
the five working days of the week. A survey of 85 randomly selected service calls produced the
following results:
14/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
Appreciation
15/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com
Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation
16/16
©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com