Relationships between random variables
5.1 THE CHI-SQUARE TEST OF INDEPENDENCE
We will presume for the time being that our investigation concerns only two random variables and that they are of a categorical nature. Generally, variables can be classified as categorical (qualitative) or quantitative (numerical).
• Categorical variables take on values that are names or labels. The colour of a ball (e.g., red, green, blue) or the type of hoist conveyance (e.g., skip, cage, bucket) would be examples of categorical variables.
• Quantitative variables are numerical. They represent a measurable quantity. For example, when we speak about the population of a country, we are talking about the number of peo-ple in the country—a measurable attribute of the country. Therefore, population would be a quantitative variable.
Let us formulate a question as to whether changes in the values of one variable are accom-panied by changes in the values of another variable.
The simplest case is when the investigation concerns independence and when this freedom is confirmed by an appropriate statistical investigation, the investigation is finished. But, when information is obtained during investigation that the random variables are dependent, some questions immediately arise such as: how dependent—strongly or weakly? What is the character of this dependence—linear? Nonlinear? Etc.
A basic test for an investigation into the independence of two categorical random variables is the Pearson’s Chi-squared test of independence. The idea behind the test is as follows.
Book.indb 141
Book.indb 141 12/9/2013 12:25:58 PM12/9/2013 12:25:58 PM
A sample of size n from the population that is being investigated is taken; remark: the sample should be large. The outcomes are classified to create a so-called contingency table (independence table) with w rows and k columns. The interior of the table creates the matrix nij and nij, which means how many times the i-th realisation of the category (feature) X occurs and simultaneously the j-th realisation of the category Y. It is recommended that Λi,j nij≥ 5.
By summing up in rows and columns, we obtain the marginal numbers n
i· and n
Table 5.1 shows the concept of an independence table.
A hypothesis that proclaims the independence of the categories being investigated as expressed by the random variables is formulated as:
H P0 P i PP
H
H : P
{
XX xxii,YYY yyj}
= P{
XX =xi} {
YY yyj}
(5.3)in accordance with the formula (1.10).
In the test the statistic criterion that is being considered is determined as:
χ2
The statistic (5.4) has the asymptotic Chi-squared distribution with (w − 1) (k − 1) degrees of freedom if the verified hypothesis is a true one. The critical region in this test is the right-side test. Presuming the level of significance α and knowing the number of degrees of free-dom, the critical value should be taken from Table 9.4. If the empirical value given by the
Table 5.1. Contingency table.
Feature Y
formula (5.4) is greater than the critical one, the null hypothesis should be rejected. Other-wise, there is no ground to reject the verified hypothesis.
Analysing the merits and demerits of this test more carefully, it is worth noticing that the numbers in the table have a discrete character. This suggests that the probability of the first type of error is underestimated—it is easier to reject the verified hypothesis. Therefore, this is a certain bias of the test. This takes on a special meaning if there is a case when the features have only two categories. Removal of the bias can be done by the introduction of a corrective amendment1, the so-called Yates amendment and the formula (5.4) is:
χ2
At the beginning of the description of the test, the statement was given that the sam-ple should be large. Generally, in mathematical statistics a truism is the statement that it is advantageous if a sample is large. In some national standards, there are recommendations that sample size should have at least 100 elements and marginal numbers—8 elements at least.
Martin (1972) suggested that the Yates amendment should be applied to a four-fold table and also when the sample size does not exceed 60 elements. Siegel and Castellan (1988) made a different suggestion. They recommended not using the test when the sample size is below 20. They also made more suggestions related to the conditions of the application of the test.
In some areas of study in mining engineering, we have no possibility to gather a large sam-ple. In such a case, a different approach should be used. We will now consider the outlook for tables of sizes 2 × 2 and 2 × 3 that are based on Bennet and Nakamura (1963) and Bolshev and Smirnov (1965).
The tables that are the point of interest are presented as:
(A)
Table (A) is constructed in the following way: a sample of size n is taken from the popula-tion being investigated. A property of the sample is that m (m < n) elements of the sample possess a certain feature while the others do not. The sample is divided into two parts of size n1 and n2; n1+ n2= n in a random way. Among the items in the first part (n1), m1 elements have the feature that is of interest. Similarly, among the items of the second part (n2), m2 elements have the feature that is of interest.
Table (B) is constructed based on a similar experiment, where it is necessary to separate the features into three groups.
In order to fulfil the requirements of the test, a 2 × 2 table was constructed in such way that: n1≥ n2 and (m1/n1) ≥ (m2/n2). A 2 × 3 table was constructed in such a manner that:
m1≤ m2≤ m3 and m ≤ n − m. A limitation of this test is the requirement: n1= n2= n3.
1 This amendment is recommended for smaller samples.
Book.indb 143
Book.indb 143 12/9/2013 12:26:01 PM12/9/2013 12:26:01 PM
Denote by Mi; i = 1, 2, 3 the random variables whose realisations are observed in the form of the numbers mi and denote them by:
p E M
i n Mi
i
⎧⎨
⎧⎧
⎩⎨⎨ ⎫
⎬⎫⎫
⎭⎬⎬
the corresponding probability. If the probability of the classification of an element into the i-th part does not depend on whether this element has the feature of interest, then p1= p2 in case (A) and p1= p2= p3 in case (B).
The hypothesis that is verified—considering the 2 × 2 table—proclaims the identity of the probabilities, H0: p1= p2 versus an alternative supposition H1: p1≠ p2. There is also the pos-sibility to verify the null hypothesis when the alternative hypothesis is: H1: p1> p2. If the table is 2 × 3, the verified hypothesis proclaims: H0: p1= p2= p3 versus the alternative hypothesis that rejects it.
The set of tables with the critical values for the test comprise almost 60 pages and for this reason it is not included in this book. Besides, many books that consist of sets of statistical tables include this set.
■ Example 5.1
The durability of the pinions used in some mine machinery was investigated. To improve the reliability of toothed gear transition in which the pinions operate a high level of performance was established, which expressed by the number of hours of work that the pinions should operate without any failure.
During the reliability investigation 21 pinions from the first producer and 19 pinions pro-duced by a second producer were tested. As a result of the investigation, it was observed that 11 pinions from the first producer and only 3 pinions from the second producer fulfilled the requirement.
However, a statistical hypothesis was formulated, which stated that the durability of pin-ions manufactured by the second producer was the same as the durability of pinpin-ions manu-factured by the first producer.
The outcomes of the investigation are presented in the table below.
Producer
first second Σ
Result positive 11 3 14
negative 10 16 26
Σ 21 19 40
Presume the level of significance α = 0.025. Using the appropriate statistical table (see for instance Zieliński 1972), we get the critical value m2(21; 19; 11; 0.025) = 3. Due to the fact that
Book.indb 144
Book.indb 144 12/9/2013 12:26:02 PM12/9/2013 12:26:02 PM
the empirical value m2= 3 is not greater than the critical value, there is the ground to reject the verified hypothesis provided that the random variables are arranged monotonically in the same way. However, both values are the same, and this fact may generate some doubts where the reasoning is concerned.
Note some further problems connected with this investigation:
1. By presuming a slightly different level of significance, a different result of the statistical reasoning can be obtained; e.g. for α = 0.05 the critical value is m2= 4
2. The alternative hypothesis can be formulated otherwise suspecting that the durability of the pinions from the second producer is worse. Readers can check such an approach for
themselves. ◀