0% found this document useful (0 votes)
20 views16 pages

Aui Sta201&203 Lecture8

Statistics

Uploaded by

daniellaokeze10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views16 pages

Aui Sta201&203 Lecture8

Statistics

Uploaded by

daniellaokeze10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Introduction: Chi-square Tests Contingency Table Worked Examples Goodness of Fit Tests General Assignment Appreciation

CONTINGENCY TABLE AND MEASURE OF


GOODNESS-OF-FIT OF A TEST
STA201: Statistics for Agricultural & Biological Sciences
STA203: Statistics for Physical Sciences & Engineering

Dr ADENIRAN, Adefemi T.
N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan)

Department of Statistics, Faculty of Science, University of Ibadan

1st November, 2024 1/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

Table of Contents

1 Introduction: Chi-square Tests

2 Contingency Table

3 Worked Examples

4 Goodness of Fit Tests

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

Introduction to Chi-square Test

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.

Definition: Chi-Squared Test


Chi-square is referred to as a measure of the discrepancy existing between observed and expected
frequency. Also, it is a special test which is designed to investigate the agreement of a set of
observed frequency expected on assumption of a theoretical model for the phenomenon being
studied.
Mathematically, the chi-squared test statistic can be computed from

χ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

Worked Examples Contd.

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.

Table 2: Hereditary and handedness

Number of Parents Left-Handed


0(None) 1(One) 2(Two)
Handedness Left 8 10 12
Right 178 21 21
Source: Department of Mathematical Sciences, Augustine University, First Semester 2017/2018 B.Sc. Degree Examination, STA 201
Statistics for Agricultural and Biological Sciences

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

Worked Examples Contd.

Table 3: Hereditary and handedness

Number of Parents Left-Handed


0(None) 1(One) 2(Two) Total
Children Handedness Left 8 10 12 30
Right 178 21 21 220
Total 186 31 33 250

Hypotheses to be tested are;


Ho : There is no association between parent(s) left-handedness and their children
being left-handedness. That is, left handedness is not hereditary.
H1 : There is association between parent(s) left-handedness and their children
being left-handedness. That is, left handedness is hereditary.

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

Worked Examples Contd.

Table 4: Computational Procedure


(Oi −Ei )2
Oi Ei (Oi − Ei ) (Oi − Ei )2 Ei
8 22.32 -14.32 205.0624 9.187384
10 3.72 6.28 39.4384 10.601720
12 3.96 8.04 64.6416 16.323636
178 163.68 14.32 205.0624 1.252825
21 27.28 -6.28 39.4384 1.445689
21 29.04 -8.04 64.6416 2.225980
Total 41.0372

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

Goodness of Fit Tests

The goodness-of-fit test is simply a different use of Pearsonian chi-square.


It is used to test whether or not an observed distribution conforms to any
other distribution, such as one based on theory. For example
if the observed distribution is not significantly different from a normal
distribution
or one based on some other known distribution (if the observed distribution
is not significantly different from a known national distribution based on
census data).

On several occasions, a decision-maker needs to understand whether an


actual sample distribution matches or coincides with a known theoretical
probability distribution such as Binomial, Poisson, Normal, and so on.

The χ2 test for goodness-of-fit enables us to determine the extent to


which theoretical probability distributions coincide with empirical sample
distribution.
For example Ho : X is uniformly distributed versus H1 : X not uniformly
distributed
8/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

Worked Examples on Goodness-of-fits Test I

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:

Number of insects alive (x) 0 1 2 3 4 5 6 7 8 9 Total


Number of jars (f) 3 8 11 15 16 14 12 11 9 1 100

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

Solution: The null hypothesis


Ho : The distribution of the number of living insect after fumigant has been applied to each each jar fo
Ha : The distribution of the number of living insect after fumigant has been applied to each each jar is
we need to estimate the mean and it is
3(0) + 8(1) + 11(2) + 15(3) + 16(4) + 14(5) + 12(6) + 11(7) + 9(8) + 1(9)
p̂ =
20(100)
439
= = 0.2195
2000
Fill in the values in the following table. In practice, this test should be used only if each value of fi
is no less than 5. To meet this requirement, we normally combined into one cell the number of jars
having < 5 living-insects.
9/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

Worked Examples on Goodness-of-fits Test II

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

Worked Examples on Goodness-of-fits Test III

(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

Use the value in the table to compute


m
(fi − ei )2
χ2computed = ∑ ei
= 19.255
i =1
11/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

Worked Examples on Goodness-of-fits Test IV

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

General Assignment for STA201

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

Type of Habi- Prey species


tat
Wildebeest Zebra Thomson’s
gazette
Plains 73 42 5
Woodland 99 71 21
Mixed/riverine 112 83 232
(Seronera re-
gion)

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

General Assignment for STA203

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:

Days of the Week Mon. Tue. Wed. Thus. Fri.


Number of calls 15 20 25 15 10

(a) Is the company’s claim refuted by the data at α = 0.05?


(b) What assumption were made in the the test for part a?
Source: Discovery Statistics, Second edition by James Hawkes, Exercise Set B: Section 15.2, question1, page703

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

Comments, Contributions and Questions

16/16

©
Dr ADENIRAN, Adefemi T. N.D. Math&Stat. (Yaba), B.Sc., M.Sc., PhD Statistics (Ibadan) AUI
COPYRIGHT elderadeniran@yahoo.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy