Test of the χ ²

The test of the χ ² (to pronounce “khi-deux” or “khi square”, one also writes with English “chi-deux” or “the chi square”) allows, on the basis of an assumption and of a risk supposed at the beginning, to reject the assumption if the distance between two whole of information is considered to be excessive.

It is particularly used like test of adequacy of a law of probability to a sample of observations presumedly independent and of the same law of probability. A test of homogeneity relates to a nearby problem, the comparison of samples resulting from different populations. In a rather different way, a test of independence relates to qualitative data.

Its use is very widespread in particular in Génétique where it makes it possible to determine, with a given threshold, the validity of an assumption.

Approaches popularized

In sciences, one often tries to represent a phenomenon by the mathematical formula simplest possible - in condition of course which one has of the measurable quantified parameters. One calls this formula “theoretical law”. This makes it possible to compare the phenomena, to predict their tendency… Consequently a fundamental question arises: do the formula that I use represent reality well?

For that, one compares measurements made with the theoretical law.

For example, one wants to represent the stature of the people of male sex, and one formulates the simple law: “the mass is equal to the number of centimetres of size above one meter” (for example, a person of 1,60 m weighs 60 kg). Does this law correspond to reality? For that, one takes several people, one weighs them and one measures them, and one looks at if that corresponds.

But a perfect adequacy is never obtained. It is thus necessary to find a criterion quantitative, which makes it possible to say if the law is appropriate well, fairly well, rather badly or at all with reality.

One can, for example, for a given size, to make the difference between the measured mass and mass it given by the theoretical law, and to make the sum of the differences for all the people. However, in certain cases, the difference will be positive, in other cases it will be negative, and two variations will be able to be compensated. To avoid this problem, one can make the sum of the absolute values of the differences between measured mass and masses theoretical. One generally prefers to minimize the sum of the squares of the differences, which has the same advantages while it is handled more easily, which leads to the Method of least squares at the beginning of the 19th century.

The test of the χ ² originates in a primarily different problem, the comparison of data, not with a physical law, but with a Loi of probability. In 1900, Karl Pearson, a British mathematician, had the idea to divide these square by the awaited values. Thus, a great difference between the theoretical law and real measurement have more importance than several small differences. That gave the test of the χ ² which is a statistical particular case of test of assumption. This one was then extended to other problems.

In certain problems, there are discrete and not continuous quantified values. For example, if one looks at the number of children per family, one has an integer for each family. In this case, one looks at the number of events having the same discrete value, and it is the Fréquence of appearance of a value which constitutes the measure (when the number of possible values is raised, one is generally brought to gather several values in the same class, as for the continuous values, so as to satisfy the rule indicated below).

In other problems, one is satisfied to put the events in a category, called “class”. One finds oneself in the same case as for the discrete values: one looks at the number of events in each class, and it is the Fréquence of occurrence of a class which constitutes the measure.

One of the important problems is to know how much measurements at least it is necessary to make for well comparing the theoretical law with reality. An empirical rule usually used consists in saying that each class must contain at least five events. If one is in lower part, that means that the classes should be gathered, provided that their initial number and the full number of observations is sufficient.

Principle

At the base of a statistical test it there with the formulation of an assumption called assumption zero . In this case, it supposes that all the data considered derive from the same law of probability.

These data having been divided into classes, it is necessary

  • to determine the number of degrees of freedom of the problem starting from the number of classes;

  • to give a risk a priori to be mistaken (the value 5% is often selected but it is more often about a habit than of the result of a reflection);
  • using a table of χ ², to deduce by holding account from the number of degrees of freedom the critical distance which has a probability of going beyond equal at this risk;
  • to calculate the distance algebraically enters the whole of information to compare.

If this distance is higher than the critical distance, it is concluded that the result is not due only to the fluctuations of sampling and that the null assumption must thus be rejected. The risk chosen at the beginning is that to give a false answer when the fluctuations of sampling are alone in question. The rejection is obviously a negative answer in the tests of adequacy and of homogeneity but it brings positive information in the tests of independence. For those, it shows the significant character of the difference, which is interesting in particular in the tests of treatment of a disease.

Possible uses

Test of the χ ² of adequacy

General information

It is a question of judging adequacy between a series of statistical data and a law of probability defined a priori (like a uniform Loi or a Loi of Poisson for example).

concrete Example: Is a given number of rigorously identical cellular cultures. Each one comprises a certain number of colonies. All the cultures are in fact of the cultures of cancer cells and one seeks up to what point to determine the action of a product prevents their division. Precisely one wants to know if the number of colonies whose growth will be stopped by the product follows a law of Poisson of parameter λ.

After having exposed the cells to the product, one obtains precise results: X1 colonies of the first culture were subject to the influence of the product, X2 for the second culture… X N for N - ième culture. One will carry out a test of the χ ² on these values to judge the assumption according to which them distribution follows a law of Poisson.

Description

The purpose of the Statistique mathematics is the description of a population of which one knows only one relatively small number individuals. For that one associates a Loi of probability with this population. Put aside certain problems of fundamental physics and, on the other hand, certain elementary problems (equitable games of chance, for example), this law of probability is in any unknown rigor. The assumption according to which the population follows a law of probability given a priori can be tested by the method described hereafter.

When an element of the population is discovered, this one is regarded as a realization of a Random variable corresponding to the law of selected probability. More generally, a whole of elements is a realization of what is called a random sample .

The known values must be distributed between varied classes . By supposing the independence of the n \, values considered gathered in m \, classes, the manpower of each class i \, are a random variable defined by the Loi multinomiale. The law of probability tested makes it possible to also define for each class the probability p_i \, .

Measured manpower being n_i \, , the quantity \ sum_ {i=1} ^m \ frac {(n_i - N p_i) ^2} {N p_i} represents, in a certain manner, the distance between the data and the law of supposed probability. It is a realization of a random variable which derives from a Loi of the χ ² to (M-1) degrees of freedom. The probability given by the tables of going beyond of the computed value then gives an indication on the realism of the assumption.

It is not very probable that the parameters which characterize the law of probability (average, variance,…) are known at the time of the test. The data are thus used to estimate those, which facilitates the adequacy. It is then necessary to decrease the number by degrees of freedom of the number of parameters estimated.

Choice of the classes

Those must be enough numerous not to lose too much information but, contrary, to satisfy the requirements by the method, they should not be too small. In theory, it would be necessary that manpower are infinite so that the normal law applies but it is generally allowed that one needs 5 elements in each class. This rule was very discussed and that which seems to collect the most votes is due to Cochran: 80% of the classes must satisfy the rule of the five elements while the others must be not vacuums.

The criterion relates to the np_i \, deduced from the distribution of reference and not on the n_i \, of the analyzed data. It is often satisfied without difficulty because, unlike the construction of a Histogramme, it is possible to exploit the width of the classes.

Test of the χ ² of homogeneity

It is then a question of wondering whether two lists of numbers in the same way effective can derive from the same law of probability. The preceding method applies by replacing the term n p_i \, relating to the law of probability by n'_i \, relative to the second list and the \ chi^2 \, is given by \ sum_ {i=1} ^m \ frac {(n_i - n'_i) ^2} {n'_i} .

This notation takes as a starting point that used for the test of adequacy, itself deduced from the traditional notation of the law multinomiale. Here, as in the test of independence, the concept of probability does not appear any more in an explicit way. Many users thus prefer to adopt the notation which uses the symbols O_i \, for the actual values and E_i \, for the hoped values, which leads to the expression \ sum_ {i=1} ^m \ frac {(O_i - E_i) ^2} {E_i} .

Test of the χ ² of independence

Example

Problem

When one considers several populations with which one associates the same set of qualitative criteria, the assumption to be tested is the independence of these populations.

For this problem, it is convenient to start from a concrete example, like the relation between the income and the sex of an individual. Is the distribution of income of the men different from that of the women? A representation on a contingency table of the occurrences of the variables makes it possible to illustrate the question.

In this fictitious example one notices that the women are more numerous in the classes with low wages and fewer in those with high wages than the men. Is this difference (i.e. this dependence between the variables) statistically significant? The test of the χ ² assistance to answer this question.

Preparation

One can note that the total staff complement of each line corresponds to 4-1 = 3 independent variables while that of each column corresponds to 2-1 = 1 independent variable, which leads to 3 X 1 = 3 degrees of freedom.

If one gives oneself a risk to be mistaken equal to 5%, the breaking value found in the tables is 7,81.

Assumption

It is necessary to build the null assumption which, in this case, depends neither on a law of probability, nor of a distribution of reference. It is supposed that there are not a difference between the wages of the men and those of the women, the proportions of the various categories of wages being thus preserved of one line at the other.

The corresponding data are obtained by replacing the value of each cell by the product of the total of its line by the total of its column divided by the grand total. It is checked that the totals are unchanged.

Calculation

The calculation of the χ ² of the data is carried out by replacing the term relative to each cell by the quantity \ frac {(O-E) ^2} E \, indicated for the test of homogeneity and calculated starting from the two preceding tables.

Conclusion

The calculated distance (2,42) being lower than the critical distance (7,81), it is not necessary to blame the equality of wages, with a risk to be mistaken equal to 5%.

It is advisable to recall that this result rests on data chosen arbitrarily which have… little chance to represent an unspecified reality. In addition, if one laid out of a sample 10 times larger without modification of the distribution of population, the χ ² would be multiplied by 10, that is to say (24,2) and one could reject the assumption of equality with less than 5% of risk being mistaken.

In a major way, the classes chosen, unlike what occurred in the tests from adequacy and homogeneity, although presenting a numerical aspect here, could extremely well be associated with qualitative concepts without the reasoning being modified.

Test used

The test used, the Chi-square of Pearson , is interested in the difference between the actual value Oij  (or empirical value) and the awaited value if there were independence Eij  (or theoretical value).

\ chi^2 = \ sum_ {I, J} \ frac {(O_ {ij} - E_ {ij}) ^2} {E_ {ij}}

with
  • Oij  the actual value
  • Eij  the value awaited under the assumption of independence.

One a:

E_ {I, J} = \ frac {O_ {i+} \ times O_ {+j}} {NR}
where
O_ {i+} = \ sum_ {j=1} ^ {J} {O_ {ij}}
and
O_ {+j} = \ sum_ {i=1} ^ {I} {O_ {ij}}

Formulation of the test

H0: p (\ mathrm {has \ course B}) =p (\ mathrm {has}) \ times p (\ mathrm {B}) : the variables are independent.

H1: p (\ mathrm {has \ course B}) \ p (\ mathrm {has}) \ times p (\ mathrm {B}) : the variables are not independent, the difference between actual value and waited is not due randomly).

Distribution of the test

These statistics asymptotically follow a Loi of the χ ² to ( I -1) ( J -1) degrees of freedom, with I the number of methods of the first variable and J the number of methods of the second variable.

Test conditions

Several authors propose criteria to know if a test is valid, to see for example '' The Power off the Categoriel Goodness-Off-FIT Test Statistics '' p. 19 (p. 11 of CH. 2), Michael C. Steele. One in general uses the criterion of Cochran of 1954 according to which all the classes I , J must have a nonnull value theoretical ( E I , J ≥ 1), and that 80% of the classes must have a higher value theoretical or equal to 5:

E I , J ≥ 5
When the number of classes is small, in other words, all the classes must contain a theoretical manpower equal to or higher than 5.

Other values were proposed for minimal theoretical manpower: 5 or 10 for all (Cochran, 1952), 10 (Cramér, 1946) or 20 (Kendall, 1952). In all the cases, these values are arbitrary.

Certain authors proposed criteria based on simulations, for example:

  • effective theoretical superior with 5 R / K for each class, where R is the number of classes having a manpower equal to or higher than 5 and K is the number of categories (Yarnold, 1970);
  • NR ²/ K ≥ 10, where NR is the total staff complement and K is always the number of categories (Koehler and Larntz, 1980). To see more recent recommedations one can look at, for example, P. Greenwood and Mr. Nikulin " With Guide to Chi-Squared Testing" , (1996), John Wiley and Sounds.

Related tests

There exists a very similar asymptotic test, the Test of the report/ratio of probability (likelihood ratio test) , as well as an exact test, the Test of Fisher.

Justification

Independence

Are has and B the two variables which one wishes to test independence.

For recall, if has and B are independent one with the following relation:

p (has \ course B) = p (A) \ times p (B)

or for the function of joint density:
f_ {X, Y} (X, there) = \ f_X (X) \ times f_Y (there)

That is to say here

E_ {ij} = p (\ mathrm {has} = I \ course \ mathrm {B} = J) \ times NR = p (\ mathrm {has} = I) \ times p (\ mathrm {B} = J) \ times NR

Estimate of the awaited values (theoretical)

What is worth p (A= I  ) ?

Starting from the contingency table, one will take simply the sum of all the values where = 1 has, that is to say, in our notation

O 1+
Thus
E_ {ij} = \ frac {O_ {i+}} {NR} \ times \ frac {O_ {+j}} {NR} \ times NR = \ frac {O_ {i+} \ times O_ {+j}} {NR}

Distribution of the test

For the proof that the test follows a law Chi-square, one will give some here that some “tracks”.

If it is supposed that each xij follows a Loi of Poisson, one can show that the standardized values

z_ {ij} = (x_ {ij} - \ bar x_ {ij})/\ sqrt {\ bar x_ {ij}}
follow a normal Loi asymptotically. Then
\ sum_ {I} \ sum_ {J} z_ {ij} ^2
a law Chi-square follows asymptotically to IJ -1 degrees of freedom

As for the degrees of freedom, as one must estimate the \ bar x_ {ij} , one loses ( I -1) + ( J -1) degrees of freedom (and not I + J because \ sum O_ {i+} = \ sum O_ {+j} =1 : the last parameter results from the others). One has with final then the

IJ -1- ( I -1) - ( J -1) = I ( J -1) - ( J -1) = ( I -1) × ( J -1)

Notice

The quantifiable phenomena within a population are subjected to statistical fluctuations. Let us consider for example unemployment rate in a given state, or growth rate.

From one year on the other, of the variations in these rates are systematically recorded (drops or raises) for as much they do not mean in itself, contrary to too spread belief, that the variable considered (growth rate or of unemployment) indeed changed (rigorously that it changed law, i.e. processes set up came to influence its distribution). When a variable is considered, it is necessary to distinguish the causal impact from the random statistical fluctuation. Thus, a fall of the unemployment rate of 2% one year to the other can very well be ascribable only with the randomness of the variable “unemployment rate” and nothing to mean on the causal level. This fall does not mean itself that effective measures influenced the law of distribution of unemployment. Only the statistical tests are known currently to be taken and determine (with a given threshold) if this variation is the fruit of the chance or not. In this respect the tests of the χ ² are exceptionally useful.

See too

External bonds

  • Values tabulées of the χ ²

    • Conservation and sustainable development
    • Academy of Versailles

Random links:Charlotte Perriand | JBIG | Gerard Furrier | Sebastian | Denis Lord | Darmstadt,_Indiana