Unit 12
Unit 12
Sampling
UNIT 12 CHI-SQUARE TESTS
Distributions
Objectives
By the time you have successfully completed this unit, you should be able to:
• appreciate the role of the chi-square distribution in testing of hypotheses
• design and conduct tests concerning the variance of a normal population
• perform tests regarding equality of variances from two normal
populations
• have an intuitive understanding of the concept of the chi-square statistic
• use the chi-square statistic in developing and conducting tests of
goodness of fit and
• tests concerning independence of categorised data.
Structure
12.1 Introduction
12.2 Testing of Population Variance
12.3 Testing of Equality of Two Population Variances
12.4 Testing the Goodness of Fit
12.5 Testing Independence of Categorised Data
12.6 Summary
12.7 Self-assessment Exercises
12.8 Further Readings
12.1 INTRODUCTION
In the previous unit you have studied the meaning of testing of hypothesis
and also how some of these tests concerning the means and the proportions of
one or two populations could be designed and conducted. But in real life, one
is not always concerned with the mean and the proportion alone-nor is one
always interested in only one or two populations. A marketing manager may
want to test if there is any significant difference in the proportion of high
income households where his brand of soap is preferred in North, South,
East, West and Central India. In such a situation, the marketing manager is
interested in testing the equality of proportions among five different
populations: Similarly, a quality control manager may be interested in testing
the variability of a manufacturing process after some major modifications
were carried out on the machinery vis-a-vis the variability before such
modifications. The methods that we are going to introduce and discuss in this
unit will help us in the kind of situations mentioned above as well as in many
other types of situations. Earlier (section 11.6 in the previous unit), while
testing the equality of means of two populations based on small independent
samples, we had assumed that both the populations had the same variance
224
and, if at all, their means alone were different. If required, the equality of Chi-square Tests
225
Sampling and negative values. Also, the expectation and the variance of � � is known in
Sampling terms of its degrees of freedom as below:
Distributions
E[x � ] = v
and var [x � ] = 2v
Finally, if x� , x� … , x� are n random variables from a normal population with
mean � and variance � � and if the sample mean x and the sample variance � �
are defined as
�
��
x� = �
�
���
�
�
(�� − �̅ )�
� = �
�−1
���
(���)��
Then, ��
will have a chi-square distribution with (n -1) degrees of
freedom. Although the distribution of sample variance (� � ) of a random
sample from a normal population is not known explicitly, the distribution of a
(���)��
related random variable viz ��
is known and is used.
226
evidence against it, the null hypothesis cannot be rejected and so the Chi-square Tests
The observed value of � � has been 0.32. So, the observed value of � � has
been
(� − 1)� � (9 − 1) × 0.32
=
�� 0.25
= 10.24
227
Sampling and As this is smaller than the cut-off value of 15.507, we conclude that we do
Sampling not have sufficient evidence to reject the null hypothesis and so we accept the
Distributions
shipment.
It should be obvious that we can use � � as the test statistic in place of
(���)� ��
��
. If we were to use � � as the test statistic then, as before, we can reject
the null hypothesis only when
(n − 1)s �
⩾ 15.507, when � � = 0.25
��
(���)��
i.e. �.��
⩾ 15.507
�.��
i.e.� � ⩾ 15.507 × �
or � � ⩾ 0.485
As our observed value of � � is only 0.32, we come to the same conclusion
that the sample evidence is not strong enough for us to reject Ho.
Two-Tailed Tests of Variance
We have earlier used both one-tailed and two-tailed tests while discussing
tests concerning population means and proportions. Similarly, depending on
the situation, one may have to use a two-tailed test while testing for
population variance.
The surface hardness of composite metal sheets is known to have a variance
of 0.40. For a shipment just received, the sample variance from a random
sample of nine sheets worked out to 0.22. Is it right to conclude that this
shipment has a variance different from 0.40, if the significance level used is
0.05?
We start by stating our null and alternative hypotheses as below.
H� : � � = 0.40
H� : � � ≠ 0.40
(���)��
We shall again use ��
as our test statistic which will have a chi-square
distribution with (n -1) degrees of freedom, assessing the surface hardness of
individual sheets followed a normal distribution.
Now, we shall reject the null hypothesis if the observed value of the test
statistic is too small or too large. As the significance level of the test is 0.05,
the probability of rejecting Ho when Ho is true is 0.05. Splitting this
probability into two equal halves, we again have two critical regions each
with an equal area as shown in Figure III below.
228
Figure III: Acceptance and rejection regions for a two-tailed Test of Variance Chi-square Tests
As this value falls in the acceptance region of Figure III, the null hypothesis
cannot be rejected and so we conclude that at a significance level of 0.05,
there is not enough evidence to say that the variance of the shipment just
received is different from 0.40.
Activity A
A psychologist is aware that the variability of attention-spans of five-year-
olds can be minimised by σ2 = 49 (�������)�. While studying the attention-
spans of 19 four-year- olds, it was found that S � = 30 (minutes)� .
a) If you want to test whether the variability of attention-spans of the four-
year-olds is different from that of the five-year-olds, what would be your
null and alternative hypotheses?
……………………………………………………………………………
……………………………………………………………………………
……………………………………………………………………………
……………………………………………………………………………
……………………………………………………………………………
b) On the other hand, if you believe that the variability of attention-spans of
the four-year-olds is not smaller than that of the five-year-olds, what
would be your null and alternative hypotheses?
229
Sampling and c) What test statistic would you choose for each of the above situations and
Sampling what is the distribution of the test statistic that can be used to define the
Distributions
critical region?
Activity B
For each of the folio wing situations, show the critical regions symbolically
on the chi-square distributions shown alongside:
a) H� : � � ⩽ 0.5
�� : � � > 0.5
b) �� : � � = 0.5
�� : � � ≠ 0.5
c) H� : ��� ⩾ 0.5
H� : ��� < 0.5
230
and the second parameter refers to the degrees of freedom of the denominator Chi-square Tests
231
Sampling and Actually, we are interested in the distribution of the test statistic to define the
Sampling critical region. The probability of type I error should not exceed the
Distributions
significance level, �. This probability is the highest at the breakpoint between
Ho and �� , i.e. when ��� = ��� in this case.
(�� ��)���
Now, if both the populations are normal, then ���
has a chi-square
(�� ��)���
distribution with (n� − 1) degrees of freedom, and ���
has a chi-square
distribution with (n� − 1) degrees of freedom. These two samples can also
be assumed to be independent and so
(�� ��)���
���
/(�� − 1)
(�� ��)���
���
/(�� − 1)
Figure V: Acceptance and Rejection Regions for a One-tailed Test of Equality of variance
��
The observed value of ��� = 27.5/11.2 = 2.455
�
section 15.6 of the previous unit with some slightly different figures. Here the
marketing manager wanted to know if display at point of purchase helped in
increasing sales. He picked up 13 retail shops with no display and found that
the weekly sale in these shops had a mean of Rs. 6,000 and a standard
deviation of Rs. 1004. Similarly, he picked up a second sample of 11 retail
shops with display at point of purchase and found that the weekly sale in
these shops had a mean of Rs. 6500 and a standard deviation of Rs. 1,200. If
he knew that the weekly sale in shops followed normal distributions, could he
reasonably assume that the variances of weekly sale in shops with and
without display were equal, if he used a significance level of 0.10?
In section 15.1 we developed a test procedure based on the assumption that
�� = �� . Now we are interested in testing if that assumption is sustainable or
not. We take the position that unless and until the evidence from the samples
is strongly to the contrary we would believe that the two populations-viz. of
shops without display and of shops with display-have equal variances. If we
use the subscript 1 to refer to the former population and subscript 2 for the
latter, then it follows that
H� : ; ��� = ���
H� : ; ��� ≠ ���
��
We shall again use ��� as the test statistic, which follows an F distribution with
�
�� (n� − 1) and (n� − 1) degrees of freedom, if the null hypothesis is true.
This being a two¬tailed test, the critical region is split into two parts and as
shown in Figure VI below, the upper cut-off point can be easily read off from
the F tables as 2.91.
Figure VI: Acceptance and Rejection Regions for a Two-tailed Test of
Equality of Variances
The lower cut-off point has been shown as K in Figure VI above and its value
cannot be read off directly because the left tails of F distributions are not
generally tabulated. However we know that K is such that
���
Pr � ⩽ �� = .05
���
233
Sampling and ��
i.e.Pr ���� ⩾ 1/�� = .05
Sampling �
Distributions
���
Now, ���
will also have a F distribution with (n� − 1) and (n� − 1) degrees of
freedom and so the value of 1/K can be easily looked up from the right tail of
this 'distribution. As can be seen from Figure VII below, 1/K is equal to 2.75
and so K =1/2.75 = 0.363.
Figure VII: The distribution of ��� /���
���
Hence, the lower cut-off point for ���
is 0.363: In other words, if the
significance level is 0.10, the value of should lie between 0.363 and 2.91 for
��� �����
us to accept Ho. As the observed value of ���
= ����� = 0.700 which lies in
the acceptance region, we accept the null hypothesis that variance from both
populations are equal.
Activity C
From a sample of 16 observations, we find S�� = 3.52 and from another
sample of 13 observations, we find S�� = 4.69. Under the assumption that
��� = ��� , we find the following probabilities
���
Pr �− ⩾ 2.62� = .05
���
��
and Pr ���� ⩾ 2.48� = .05
�
a) �� : ��� ⩾ ���
H� : ��� < ���
234
Chi-square Tests
b) H� : ��� = ���
H� : ��� ≠ ���
c) H� : ��� ⩽ ���
H� : ��� > ���
235
Sampling and It is easy to see that when there are only two categories (i.e. k = 2), we will
Sampling approximately have a chi-square distribution. In such a case p� + p� = 1 and
Distributions
so
(�� ���� )� (�� ���� )�
χ2 = ���
+ ���
(n� − np� )� ⋅ p� + (n� − np� )� ⋅ p�
=
np� p�
(�� − ��� ) ⋅ �� + [(� − �� ) − �(1 − �� )]� ⋅ ��
�
=
��� (1 − �� )
(n� − np� ) ⋅ P� + (−n� + np� )� ⋅ p�
�
=
np� (1 − p� )
(�� − ��� )�
=
��� (1 − �� )
But from our earlier discussion of the normal approximation to the binomial
�� ����
distribution, we know that when n is large, (��� )
has a standard normal
���� �
distribution and so � � above will have a chi-square distribution with one
degree of freedom.
In general, when the number of categories is K, � � has a chi-square
distribution with (k - 1) degrees of freedom. One degree of freedom is lost
because of one linear constraint on the �� 's, viz.
n� + n� + ⋯ + n� = n
The � � statistic would approximately have a chi-square distribution when n is
sufficiently large so that for each i, np� is at least 5-i.e. the expected
frequency in each category is at least equal to 5.
Using a different set of symbols, if we write O� or the observed frequency in
category i and Ei for the expected frequency in the same category, then the
chi-square statistic and also be computed as
�
�
(�� − �� )�
� = �
��
���
In the above table, the expected frequencies E have been calculated as ���
where n, the total frequency is 50 and each �� is 0.25 under the null
(�� ��� )�
hypothesis. Now, if the null hypothesis is true, ∑���� ��
will have a chi-
square distribution with (k -1), i.e. (4 - 1) = 3 degrees of freedom and so if we
want a significance level of .05,then as shown in Figure VIII below, the cut-
off value of the chi-square statistic should be 7.815.
Figure VIII: Acceptance and Rejection Regions for a .05 significance level Test
237
Sampling and Therefore, we can reject the null hypothesis only when the observed value of
Sampling the chi¬square statistic is at least 7.815. As the observed value of the chi-
Distributions
square statistic is only 3.28, we cannot reject the null hypothesis.
Using the concepts developed so far, it is not difficult to see how a test
procedure can be developed and used to test if the data observed came from
any known distribution. The degrees of freedom for the chi-square statistic
would be equal to the number of categories (k) minus 1 minus the number of
independent parameters of the distribution estimated from the data itself.
If we want to test whether it is reasonable to assume that an observed sample
came from a normal population, we may have to estimate the mean and the
variance of the normal distribution first, We would categorise the observed
data into an appropriate number of classes and for each class we would then
calculate the probability that the random variable belonged to this class, if the
population distribution were normal. Then, we would repeat the
computations as shown in this section-viz. calculating the expected frequency
in each class. Finally, the value of chi-square statistic would have (k - 3)
degree of freedom since two parameters (the mean and the variance) of the
population were estimated from the sample.
Activity E
From the following data, test if it is reasonable to assume that the population
has a distribution with p� = 0.2, p� = 0.3 and p� = 0.5. Use α = .05.
Category of Preference
Income Strongly Moderately Indifferent Do not Total
Level Prefer Prefer Prefer
High 15 (26.60) 35 (33.32) 21 (16.52) 27 (21.56) 98
Medium 48 (29.31) 18 (36.72) 20 (18.21) 22 (23.76) 108
Low 32 (39.09) 66 (48.96) 18 (24.27) 28 (31.68) 144
Total 95 119 59 77 350
Let �� = marginal probability for the � �� row, i = 1, 2,…, r where r is the total
number of rows. In this case �� would mean the probability that randomly
selected consumer would belong to the � �� income level.
P = marginal probability for the jth column, j = 1, 2, ... c, where c is the total
number of columns. In this case �� would mean that the probability that a
randomly selected consumer would belong to the � �� preference category.
and ��� = Joint probability for the � �� row and the j�� column. In this case ���
would refer to the probability that a randomly selected consumer belongs to
the � �� income level and the � �� preference category.
Now we can state our null and the alternative hypotheses as follows:
Ho: the criteria for column classification is independent of the criteria for row
classification.
In this case, this would mean that the preference for our brand is not
independent of the income level of the consumers.
H� : the criteria for column classification is not independent of the criteria for
row classification.
If the row and the column classifications are independent of each other, then
it would follow that ��� = �� × ��
This can be used to state our null and the alternative hypotheses:
�� : ��� = �� × �.� for � = 1,2, … , � and � = 1,2, … , �
�� : ��� ≠ �� × �.� for � = 1,2, … , � and � = 1,2, … , �
Now we know how the test has to be developed. If �� and p� are known, we
can find the probability and consequently the expected frequency in each of 239
Sampling and the (r x c) cells of our contingency table and from the observed and the
Sampling expected frequencies, compute the chi-square statistic to conduct the test.
Distributions
However, since the �� 's and �� 's are known, we have to estimate these from
the data itself.
If �� = row total for the � �� row
�� = column total for the j�� column
and if the observed frequency in the � �� and column is referred to as O�� then
the chi¬square statistic can be computed as
� � �
���� − ��� �
�� = � �
���
��� ���
This statistic will have a chi-square distribution with the degrees of freedom
given by the total number of categories or cells (i.e. r x c) minus 1 minus the
number of independent parameters estimated from the data. We have
estimated r marginal row probabilities out of which (r - 1) have been
independent, since
�� + �� + ⋯ + �� = 1
Similarly, we have estimated c marginal column probabilities out of which (c
- 1) have been independent, since
�� + �� + ⋯ … … + +�� = 1
and so, the degrees of freedom for the chi-square statistic
= �� − 1 − (� − 1) − (� − 1)
= (� − 1)(� − 1)
Coming back to the problem at hand, the chi-square statistic computed as will
have (3-1) (4-1) i.e. 6 degrees of freedom and so by referring to the Figure IX
below, we can say that we would reject the null hypothesis at a significance
level of 0.05, if the computed value of � � above is greater than or equal to
12.592.
240
Figure IX: Rejection region for a test using the Chi-square statistics Chi-square Tests
Now, the only task is to compute the value of the chi-square statistic. For
this, we first find the expected frequency in each cell using the relationship.
�� × ��
��� =
�
For example, when i = 1 and j = 1, we find
98 × 95
F�� = = 26.60
350
These values have also been recorded in Table 2 in parentheses and so the
chi-square statistic is computed as
(15 − 26.60)� (35 − 33.32)� (21 − 16.52)� (27 − 21.56)�
�� = + + +
26.60 33.32 16.52 21.56
(48 − 29.31)� (18 − 36.72)� (20 − 18.21)� (22 − 23.76)�
+ + + +
29.31 36.72 18.21 23.76
(32 − 39.09)� (66 − 48.96)� (18 − 24.27)� (28 − 31.68)�
+ + +
39.09 48.96 24.27 31.68
= 5.059 + 0.085 + 1.215 + 1.373 + 11.918 + 9.544 + 0.176 + 0.130
+ 1.286
+5.930 + 1.620 + 0.427
= 38.763
As the computed value of the chi-square statistic is much above the cut-off
value of 12.592, we reject the null hypotheses at a significance level of 0.05
and conclude that the income level and preference for our brand are not
independent.
Whenever we are using the chi-square statistic we must make sure that there
are enough observations so that the expected frequency in any cell is not less
than 5; if not, we may have to combine rows or columns to raise the expected
frequency in each cell to at least 5.
12.6 SUMMARY
In this unit we have looked at some situations where we can develop tests
based on the chi-square distribution. We started by testing the variance of a 241
Sampling and (���)��
normal population where the test statistic used was ��
since the
Sampling
�
Distributions distribution of the sample variance � was not known directly. We found that
such tests could be one-tailed depending on our null and the alternative
hypotheses.
We then developed a procedure for testing the equality of variances of two
normal populations. The test statistic used in this case was the ratio of the
two sample variances are this was found to have a F distribution under the
null hypothesis. This procedure enabled us to test the assumption made while
we developed a test procedure for testing the equality of two population
means based on a small independent samples in the previous unit.
We then described a multinomial experiment and found that if we have data
that classify observations into k different categories and if the conditions for
the multinomial experiment are satisfied then a test statistic called the chi-
(�� ��� )�
square statistic defined as � � = ∑���� ��
will have a chi-square
distribution with specified degrees of freedom. Here, O� refers to the
observed frequency of the � �� category and E� to the expected frequency of
the � �� category and the degree of freedom is equal to the number of
categories minus 1 minus the number of independent parameters estimated
from the data to calculate the E's. This concept was used to develop tests
concerning the goodness of fit of the observed data to any hypothesised
distribution and also to test if two criteria for classification are independent or
not.
1
Taken from Table IV of Fisher and Yates, Statistical Tables for Biological, Agricultural
and Medical Research, published by Longman Group Ltd., London (previously published by
Oliver & Boyd, Edinburgh and by premission of the authors and publishers.
244
Degrees of 99 0.975 0.95 0.90 0.800 Chi-square Tests
freedom
1 0.00016 0.00098 0.00398 0.0158 0.642
2 0.0201 0.0506 0.103 0.211 0.446
3 0.115 0.216 0.352 0.584 1.005
4 0.297 0.484 0.711 1.064 1.649
5 0.554 0.831 1.145 1.610 2.343
6 0.872 1.237 1.635 2.204 3.070
7 1.239 1.690 2.167 2.833 3.822
8 1.646 2.180 2.733 3.490 4.594
9 2.088 2.700 3.325 4.168 5.380
10 2.558 3.247 3.940 4.865 6.179
12 3.571 4.404 5.228 6.304 7.807
13 4.107 5.009 5.892 7.042 8.634
14 4.660 5.629 6.571 7.790 9.467
15 5.229 6.262 7.261 8.547 10.307
16 5.812 6.908 7.962 9.312 11.152
17 6.408 7.564 8.672 10.085 12.002
18 7.015 8.231 9.390 10.865 12.587
19 7.633 8.907 10.117 11.851 13.716
20 8.260 9.591 10.851 12.443 14.578
21 8.897 10.283 11.591 13.240 15.445
22 9.542 10.982 12.338 14.041 16.314
23 10.196 11.889 13.091 14.848 17.187
24 10.856 12.401 13.848 15.658 18.062
25 11.524 13.120 14.611 16.473 18.940
26 12.198 13.844 15.879 17.292 19.820
27 12.879 14.573 16.151 18.114 20.703
28 13.565 15.308 16.928 18.939 21.588
29 14.256 16.047 17.708 19.768 22.475
30 14.953 16.791 18.493 20.599 23.364
* Taken from Table IV of Fisher and Yates, Statistical Tables for Biological, Agricultural
and Medical Rsearch, Published by Longman Group Ltd., London (previously published by
Oliver & Boyd, Edinburgh and by permission of the authors and publishers.
0.20 .10 .05 0.025 .01 Degrees of
freedom
1.642 2.706 3.841 5.024 6.635 1
3.219 4.605 5.991 7.378 9.210 2
4.642 6.251 7.815 9.48 11.345 3
5.989 7.779 9.488 11.143 13.277 4
7.289 9.236 11.070 12.833 15.086 5
8.558 10.645 12.592 14.449 16.812 6
9.803 12.017 14.067 16.013 18.475 7
11.030 13.362 15.507 17.535 20.090 8
12.242 14.684 16.919 19.023 21.666 9
13.442 15.987 18.307 20.483 23.209 10
14.631 17.275 19.675 21.920 24.725 11
15.812 18.549 21.026 23.337 26.217 12
16.985 19812 22.362 24.736 27.688 13
18.151 21.064 23.685 26.119 29.141 14
19.311 22.307 24.996 27.488 30.578 15
20.465 23.542 26.296 28.845 32.000 16
21.615 24.769 27.587 30.191 33.409 17
22.760 25.989 28.869 31.526 34.805 18
23.900 27.204 30.144 32.852 36.191 19
25.038 28.412 31.410 34.170 37.566 20 245
Sampling and 26.171 29.615 32.671 35.479 38.932 21
Sampling 27.301 30.813 33.924 36.781 40.289 22
Distributions 28.429 32.007 35.172 38.076 41.638 23
29.553 33.196 36.415 39.364 42.980 24
30.675 34.382 37.652 40.647 44.314 25
31.795 35.563 38.885 41.923 45.642 26
32.912 36.741 40.113 43.194 46.963 27
34.027 37.916 41.337 44.461 48.278 28
35.139 39.087 42.557 45.722 49.588 29
36.250 40.256 43.773 46.979 50.892 30
APPENDIX TABLE 6
Values of F for F Distributions with .05 of the Area in the Right Tail2
Value for F for Distribution with .01 of the Area in the Right Tai
2
Source: M. Mervin'ton and C.M. Thompson, Riontetrika, vol. 33 (1943).
246
Chi-square Tests
247