On this page
Book
22 Cross Tabulation
The cross table, also known as contingency table, has as main objective that one variable is not influenced by the other, however, in many cases this influence occurs. This type of influence can be seen in two ways.
The first is when classificatory variables cause dependence in groups or populations. For this type of influence, we can mention a group of people with psychiatric illnesses, in which they are classified as “delayed activity” and “non-delayed activity” and each group can be classified into three categories, “affective disorder”, “schizophrenia” and “neurosis”. For this type of application we want to test whether the type of activity is influenced by the categories of psychiatric illnesses, that is, we want to test whether the groups are independent in relation to delayed activities or not.
The second is used when we want to know whether the data associated with the categories of one of the variables behaves in a homogeneous or similar way in the different classes or populations defined by the categories of the other classificatory variable. For this type of influence we can mention the effectiveness of a medicine, for this we selected 100 patients, among them 50 are medicated and the other 50 receive a placebo, in this study the present or absent side effects were verified. For these purposes, we can make a classification in different ways, such as whether or not the individual had an improvement in the disease, or whether they had a reaction to the type of medication. In this application, we want to test whether the group of medicated individuals and the group of individuals who used placebo have similar behavior in relation to these side effects, that is, whether the populations are homogeneous.
In general, an r x c cross table is a matrix of natural numbers arranged in r rows and c columns, so we have rc cells for the numbers.
Through cross tables it is possible to classify the members of a population or groups in the most diverse ways, both for the homogeneity test and for the independence test. For example, people can be classified according to their sex, they can be classified as single or married (dichotomous classifications), classified as left-handed, right-handed or ambidextrous, etc. Classification can be done on information from continuous data, we simply need to consider classes of values in that data and then classify them relative to the class to which they belong.
Generally speaking, a crosstab is a representation of data, whether qualitative or quantitative. When we classify in a bivariate way, they can be classified according to two criteria. If we classify according to more than two criteria we are in the multivariate case.
22.1 Introduction to Cross Tables
Cross tables, as previously stated, are used to evaluate the relationship of categories with respect to groups according to two ways, independence or homogeneity. In this section, we will show some constructions of these tables.
The application of 2x2 cross table is given when n randomly selected elements from a population are classified into two categories. After the elements are classified, a treatment is applied and some elements are examined again and classified into the two categories. What we want to know is: Did the treatment significantly change the proportion of objects in each of the two categories?
For example, in table 1.1 we have a sample of 5375 tuberculosis deaths classified according to two qualitative variables, sex and type of tuberculosis that caused death.
| Tuberculosis of the Respiratory System | Other forms of tuberculosis | |
|---|---|---|
| Male | 3534 | 270 |
| Female | 1319 | 252 |
Table 1.1: Deaths from tuberculosis.
This is a 2x2 cross table (the sample members were classified according to two dichotomous criteria), that is, a two-dimensional cross table, as we have two classification criteria. The objective of this example is to verify whether there is dependence or association between the variables sex and the type of tuberculosis that caused death.
As an immediate generalization of the 2 x 2 cross table, we have a cross table with r rows and c columns, called an r x c cross table. This type of table can be used to present data contained in several samples or in a single sample, where each element of the sample can be classified into r different categories according to one criterion or can be classified into one or c different categories at the same time according to a second criterion.
To exemplify tables with more than two classification criteria, we have an application made in a hospital, which we describe in detail in the Homogeneity of populations section. In this hospital, we assessed the level of understanding of a medical record by the different professionals who use it, see table 1.2, we divided the level of understanding of the medical record into the categories Fully, Partially and Didn’t Understand, and we selected seven populations of professionals:
- Nurse;
- Physiotherapist;
- Speech therapist;
- Doctor;
- Nutritionist;
- Psychologist;
- Occupational Therapist.
In this example, we have a multidimensional cross table.

Table 1.2: Understanding the medical record.
This is an rxc cross table, that is, a multidimensional cross table, as we have more than two classification criteria, that is, we have a table with more than 4 cells. The objective of this example is to verify whether the data associated with the categories behave in a similar or homogeneous way in the different classes defined by the categories of the other variable.
The general form of the cross table, in which a sample of n observations is classified relative to two qualitative variables, one with r categories or populations in the case of homogeneity testing and the other with c categories. These are called r x c cross table and the observed frequency or count of the i categories of the row variable and the j categories of the column variable, is represented by $O_{ij}$. The total number of observations in category i of the line variable is ni. and the total number of observations in category j of the column variable is $n_{.j}$. These are called marginal totals and in terms of cell frequencies, $n_{ij}$, are expressed by:
| Category 1 | Category 2 | $ \dots $ | Category c | Total | |
|---|---|---|---|---|---|
| Category 1 | $ O_{11} $ | $ O_{12} $ | $ \dots $ | $ O_{1c} $ | $ n_{1.} $ |
| Category 2 | $ O_{21} $ | $ O_{22} $ | $ \dots $ | $ O_{2c} $ | $ n_{2.} $ |
| $ \vdots $ | $ \vdots $ | $ \vdots $ | $ \ddots $ | $ \vdots $ | $ \vdots $ |
| Category r | $ O_{r1} $ | $ O_{r2} $ | $ \dots $ | $ O_{rc} $ | $ n_{r.} $ |
| Total | $ n_{.1} $ | $ n_{.2} $ | $ \dots $ | $ n_{.c} $ | $ n $ |
in which,
$$n_{i.} = \sum^{c}_{j=1}O_{ij},~~~~~i=1,\dots,r$$
$$n_{.j} = \sum^{r}_{i=1}O_{ij},~~~~~j=1,\dots,c$$
$$n=\sum_{i=1}^{r}\sum^{c}_{j=1}O_{ij} = \sum_{i=1}^{c}n_{i.} = \sum_{j=1}^{r}n_{.j}$$
Next, we present the first test for cross tables, the independence test.
22.2 Independence of classification criteria
The independence test is used when we are interested in testing the degree of dependence or association between classification variables, whose categories do not necessarily identify different classes or subpopulations.
Let us consider two variables R (row) and C (column), with the variable C (column) having c categories and the variable R (row) having r categories.
Given a sample of n observations from a population X, let us consider the vector ($O_{11}, O_{12} … , O_{rc}$) of random variables, with Oij being the number of observations from row i and column j (among the n observations in the sample) classified in category i and category j of variables R (row) and C (column), respectively, i=1,…, r and j=1,…,c.
Se $p_{ij}$ is the probability of an observation being classified into classes i and j, of the variables R (row) and C (column), respectively, with i=1,…,r and j=1,…,c, then the random vector ($O_{11}, O_{12} … , O_{rc}$) has a multinomial distribution, that is:
$$P(O_{11}=o_{11},O_{12}=o_{12},\dots, O_{rc}=o_{rc})=\cfrac{n!}{\displaystyle\prod^r_{i=1}\prod^c_{j=1}o_{ij}!}\displaystyle \prod^r_{i=1}\prod^c_{j=1}p^{o_{ij}}_{ij}\quad {com},\quad\sum^c_{i=1}\sum^r_{j=1}O_{ij}=n$$
The expected frequency of observations classified in category i and category j of variables R (row) and C (column) will be respectively:

22.2.1 Statistical Analysis for the Independence test
The independence of the classification criteria means that there is independence between the variables R (row) and C (column). This independence is expressed probabilistically by the set of following equalities:
Two events R and C are said to be independent if:
$$P(R\cup C) = P(R)\times P(C)$$
Using this analogy we have:

Chi-Square Test for Independence
One of the tests used to detect the existence of an association between line variables $ R $ and the column variables $ C $ in a cross table is the Chi-Square test. First, we describe some assumptions of the Chi-Square test for independence:
- The data is selected randomly.
- All expected frequencies are greater than or equal to 1 (i.e., $ E_{ij}> 1 $).
- No more than 20% of expected frequencies are less than 5.
The maximum likelihood estimators of $ p_{i.} $ and $ p_{.j} $ are:
$$\hat{p_{i.}}=\cfrac{n_{i.}}{n},~~i=1,\dots,r$$
$$\hat{p_{.j}}=\cfrac{n_{.j}}{n},~~j=1,\dots,c$$
Then, if the independence assumptions are valid, the maximum likelihood estimators of $ p_{ij} $ are:

The hypothesis of independence of the classification criteria with $ O_{ij}=(O_{11},O_{12},\dots,O_{rc}) $ the vector of observed counts with multinomial distribution, and $ E_{ij} $ the expected frequencies, the test statistics are given by:
$$Q^2_{obs}=\sum^r_{i=1}\sum^c_{j=1}\cfrac{(O_{ij}-E_{ij})^2}{E_{ij}}$$
which has an asymptotic Chi-Square distribution with $ (r-1)(c-1) $ degrees of freedom (See demonstration in Cramér (1946), pages 417-419).
By statistics $ \chi^2 $ we can understand the critical region of the independence test. When independence does not occur, it is natural that the observed frequencies $ O_{ij} $ are substantially different from the expected frequencies $ E_{ij}, $ that is, we hope to observe when independence occurs. So we must reject the null hypothesis $ H_0 $ of independence of the classification criteria when the statistics $ Q^2_{obs} $ is greater than a critical point $ \chi^2_{\alpha} $ using the Chi-Square Distribution Table (see Appendix) or using the Action software (see Action manual Distributions module).
Thus, given a level of significance $ \alpha $, the p-value is determined by:
$$\text{p-valor}=P[Q^2_{obs}> \chi^2_{\alpha;(r-1)(c-1)}|H_0]$$
(image missing)
Figure 2.2.1: Pearson’s Chi-Square Test
Restrictions on applying the Chi-Square test
It is classic to state that the minimum value of $ E_{ij} $ must be greater than 10 in a crosstab $ 2\times 2 $, and greater than 5 if the degree of freedom is equal to 2 or more, because in these types of situations, when we use the Chi-square test, we assume that the sample sizes are “large”. In practice, in cross tables the statistics $ X^2 $ is approximate, as we used “small” sample sizes. To resolve this type of situation, we use the Yates correction or Fisher’s exact test, which will be discussed in the following modules.
When $ E_{ij} $ is below 10 in tables $ 2\times 2 $ and 5 and the number of degrees of freedom is 2 or more, it is customary to merge one of the classes with others. With this we obtain new classes with expected frequencies greater than 10, and we work with 1 degree of freedom. This procedure is completely incorrect, as it affects the randomness of the sample, in addition to possibly losing information when merging categories.
Counting degrees of freedom
The total number of cells in a crosstab $ (r\times c) $ is $ rc $. Knowing the $ r $ totals of the lines, it is immediately known the $ r $ of $ rc $ cell values (one from each row). Then the number of independent cells will become $ rc-r $. If we consider the $ c $ column totals, we will notice that only $ c-1 $ of them must be considered, each of these with $ c-1 $ totals. We fix a cell value in each column. Then the number of independent terms will become $ (rc-r)-(c-1)=(r-1)(c-1). $
22.2.2 Applications for independence testing
Example 2.2.1
We considered a group of 90 psychiatric patients who presented the conditions of Delayed Activity and Non-Delayed Activity. Within each group we have the classifications Affective Disorder, Schizophrenia and Neurosis at the significance level of $ \alpha=0,05 $ (5%). The data is summarized in table 2.2.1.
| Affective Disorder | Schizophrenia | Neurosis | Total | |
|---|---|---|---|---|
| Delayed Activity | 12 | 13 | 5 | 30 |
| Non-Delayed Activity | 18 | 17 | 25 | 60 |
| Total | 30 | 30 | 30 | 90 |
Table 2.2.1: Activity of psychiatric patients.
(image missing)

$$E_{11}=\cfrac{30~30}{90}=10$$
$$\vdots$$
$$E_{23}=\cfrac{60~30}{90}=20$$
Thus, we set up a table of expected frequencies as in table (2.3.2)
| EXPECTED VALUES | |||
|---|---|---|---|
| Affective Disorder | Schizophrenia | Neurosis | |
| Delayed Activity | 10 | 10 | 10 |
| Non-Delayed Activity | 20 | 20 | 20 |
Table 2.2.2: Expected frequencies.
$$Q^2_{11}=\cfrac{(12-10)^2}{10}$$
$$\vdots$$
$$Q^2_{23}=\cfrac{(25-20)^2}{20}$$
Now, we set up a table with the values of $ Q^2 $ at the point $ (i,j) $ as in table (2.3.3)
| STANDARDIZED VALUES | |||
|---|---|---|---|
| Affective Disorder | Schizophrenia | Neurosis | |
| Delayed Activity | 0,4 | 0,9 | 2,5 |
| Non-Delayed Activity | 0,2 | 0,45 | 1,25 |
Table 2.2.3: Values of $ Q^2 $ at the point $ (i,j) $.
$$Q^2_{obs}=\sum^r_{i=1}\sum^c_{j=1}\cfrac{(O_{ij}-E_{ij})^2}{E_{ij}}=\cfrac{(12-10)^2}{10}+\ldots+\cfrac{(25-20)^2}{20}=5,7$$
$${p-valor}=P[5,7> \chi^2_{(2-1)(3-1)}|H_0]=0,057844$$
If we want to test whether the type of activity is not influenced by the type of psychiatric disorder, then we must estimate the expected frequencies and after calculating the test statistic, we obtain $ Q^2_{obs}=5,7 $ and p-value=0.057844, so we do not reject the null hypothesis. Therefore, we conclude that there is no dependence between the type of activity and the type of psychiatric disorder, at a significance level of 5%, that is, they are independent.
See below the results obtained by the Action software for the same example.

(image missing)
Example 2.2.2
A supermarket wants to test whether there is any dependence on the time of day (morning, afternoon and night) in relation to payment methods (debit card, credit card and cash) at a 5% significance level. The data is summarized in table 2.2.2.

Table 2.2.2: Purchase movement in each period of the day.
Thus, we obtain the following results.
(image missing)
(image missing)
(image missing)
From the results obtained by the Action software, we obtain $ Q^2_{obs}=13,98 $ and p-value=0.0073, thus rejecting the null hypothesis. Therefore, we conclude that there is dependence between the period of the day, at a significance level of 5%. From table 2.2.2, we observe that the nighttime period has the highest volume of purchases, intuitively plausible, as it is a time when people are leaving work and going to the supermarket to shop.
22.2.3 Association Measures
Measures based on $ Q^2_{obs} $
Association measures are used to measure the level of association between nominal qualitative variables.
- Mean squared contingency coefficient: uses the value of the statistic itself $ Q^2_{obs} $ as a measure of association, but as $ Q^2_{obs} $ depends on n, implies that the measure is increasing in n. To obtain a measure unaffected by sample size, we define this coefficient
$$\Phi^2=\cfrac{Q^2_{obs}}{n}$$
Disadvantages: Not limited from above.
- Contingency coefficient proposed by Pearson (1904)
$$P=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{1+\frac{Q^2_{obs}}{n}}}=\sqrt{\cfrac{Q^2_{obs}}{n+Q^2_{obs}}}$$
We obtain values between 0 and 1, reaching its minimum value if, and only if $ Q^2_{obs} = 0 $, that is, in the case of complete independence. The maximum value is generally not reached. Even in cases of complete dependence, the value is modified with the number of rows and columns in the table. To solve this problem we propose:
- Tschuprov coefficient
$$T=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{\sqrt{(r-1)(c-1)}}}$$
It has a value of 0 in the case of independence and can reach a maximum value of 1 in the case of complete dependence, but only if $ r = c $.
- Cramer coefficient
$$C=\cfrac{\frac{Q^2_{obs}}{n}}{\sqrt{\min(r-1;c-1)}}$$
The value of this coefficient is close to 1 in case of strong dependence and close to 0 in case of independence. The Cramér coefficient is not upper bounded.
For any of the coefficients presented, there are expressions for their variances. The big disadvantage of these coefficients is that they do not allow probabilistic interpretations like those made with the correlation coefficient, for example, but they give us a good idea of the level of association between the variables.
The higher the coefficient value, the greater the level of association between the variables.
Example 2.3.1
Let’s consider example 2.2.1.
| Affective Disorder | Schizophrenia | Neurosis | Total | |
|---|---|---|---|---|
| Delayed Activity | 12 | 13 | 5 | 30 |
| Non-Delayed Activity | 18 | 17 | 25 | 60 |
| Total | 30 | 30 | 30 | 90 |
Table 2.3.1: Activity of psychiatric patients.
- Mean squared contingency coefficient:
$$\Phi^2=\cfrac{Q^2_{obs}}{n}=\cfrac{5,7}{90}=0,0633$$
- Contingency coefficient
$$P=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{1+\frac{Q^2_{obs}}{n}}}=\sqrt{\cfrac{Q^2_{obs}}{n+Q^2_{obs}}}=\sqrt{\cfrac{5,7}{90+5,7}}=0,244$$
- Tschuprov coefficient
$$T=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{(r-1)(c-1)}}=\sqrt{\cfrac{\frac{5,7}{90}}{(3-1)(2-1)}}=0,178$$
- Cramer coefficient
$$C=\cfrac{\frac{Q^2_{obs}}{n}}{\min(r-1;c-1)}=\cfrac{\frac{5,7}{90}}{\min(3-1,2-1)}=0,0633$$
According to the contingency coefficient (P = 0.24), we have a moderate association. For the others, we have a low association.
See below the results obtained by the Action software for the same example.
(image missing)
Example 2.3.2
Let’s consider example 2.2.2.

Table 2.3.2: Purchase movement in each period of the day.
According to the contingency coefficient (P = 0.16), we have a moderate association. For the others, we have a low association.
(image missing)
22.3 Homogeneity of populations
The homogeneity test is used when we intend to test whether the data associated with the categories of one of the variables behaves in a homogeneous or similar way in the different classes or populations defined by the categories of the other classificatory variable.
The data in cross table 3.1 were collected from a study on the side effects caused by a medication. For this, 100 sick patients were selected. We selected 50 patients to receive medication and another 50 patients as a control group, medicating them with a placebo, as shown in table (3.1).

Table 3.1: Population treated with medication and other population with placebo.
This table is radically different from the previous ones, as the number of patients to whom the medicine is being applied and the number of patients to whom the placebo was applied are fixed, that is, the table has one of the margins fixed before the experiment.
In this case, the absolute frequencies that appear in each entry within the table (and the corresponding probabilities) are conditional, and not joint as before.
Another application to illustrate this type of experiment refers to the analysis of hospital records, in which we evaluate the level of understanding of a record by the different professionals who use it (see table 3.2). We divide the level of understanding of the medical record into three categories, they are:
- Totally, when the professional was able to understand the lyrics, abbreviations and does not understand up to two acronyms;
- Partially, when the professional was unable to understand three acronyms (regardless of their judgment);
- Did not understand, when the professional was unable to understand anything that was written or did not understand more than three acronyms.
We selected seven populations of professionals, which are:
- Nurse;
- Physiotherapist;
- Speech therapist;
- Doctor;
- Nutritionist;
- Psychologist;
- Occupational Therapist.
For this study, the sample was calculated separately for each professional of interest, aiming to allow analysis by professional category. To this end, the number of patients treated in different hospital units was surveyed over a period of 15 days, separated by type of professional.
In this way, the calculation of the sample size for each professional team, representative of the period mentioned, was based on a stratified random sample, at a confidence level of 95%, in which the strata were fixed with the sample sizes indicated in table 3.2. The main objective of this study would be to verify the understanding of the evolution read regardless of which professional did the reading and to quantitatively analyze the information in accordance with institutional evaluation and medical records policies.

Table 3.2: Understanding the medical record.
Next, we will present the homogeneity test for cross tables.
22.3.1 Frequency probability function
We consider an r x c cross table, in which we have r samples or populations of the variable R (row variable) and c classes or categories of the variable C (column variable). Therefore, we have r multinomial variables (if it is the margin corresponding to the fixed line criterion), one for each sample.
Given a sample of $ n_{i.} $ observations of population i of the variable R, with i=1,…,r, We consider the vector $ (O_{i1},O_{i2},…,O_{ic}) $ of random variables, being $ O_{ij} $ the total number of observations (among the $ n_{i.} $ of sample i) classified in category j of variable C, with j=1,…,c.
Se $ p_{j|i}=P(\text{uma observação da amostra}~ i~\text{ ser classificada na classe}~ j~\text{ da variável}~C), $ j=1,…,c
then the random vector $ (N_{i1},…,N_{ic}) $ has a multinomial distribution, i.e.

We repeat this probability for r independent samples from r populations. With this, we have r independent random vectors with multinomial distribution, although eventually distinct.
Thus, we obtain the expected frequency of observations from sample i, classified in population j of variable C (column) as follows:
$$F_{j|_i}=n_{i.}~\hat{p}_{j|_i}~~~~j=1,\dots, c$$
As a result, the maximum likelihood estimators of pj|i are:

Next, we present the statistical analysis for the homogeneity test for cross tables.
22.3.2 Statistical Analysis for the homogeneity test
We now have r independent multinomial situations (if it is the margin corresponding to the fixed line criterion), one for each row of the table, and we want to know if those r situations are identical, that is, we want to know if the r multinomial situations are identical in probabilistic terms. The identity of the multinomial distributions means that the homogeneity in probabilistic terms of the classification by the C criterion categories for all r populations. This homogeneity is expressed probabilistically by the set of following equalities:
$$p_{j|_1}=p_{j|_2}=\dots=p_{j|_r}\quad\quad j=1,\dots,c$$
where, pj|i is the Probability of a sample from population i being classified in class j of variable C, j=1,…, c.
$$p_{j|_i}=\cfrac{p_{ij}}{p_{i.}}~j=1,\dots,c\quad (3.2.1)$$
$$p_{i.}=\sum^c_{j=1}p_{ij}~i=1,\dots,r$$
In summary, our objective is to test the hypothesis of homogeneity of the r population samples in relation to the classification in the categories of variable C (column). Thus, the hypotheses are:

Chi-Square Test for Homogeneity
The Chi-Square test of independence (which was discussed in section 22.2.2) is a test on a sample from a single population. Each individual in the population is classified into two forms (activity and psychiatric illness). Now, we discuss a second type of Chi-Square test, which can be used to compare proportions in different populations.
Definition
In a Chi-Square test of homogeneity, we can test the statement that different populations have the same proportion of individuals with some characteristic.
Returning to equation (3.2.1), we have that the maximum likelihood estimator of pj|i is given by:
$$\hat{p_{j|_i}}=\cfrac{O_{ij}}{n_{i.}}~~~j=1,\dots,c$$
But, if the H0 hypothesis (homogeneity hypothesis) is valid, we know that:
$$p_{j|_1} = p_{j|_2} = \dots =p_{j|_r} = p_j~~~j=1,\dots,c$$
Therefore, the maximum likelihood estimators of pj|i=pj are:
$$\hat{p_{j|_i}}=\hat{p_j}=\cfrac{\displaystyle\sum_{i=1}^rO_{ij}}{n}=\cfrac{O_{.j}}{n}~~~j=1,\dots,c$$
The maximum likelihood estimators of the expected frequencies Fj|i, under the valid null hypothesis H0, is given by:
$$E_{j|_i}=n_{i.}~\hat{p}_{j|_i}=\cfrac{n_{i.}~O_{.j}}{n}~~~j=1,\dots,c$$
Therefore, with (Oi1,Oi2,…,Oic) being the frequency vector of sample i, and assuming that the hypothesis of homogeneity in the classification criterion is valid. We have the statistics
$$Q^2_{c|i}=\sum^c_{j=1}\cfrac{(O_{ij}-E_{j|i})^2}{E_{j|i}}$$
has an asymptotic distribution with (c-1) degrees of freedom.
If we repeat the same reasoning for the r samples, we will add r variables with Chi-Square distribution, that is, the test statistic is given by:
$$Q^2_{obs}=\sum^r_{i=1}Q^2_{c|i}=\sum^r_{i=1}\sum^c_{j=1}\cfrac{(O_{ij}-E_{j|i})^2}{E_{j|i}}$$
has asymptotic Chi-Square distribution with (r-1)(c-1) degrees of freedom.
By the expression of statistics $ Q^2_{obs} $ we can understand which is the critical region of the homogeneity test. When homogeneity does not occur, it is natural that the observed frequencies Oij are substantially different from the frequencies we expect to observe when homogeneity occurs (Ej|i). Then we must reject the hypothesis H0 of homogeneity of the probability distribution of the classification categories of the variable C (column), for all samples, when the statistics $ Q^2_{obs} $ is greater than a critical point $ \chi^2_{\alpha} $ using the Chi-Square Distribution Table - Appendix or using the Action software (see the Action Distributions module manual).
Thus, given a level of significance $ \alpha $, the p-value is determined by
$${p-valor}=P[Q^2_{obs}> \chi^2_{\alpha;(r-1)(c-1)}|H_0]$$
Counting Degrees of Freedom
The total number of frequencies in an r x c cross table is rc. As the quantity of each sample is known (corresponding to the total of each line), the distribution in each sample of the classification frequencies by the c categories of variable C (column) is made with a restriction. So in each of the r lines we have only (c-1) frequencies free. Knowing the column totals, for example, in the last column the frequencies are immediately determined. So in this last line the values are not free. Consequently, we have the frequencies of (r-1) samples as independent, each as (c-1) independent frequencies. Then the total degrees of freedom will be (r-1)(c-1).
22.3.3 Applications for the Homogeneity test
Example 3.3.1
Let’s look at the contingency table described in the introduction, in which data were collected from a study on the side effects caused by a medication. In this study we used a medicine in 50 patients, and we applied a placebo to another 50 patients (control group), as shown in table (3.3.1).

Table 3.3.1: Population treated with medication and other population with placebo.
(image missing)
Let us test the homogeneity of the drug’s secondary effect, for the population in which it was administered and for the population in which it was not administered (placebo).
$$E_{j|_i}=n_{i.}~\hat{p}_{j|_i}=\cfrac{n_{i.}~N_{.j}}{n}~~~j=1,\dots,c$$
$$E_{1|1}=\cfrac{19~50}{100}=9,5 \ldots E_{2|3}=\cfrac{81~50}{100}=40,5$$
Thus, we set up a table of expected frequencies as in table (3.3.2)
| EXPECTED VALUES | ||
|---|---|---|
| Gift | Absent | |
| Medicine | 9,5 | 40,5 |
| Placebo | 9,5 | 40,5 |
Table 3.3.2: Expected frequencies.
$$Q^2_{11}=\cfrac{(15-9,5)^2}{9,5}\ldots Q^2_{23}=\cfrac{(46-9,5)^2}{9,5}$$
Now, we set up a table with the values of $ Q^2 $ at the point $ (i,j) $ as in table (3.3.3)
| STANDARDIZED VALUES | ||
|---|---|---|
| Gift | Absent | |
| Medicine | 3,1842 | 0,746 |
| Placebo | 3,1842 | 0,746 |
Table 3.3.3: Values of $ Q^2 $ at the point $ (i,j) $.
$$Q^2_{obs}=\sum^r_{i=1}\sum^c_{j=1}\cfrac{(O_{ij}-E_{ij})^2}{E_{ij}}=$$
$$=\cfrac{(15-9,5)^2}{9,5}+\ldots+\cfrac{(46-9,5)^2}{9,5}=$$
$$=7,8662$$
$${p-valor}=P[7,8662> \chi^2_{0,05;(2-1)(2-1)}=3,8415|H_0]=0,005848$$
After calculating the test statistic, $ Q^2_{obs}=7,8662 $ and p-value=0.005848, we reject the H0 hypothesis, we conclude that there is a significant difference between the type of effect caused by the administration of the medicine and by the administration of the placebo, with a significance of 5%.
In the results obtained by the Action software, the value of the statistic $ Q^2_{obs} $ is calculated with the Yates correction, as we have one of the cells with a frequency less than or equal to 5. If you want to know how the correction is made, see the Yates continuity corrections module.
See below the results obtained by the Action software for the same example.
(image missing)
Example 3.3.2
In order to analyze the level of understanding in relation to hospital records described in the homogeneity of populations section. We set up a contingency table as follows.

Table 3.3.2: Understanding the medical record.
We obtain the following results:
(image missing)
(image missing)
(image missing)
(image missing)
From the results obtained by the Action software, we obtain $ Q^2_{obs}=179,45 $ and the p-value$ \approx0 $. Therefore, we reject the null hypothesis. Therefore, we conclude that there is a significant difference between professionals in relation to the level of understanding of the medical records, at a significance level of 5%.
22.3.4 Indiscriminate use of the homogeneity test
Let’s now look at an example of how the homogeneity test in cross tables with a fixed margin can be used inappropriately.
Before the elections, a political consultant was tasked with a public opinion survey and collected the following data. Of 400 voters interviewed, 200 intended to vote in favor of the party that won the elections, and the other 200 were determined to vote for the opposition party. After the elections, the government introduced labor legislation and a salary cap, which could eventually cause discontent among the electorate. The same political consultant interviewed the same 400 people again, and this time 182 declared that they were government supporters, while 218 declared that, if there were elections at that time, they would vote against the government. Based on this data, the specialist created the cross table (3.6.1), in which we determined $ Q^2_{obs} =1,448 $ and p-value$ =0,23 $, and thus there is no reason to reject the homogeneity hypothesis even at the unusual significance level of 0.2. The government, very happy, had this analysis published in all newspapers, proving that it continued to have the support of the population.

Table 3.6.1: Opinion Survey.
Let’s see the results obtained by the Action software:
(image missing)
(image missing)
(image missing)
Of course, in a case like this, the opposition party had no difficulty in mocking the government, as the analysis is completely wrong. In fact, the analyst does not have 800 independent answers, the fact that each person answers twice introduces a correlation in the results that cannot be ignored. What should be analyzed are the 400 pairs of responses, not the 800 isolated responses. Thus, we use the correlation coefficient proposed by Yule (1900) varying in an interval [-1,1]. However, first, we define the odds ratio for 2x2 cross tables. So we have that the odds ratio is given by the following formula:
$$OR=\frac{O_{11}\times O_{22}}{O_{12}\times O_{21}}$$
Now, we define the Yule correlation coefficient as follows:
$$\psi=\frac{OR-1}{OR+1}$$
So, for our example we have:
$$OR=\frac{200\times 218}{200\times 182}=1,197\quad{e}\quad\psi=\frac{1,197-1}{1,197+1}=0,089$$
Thus, the number of voters who previously voted against and who would now vote in favor after the elections is calculated as follows:
$$O_{2^\prime 1^\prime}=\psi\times O_{21}=0,089\times 182\approx 16$$
Now, as the number of voters interviewed was 200, then we have that the number of voters who were against before the elections and who continued against after the elections is $ 200-16=184 $ voters. Therefore, the table that should be analyzed is shown in table (3.6.2)

Table 3.6.2: Opinion Survey Before and After the Elections.
(image missing)
(image missing)
We observed from the results obtained by the Action software, which $ Q^2_{obs} =223,82 $ and p-value$ asymp;0 $. Therefore, we reject the hypothesis of homogeneity at the 5% significance level. From the results, we also see that around 15% of voters who were previously in favor of the government are now against it.
Note: If we want to test the independence of classification criteria, or if we want to test the homogeneity of populations in relation to a classification criterion, the Chi-Square statistic continues to have the same expression and for large samples it will have a Chi-Square limit distribution with 1 degree of freedom.
22.4 Yates continuity correction
We used the Yates Correction as an approximation for the analysis of 2 x 1 and 2 x 2 cross tables. A 2 x 2 cross table presents the frequencies of occurrence of all combinations of levels of two dichotomous variables, in a sample size $ n $. A schematic form of this table is given in table 4.1.

Table 4.1: 2 x 2 Cross Table.
An investigation of interest is whether the variables summarized in a crosstabulation are independent of each other.
For example, in a randomized study with fixed margins, the judgment of the number of categories to be randomly chosen for each group would be specified and the row margins would be fixed, but the column margins would not. In a paired study, however, a sample can have 100 cases (smokers, for example) and 1000 controls (non-smokers). When we test each of the 1100 individuals for the presence or absence of some exposure that can be predicted by their own smoking status, which in this case would be the margins of a column that are fixed.
Now, another example would be Fisher’s famous tea tasting experiment, in which a lady tried to guess the order in which the ingredients of a tea were mixed, in other words, the lady tried to identify if there was a difference in flavor when she put the milk before the tea or the tea before the milk. The experiment was carried out by mixing in 8 glasses, two groups of four, both the row and the column would have the margins fixed by the experiment.
When row and column margins are fixed, independence can be tested using Fisher’s exact test. This test is based on the hypergeometric distribution and is computationally intensive, especially on large samples. Thus, Fisher defended the use of Pearson statistics,
$$X^2=\cfrac{n~(AD-BC)^2}{(A+B)(C+D)(A+C)(B+D)}$$
that under the null hypothesis we have a Chi-Square distribution with one degree of freedom. Yates argued that this distribution only gives us approximate values.
Estimates of discrete probabilities associated with frequency data and p-values based on statistics $ X^2 $ Pearson’s values generally underestimate the true p-values. In general, when a statistic takes the discrete values A < B < C, o p-valor correspondente a B é estimado pela cauda da função contínua definida pelo ponto $ (a+b)/2 $.
Portanto, a cauda da função contínua calculada em B subestima o p-valor. Neste contexto, Yates sugeriu que as estatísticas $ X^2 $ devem ser corrigidas para a continuidade e propôs a estatística de teste corrigido da seguinte forma:
$$\cfrac{n~(|AD-BC|-\frac{1}{2}~n)^2}{(A+B)(C+D)(A+C)(B+D)}$$
Embora a correção de Yates é mais conhecida por seu uso na análise de tabelas cruzadas 2 x 2, também é aplicável à análise de tabelas cruzada 2 x 1. A tabela de cruzada 2 x 1 mostra as frequências de ocorrência de duas categorias em uma amostra aleatória de tamanho n, elaborado à partir de uma população em que a proporção de casos nas duas categorias são p e (1 - p).
A questão pesquisada é normalmente observada se o número de casos x e (n - x) nas duas categorias foram amostrados em uma população com um valor pré-especificado p. Isso pode ser testado usando estatística de Pearson,
$$X^2=\cfrac{(x-np)^2}{n~p(1-p)}$$
que assintoticamente têm uma distribuição ($ \chi^2_1 $) Qui-Quadrado com um grau de liberdade sob a hipótese nula H0.
Yates mostrou que, neste caso, bem como a utilização dos resultados do Qui-Quadrado de Pearson, os valores de p sistematicamente subestimam os verdadeiros p-valores com base na distribuição Binomial. Por isso, ele sugeriu a estatística corrigida:
$$\cfrac{(|x-np|-\frac{1}{2})^2}{n~p(1-p)}~~(4.1)$$
Kendall e Stuart observaram que o procedimento de Yates é um caso especial de um conceito geral de uma correção de continuidade, enquanto que Pearson notou que correção de Yates deriva naturalmente do teorema de Euler-Maclaurin usados para aproximarmos as distribuições binomial e hipergeométrica. Em seguida, o uso da correção de Yates para a estatística Qui-Quadrado de Pearson tem sido amplamente enfatizado para a análise das tabelas cruzadas.
Há, no entanto, vários problemas relacionados com a correção de Yates e vamos discutir algumas destas.

Tabela 4.2: Distribuição Binomial para n=10 e p=0,5, e bilateral para os p-valores (Adaptado de Richardson)
Em primeiro lugar, na análise de tabelas cruzadas 2 x 1, os p-valores associados com a estatística corrigida (equação 4.1) tendem a superestimar os verdadeiros p-valores para as caudas da distribuição e subestimá-los para o centro. Isto é ilustrado na tabela 4.2, que apresenta p-valores de um teste em uma tabela cruzada com n=10 e p=0,5, obtido com $ X^2 $ de Pearson e correção de Yates. Os resultados desta tabela também estão os verdadeiros p-valores da distribuição binomial que são o padrão. É também necessário salientar que os p-valores obtidos com a correção de continuidade são muito menos precisos quando a probabilidade p binomial é substancialmente diferente de 0,5.
Em segundo lugar, correção de Yates é apropriada apenas para testes unilaterais, pois, como é baseado em uma comparação entre a contingência observada e a contingência forte próxima na mesma direção (Haber, Mantel). Para os testes bilaterais, a estatística envolve uma hiper correção. Na mesma linha, pode ser provado analiticamente que a correção de Yates é sistematicamente conservadora quando realizados em testes bilaterais.
Em terceiro lugar, uma questão mais importante relacionada com a correção de Yates e a sua aplicação à análise de tabelas cruzadas, são resultantes da investigação diferentes planejamentos. Muitos pesquisadores têm argumentado que a correção de Yates é baseada em comparações entre as tabelas cruzada com a linha fixa e coluna marginal total.
Particularmente Yates está especialmente preocupado com a aproximação da distribuição hipergeométrica e do teste exato de Fisher. Contudo, o método de Yates também tem sido recomendado para a análise de contingência em tabelas resultantes 2 x 2 e esquemas de amostragem em que um ou ambos conjuntos marginais totais são livres para variar e são, portanto, sujeitos a erros de amostragem.
Devemos notar que tais esquemas de amostragem são mais frequentemente encontrados em contexto da pesquisa atual. Enquanto Yates sustenta ao longo das linhas de raciocínio de Fisher de que a análise de tabelas cruzada 2 x 2 deve ser sempre realizada subordinada à marginais totais observadas, essa abordagem ainda é objeto de debate.
Por outro lado, quando os totais marginais não são fixados, o processo envolve uma subcorreção de Yates adicionais e o teste estatístico passa a ser conservador. Esta tem sido investigada através de simulações Monte Carlo (Grizzle, Richardson), e confirmado analiticamente (Conover, Haber). Em particular, Grizzle observou que, para tabelas cruzadas com marginais totais não fixas, o procedimento de Yates “produz um teste que é tão conservador que é quase inútil”.
Finalmente, para concluirmos esta seção, a correção de Yates originou-se como um dispositivo para eliminar as discrepâncias que emergiram da aproximação da distribuição hipergeométrica para o teste exato de Fisher. A aproximação com $ X^2 $ de Pearson foi necessário “para a simplicidade comparativa dos cálculos” (Fisher, página 99), pois a análise exata das tabelas cruzadas 2 x 2 e com a computação limitada disponível na época, tornava inviável seu uso em muitos casos, não sendo o caso na atual conjectura, pois os recursos computacionais não são mais o problema.
Na verdade, Agresti observa que a correção de Yates não é mais necessário desde que o software atual faça teste exato de Fisher, computacionalmente viável, mesmo quando os tamanhos de amostra são grandes.
22.4.1 Aplicações para a Correção de continuidade de Yates
Exemplo 4.1.1
Vejamos a sua aplicação no exemplo 3.3.1, em que os dados foram colhidos de um estudo sobre os efeitos secundários provocados por um medicamento.

Tabela 4.1.1: População tratados com medicamento e outra população com placebo.
Vamos calcular a correção de Yates:
$$Q^2_{corr}=\cfrac{n~(|AD-BC|-\frac{1}{2}~n)^2}{(A+B)(C+D)(A+C)(B+D)}= \cfrac{100~(|15*46-35*4|-\frac{1}{2}~100)^2}{(15+35)(4+46)(15+4)(35+46)}=6,4977$$
e o p-valor:
$${p-valor}=P[6,4977> \chi^2_{0.05;(2-1)(2-1)}|H_0]=0.0108$$
(imagem em falta)
(imagem em falta)
Observação: O software Action, já faz a correção de Yates automaticamente.
Após o cálculo da estatística de teste, $ Q^2_{obs}=6,4977 $ e do p-valor$ =0,0108 $, concluímos que existe uma diferença das probabilidades do tipo de efeito provocado pela administração do medicamento e pela administração do placebo, com um nível de significância de $ \alpha=0,05 $ (5%). Compare com o resultados da aplicação do módulo teste de homogeneidade obtido e tire as devidas conclusões.
22.5 Teste exato de Fisher
Em tabelas cruzadas 2 x 2, os valores esperados menores que 5 e amostras pequenas, podem afetar a aproximação da distribuição Qui-Quadrado da estatística $ Q^2_{obs} $ fazendo com que a mesma não seja suficientemente boa. Neste caso é preferível usar o teste exato de Fisher, que passamos a descrever nesta seção.
No teste exato de Fisher, nos baseamos no cálculo da distribuição de probabilidade das frequências da tabela. Contudo, isso não é possível na situação das tabelas com margens livres ou com uma margem fixa e outra livre porque a probabilidade de uma dada distribuição das frequências é função de parâmetros de valor desconhecido.
Fisher (1934) propôs que a distribuição de probabilidade das frequências de qualquer um destes tipos de tabelas sejam substituídas pela probabilidade da distribuição das mesmas frequências, considerando tabelas com duas margens fixas, ou seja, uma distribuição de probabilidade hipergeométrica para a única frequência de valor livre (independente).
Para a tabela 5.1 (arranjada de modo que $ n_{1.}\leq n_{.1}\leq n_{.2}\leq n_{2.} $), se X for a frequência de valor independente, a frequência da célula (1,1), considerando:
$$P_a=P[X=a]=\cfrac{\displaystyle{a+b \choose a} \displaystyle{c+d \choose c}}{\displaystyle{n \choose a+c}}=\cfrac{(a+b)!(c+d)!(a+c)!(b+d)!}{a!b!c!d!n!}$$
O teste exato de Fisher consiste na determinação desta probabilidade e dos arranjos possíveis que, com os mesmos totais marginais, tenham ainda mais desvios em relação à hipótese nula H0 ,isto é, as probabilidades de tabelas com as mesmas margens e com menores valores na entrada cujo valor, na tabela cruzada em questão, já foram consideradas baixas, neste caso
| $ a-1 $ | $ b+1 $ | $ a+b $ |
|---|---|---|
| $ c+1 $ | $ d-1 $ | $ c+d $ |
| $ a+c $ | $ b+d $ | $ n $ |
| $ a-2 $ | $ b+2 $ | $ a+b $ |
|---|---|---|
| $ c+2 $ | $ d-2 $ | $ c+d $ |
| $ a+c $ | $ b+d $ | $ n $ |
$ \vdots $
| $ 0 $ | $ a+b $ | $ a+b $ |
|---|---|---|
| $ c+a $ | $ d-a $ | $ c+d $ |
| $ a+c $ | $ b+d $ | $ n $ |
Se a soma $ P_a+P_{a-1}+…+P_0 $ for inferior ao nível de significância $ \alpha, $ devemos rejeitar a hipótese de independência ou a hipótese de homogeneidade que estipulamos.
22.5.1 Aplicação do Teste Exato de Fisher
Exemplo 5.1.1
De maneira geral, os doentes psiquiátricos podem ser classificados em psicóticos e neuróticos. Um psiquiatra realiza um estudo sobre os sintomas suicidas em duas amostras de 20 doentes de cada grupo. A nossa hipótese é que a proporção de psicóticos com sintomas suicidas é igual a proporção de neuróticos com estes sintomas (em um teste de independência, a hipótese nula seria, a presença ou ausência de sintomas suicidas é independente do tipo de doente envolvido). Assim, temos os dados resumidos na tabela 5.1.1.

Tabela 5.1.1: Incidência de sintomas suicidas.
As tabelas que evidenciam maior afastamento da hipótese nula seriam
| 1 | 7 | 8 |
|---|---|---|
| 19 | 13 | 32 |
| 20 | 20 | 40 |
| 0 | 8 | 8 |
|---|---|---|
| 20 | 12 | 32 |
| 20 | 20 | 40 |
e portanto a aplicação do teste exato de Fisher, resultaria em:
$$P=P_2+P_1+P_0=0.095760 + 0.020160 + 0.001638 = 0.117558$$
que nos dá a probabilidade de observar que, entre os 8 doentes com sintomas suicidas, 2 ou menos são psicóticos, quando a hipótese de igualdade da proporção de psicóticos e neuróticos com sintomas suicidas é verdadeira. Verificamos que a probabilidade da discrepância maior ou igual a observada ter ocorrido, é de 0,117558, que é consideravelmente elevada. Logo, as proporções de psicóticos e neuróticos são homogêneas no que diz respeito aos sintomas suicidas.
É claro que este teste que realizamos foi um teste unilateral, enquanto que se tivéssemos usado o teste Qui-Quadrado tínhamos realizado um teste bilateral que mediria as diferenças relativamente à igualdade de proporções nos dois sentidos. Mas o teste de Fisher também pode ser realizado bilateralmente. Duas propostas podem ser feitas nesse sentido.
-
Como neste exemplo, as duas amostras têm a mesma dimensão, podemos multiplicar o valor de P por 2, e decidir do mesmo modo por comparação com o valor de $ \alpha $.
-
Caso as amostras sejam muito diferentes (ou os totais de coluna, em um teste de independência), poderíamos ainda calcular a probabilidade de ter a frequência mais discrepante do que a observada. Mas no nosso exemplo, medimos os casos mais extremos em que a proporção de ausência de sintomas suicidas dos neuróticos é muito maior do que a proporção de ausência de sintomas suicidas dos psicóticos. Neste caso, as tabelas seriam:
| 6 | 2 | 8 |
|---|---|---|
| 14 | 18 | 32 |
| 20 | 20 | 40 |
| 7 | 1 | 8 |
|---|---|---|
| 13 | 19 | 32 |
| 20 | 20 | 40 |
| 8 | 0 | 8 |
|---|---|---|
| 12 | 20 | 32 |
| 20 | 20 | 40 |
$$P^{**} = P_2 + P_1 + P_0 + P_6 + P_7 + P_8 = 0.235116,$$
calculando o p-valor, obtemos:
que são as mesmas conclusões caso o cálculo do p-valor seja adotado pela proposta 1, pois
$$P^{*}=2\times P=2\times 0.117558=0.235116.$$
Observação
Experimente aplicar o teste Qui-Quadrado mesmo admitindo frequências esperadas inferiores a 5 e aplicar a correção de Yates.
Veja a seguir os resultados obtidos pelo software Action para o mesmo exemplo.
(imagem em falta)
(imagem em falta)
22.6 Teste de McNemar para frequências correlacionadas
Amostras pareadas são muitas vezes utilizadas para aumentar a precisão de uma comparação. Contudo, duas amostras pareadas não são amostras independentes, mas sim correlacionadas. Consequentemente se forem utilizadas em um estudo de tabelas de contingência, a usual estatística Qui-Quadrado não pode ser utilizada no sentido estrito para averiguar as diferenças entre frequências de duas amostras. O teste apropriado para comparar frequências oriundas de amostras pareadas devemos a McNemar (1955).
Como introdução, consideramos a tabela 6.1, em que pretendemos analisar a presença ou ausência de um atributo A em duas amostras I e II, pareadas.

Tabela 6.1: Frequências em amostras pareadas.
Como estamos preocupados com as diferenças entre as duas amostras, as frequências b e c não nos interessam, mas sim as frequências a e d que registam mudança na observação do atributo A. Se a hipótese nula $ H_0 $ que queremos testar é a de que não existem diferenças nas amostras, no que diz respeito a observação do atributo A, então podemos considerar que a é o número de sucessos, porque passa de uma ausência a uma presença de A, e que d é o número de insucessos (fracassos), porque passa de uma presença a uma ausência de A. Se a hipótese nula é verdadeira, então a tem distribuição binomial de parâmetros $ (a + d; 1/2) $ e a frequência esperada das células $ (1, 1) $ e $ (2, 2) $ é de $ (a+d)/2 $.
McNemar propôs que, ao invés de usarmos o teste exato, utilizemos à estatística Qui-Quadrado aplicada as frequências a e d,
$$ Q^2_{obs}=\cfrac{(a-d)^2}{(a+d)}\quad (6.1.1) $$
que, condicional à hipótese nula $ H_0 $ de homogeneidade, tem uma distribuição assintótica Qui-Quadrado com 1 grau de liberdade.
Em alguns casos, podemos usar uma modificação da estatística (6.1.1) (“uma correção de continuidade semelhante à correção de Yates”) como a seguir:
$$ Q^2_{obs}=\cfrac{(|a-d|-1)^2}{a+d} $$
Repare que este teste apresenta uma resposta ao problema colocado no módulo teste de homogeneidade. De fato as amostras são pareadas e podemos agora aplicar o teste de McNemar.
22.6.1 Aplicação do Teste de McNemar
Exemplo 6.1.1
Voltando ao exemplo 3.3.1. Vimos que as amostras são pareadas e podemos agora aplicar o teste de McNemar.
Para o teste Qui-Quadrado de Pearson obtemos $ X^2 = 7,86 $ e temos $ {p-valor}=P[\chi^2_{0,05;(2-1)(2-1)}> 7,86|H_0]=0,005048 $ o que nos leva a concluir pela rejeição da hipótese de homogeneidade ao nível de 5% de significância.
Aplicando o teste de McNemar obtemos o teste:
$$ Q^2_{obs}=\cfrac{(a-d)^2}{(a+d)}=\cfrac{(35-4)^2}{(35+4)}=24.641 $$
$$ {p-value}= 6.907\times10^{-7} $$
Se aplicarmos a correção de continuidade, $ Q^2_{obs} =6,4977 $ e $ {p-valor} = P(\chi^2_{0,05;(2-1)(2-1)}> 6,4977|H_0)=0,01080 $ que nos leva a decisão idêntica.
Aplicando o teste de McNemar obtemos o teste:
$$ Q^2_{obs}=\cfrac{|a-d|^2-1}{(a+d)}=\cfrac{|35-4|^2-1}{(35+4)}=24,615 $$
$$ {p-value}= 7.02\times10^{-7} $$
Veja a seguir os resultados obtidos pelo software Action para o mesmo exemplo.

(imagem em falta)
22.7 Análise de Resíduos
Outro processo que podemos utilizar na tentativa de identificar as categorias responsáveis por um valor significante da estatística Qui-Quadrado, foi sugerido por Haberman (1973). Este processo envolve a análise dos resíduos normalizados:
$$ r_{ij}=\cfrac{n_{ij}-E_{ij}}{\sqrt{E_{ij}}} $$
Obtemos uma estimativa da variância de $ r_{ij} $:
$$ \hat{v_{ij}}=\left(1-\cfrac{n_{i.}}{n}\right)\left(1-\cfrac{n_{.j}}{n}\right) $$
Então, para cada célula da tabela cruzada, podemos calcular o resíduo padronizado $ d_{ij} $ como a seguir:
$$ d_{ij}=\cfrac{r_{ij}}{\sqrt{v_{ij}}} $$
Quando as variáveis que constituem a tabela cruzada são independentes, os termos que $ d_{ij} $ têm distribuição aproximada Normal reduzida. Comparando os valores absolutos de $ d_{ij} $ com um quantil de probabilidade $ 1-\alpha/2 $ da distribuição normal reduzida.
Exemplo 7.1.1
Voltando ao exemplo 3.6.1

Tabela 7.1.1: População tratados com medicamento e outra população com placebo.
Primeiramente calculamos os resíduos:
$$ r_{ij}=\cfrac{n_{ij}-E_{ij}}{\sqrt{E_{ij}}} $$
$$ r_{11}=\cfrac{n_{11}-E_{11}}{\sqrt{E_{11}}}=1.78 \ldots r_{22}=\cfrac{n_{22}-E_{22}}{\sqrt{E_{22}}}=0.86 $$
e os resultados dos cálculos dos resíduos são encontrados na tabela 7.1.2:

Tabela 7.1.2: Resíduos $ r_{ij} $
Com os resíduos, não temos uma sensibilidade para concluirmos algo, vamos agora calcular os resíduos padronizados e compararmos com a Normal reduzida.
Primeiro vamos encontrar os estimativas das variâncias:
$$ v_{ij}=\left(1-\cfrac{n_{i.}}{n}\right)\left(1-\cfrac{n_{.j}}{n}\right) $$
$$ v_{11}=\left(1-\cfrac{19}{100}\right)\left(1-\cfrac{50}{100}\right) \ldots v_{22}=\left(1-\cfrac{81}{100}\right)\left(1-\cfrac{50}{100}\right) $$
Obtemos as estimativas das variâncias na tabela 7.1.3:

Tabela 7.1.3: Estimativas da variância $ v_{ij} $
Assim, calculamos os resíduos padronizados a seguir:
$$ d_{ij}=\cfrac{r_{ij}}{\sqrt{v_{ij}}} $$
$$ d_{11}=\cfrac{r_{11}}{\sqrt{v_{11}}}=\cfrac{1.7844}{\sqrt{0.405}}=2.8039 $$
$$ \vdots $$
$$ d_{22}=\cfrac{r_{22}}{\sqrt{v_{22}}}=\cfrac{1.7844}{\sqrt{0.405}}=2.8039 $$
obtemos os resíduos padronizados na tabela 7.1.4:

Tabela 7.1.4: Resíduos Padronizados $ d_{ij} $
e comparados os seus valores absolutos com o quantil de probabilidade $ 0,975 $ da Normal Reduzida, ou seja $ 1,96 $, observamos que todas as células apresentam valores significativos.
Veja a seguir os resultados obtidos pelo software Action para o mesmo exemplo.
(imagem em falta)
(imagem em falta)
22.8 Modelos Log Lineares para Tabelas de Contingência
Neste módulo, vamos estudar a aplicação de modelos de regressão de Poisson para a análise das tabelas cruzadas. A distribuição de Poisson é talvez uma das mais populares na aplicação de modelos log-lineares para tabelas cruzadas, pois são baseados na existência de uma estreita relação entre ela e a distribuição multinomial. Consideramos tabelas cruzadas simples, ou seja, tabelas 2 x 2. No entanto, os conceitos a serem introduzidos se aplicam igualmente aos casos mais gerais.
Exemplo 8.1
Para testar o efeito de um medicamento para um certo tipo de doença, foram selecionados 1330 pacientes, em que cruzamos o tipo de tratamento (medicamento ou placebo) e a presença ou ausência de efeitos em relação ao tipo de doença. Há vários esquemas de amostragem que poderíamos ter conduzido estes dados.

Tabela 8.1: Tabela de Tratamento versus Efeito do Medicamento.

A seguir, vamos apresentar o modelo Poisson para tabelas cruzadas.
Modelo de Poisson
Um modelo alternativo para os dados da Tabela 8.1 é tratarmos as quatro frequências das variáveis aleatórias independentes de Poisson, pois estamos tratando primeiramente de uma tabela 2x2. A física possível do modelo é imaginar que existem quatro grupos de pessoas, um para cada célula da tabela, e que os membros de cada grupo chegam ao acaso em um hospital ou centro médico durante um período de tempo, digamos que para um exame de saúde. Neste modelo o tamanho total da amostra não é fixo e todas as contagens são, portanto, aleatórias.
Partindo do pressuposto de que as observações são independentes, a distribuição conjunta das quatro contagens é um produto de distribuições de Poisson:
$$ P[Y=y]=\displaystyle\prod^r_{i=1}\prod^c_{j=1} \cfrac{\lambda_{ij}^{y_{ij}}\exp{(-\lambda_{ij})}}{y_{ij}!}~~(8.1) $$
tomando log obtemos o log da verossimilhança usual de Poisson.
Em termos da estrutura sistemática do modelo, podemos considerar três modelos log-lineares para as contagens esperadas:
- modelo nulo;
- modelo aditivo;
- modelo saturado.
No modelo nulo supomos que todos os tipos de pacientes (4 tipos de pacientes) chegam ao laboratório na mesma proporção. Já no modelo aditivo supomos que a taxa de chegada depende do tratamento e da presença ou ausência de efeitos sobre a doença, mas não na combinação dos dois. Por fim, no modelo saturado diríamos que cada grupo tem seu próprio ritmo ou número esperado de chegadas.
Neste ponto, você pode tentar ajustar o modelo de Poisson aditivo para as quatro contagens na Tabela 8.1, tratamento e supor o efeito do medicamento como fatores ou preditores discretos.
Se pudermos escrever os valores ajustados, descobriremos que eles são exatamente os mesmos que no modelo multinomial. Esse resultado, evidentemente, não é uma coincidência. Testar a hipótese de independência no modelo multinomial é exatamente equivalente a testar a qualidade do ajuste do modelo de Poisson aditivo. A prova rigorosa desse resultado pode ser vista em (Fienberg,2006), mas podemos fornecer informações suficientes para mostrar que o resultado é intuitivamente razoável de entender quando pode ser usado.
Primeiro, observamos que, se as quatro contagens independentes têm distribuição de Poisson, sua soma tem distribuição Poisson com média igual à soma das médias. Simbolicamente, se $ Y_{ij}\sim P(\lambda_{ij}), $ então o total $ Y_{..}=\displaystyle\sum^r_{i=1}\sum^c_{j=1} Y_{ij} $ tem distribuição de Poisson com média $ \lambda_{..}=\displaystyle\sum^r_{i=1}\sum^c_{j=1} \lambda_{ij} $. Além disso, a distribuição condicional das quatro contagens dado o seu total é multinomial com probabilidades:
$$ \pi_{ij}=\frac{\lambda_{ij}}{n} $$
no qual usamos $ n $ para a observação total $ y_{..}=\displaystyle\sum^r_{i=1}\sum^c_{j=1} y_{ij}. $ Este resultado decorre diretamente do fato de que a distribuição condicional das contagens $ Y $ dado o seu total $ Y_{..} $ pode ser obtida como a relação entre a distribuição conjunta da contagem e do total (que é o mesmo que a distribuição conjunta das contagens, o que implica a total) para a distribuição marginal do total. Dividindo a distribuição conjunta dada na Equação (7.2) por marginais, que é Poisson com média $ \lambda_{..}, $ que nos leva diretamente à distribuição multinomial.
Em segundo lugar, notamos que a estrutura sistemática dos dois modelos é a mesma.
No modelo de independência, a probabilidade conjunta é o produto das marginais:
$$ \pi_{ij}=\pi_{i.}\pi_{j.} $$
Assim tomando o $ \log $ obtemos:
$$ \log\pi_{ij}=\log\pi_{i.}+\log\pi_{.j}, $$
que ainda pode ser escrita em termos das frequências esperadas $ E_{ij} = n\pi_{ij} $ , como:
$$ n\times n\times\pi_{ij}=n\times \pi_{i.}\times n\times\pi_{j.} $$
Aplicando o $ \log $ temos:
$$ \log(n\times \underbrace{n~\pi_{ij}}_{E_{ij}})=\log(\underbrace{n~\pi{i.}}_{E_{i.}})+\log(\underbrace{n~\pi_{.j}}_{E_{.j}}) $$
$$ \log E_{ij}=\log E_{i.}+\log E_{.j}-\log n~~(8.2) $$
Somando em i para a equação 8.2, temos:
$$ \sum^r_{i=1}\log E_{ij}=\sum^r_{i=1}\log E_{i.}+r\log E_{.j}-r\log n $$
Agora somamos em j para a equação 8.2:
$$ \sum^c_{j=1}\log E_{ij}=c\log E_{i.}+\sum^c_{j=1}\log E_{.j}-c\log n $$
que é exatamente a estrutura do modelo de Poisson aditivo:
$$ \log\lambda_{ij}=\eta+\alpha_i+\beta_j $$
Em ambos os casos, o registro da contagem esperada depende da linha e da coluna, mas não a combinação dos dois. Na verdade, é apenas as restrições que diferem entre os dois modelos. O modelo multinomial restringe as probabilidades conjuntas e marginais para adicionar um. O modelo de Poisson utiliza o método de referência das células e conjuntos $ \alpha_1=\beta_1=0. $
Se a estrutura sistemática e aleatória dos dois modelos é a mesma, então não teremos nenhuma surpresa se eles produzirem os mesmos valores ajustados e levar aos mesmos testes de hipóteses. Em (Fienberg,2006) mostra que temos a equivalência das duas distribuições condicionais contidas em $ n $, mas na análise de Poisson o total $ n $ é aleatória e não condicionadas em seu valor. Lembremos, contudo, que o modelo de Poisson, incluindo a constante, reproduz exatamente o total da amostra. Acontece que não necessitamos de condições em n, pois o modelo reproduz o seu valor exato de qualquer maneira.
Uma outra equivalência para o modelo de Poisson está quanto ao uso de outra técnica para o tratamento destes dados, que é a de modelos lineares generalizados, os detalhes destes modelo será tratado em um outro conteúdo estatístico. No software Action este modelo já está implementado, assim usamos esta ferramenta para tratarmos o uso de modelos log lineares para tabelas cruzadas. Portanto, reescrevendo o modelo (8.2) obtemos:
$$ \log E_{ij}=\beta_0+\beta_1~X_1+\beta_2~X_2~~(8.3) $$
A moral desta história é que não precisamos nos preocupar com modelos multinomiais e pode sempre recorrer ao modelo de Poisson equivalentemente. Embora o ganho é trivial no caso de uma tabela $ 2\times 2 $, pode ser muito significativo à medida que avançamos para classificações cruzadas envolvendo três ou mais variáveis, particularmente não temos que nos preocupar com a maximização da probabilidade multinomial sob restrições. O único truque que precisamos aprender é como traduzir as perguntas de independência que surgem no contexto multinomial para os modelos log lineares correspondentes no contexto de Poisson.
Exemplo 8.2
Voltando ao exemplo 8.1
| Tratamento | Efeito | Quantidade |
|---|---|---|
| 1 | 1 | 551 |
| 1 | 2 | 114 |
| 2 | 1 | 213 |
| 2 | 2 | 452 |
em que, para a variável tratamento temos que 1 é o medicamento e 2 é placebo e 1. Já para a variável Efeitos temos que 1 é presente e 2 é ausente. Assim, usando a equação (8.3) temos o seguinte modelo:
$$ \log(E_{ij})=\beta_0+\beta_1*{Treatment}+\beta_2*{Effect} $$
Usando o software Action, temos:
(imagem em falta)
Agora, vamos calcular os valores esperados que é o mesmo para o teste Qui-Quadrado para tabelas cruzadas. Então temos:
$$ E_{11}=\exp\left(\beta_0+\beta_1*1+\beta_2*1\right)=\exp(6.24+(-1.32)*1+(-0.29)*1)=382 $$
$$ E_{12}=\exp\left(\beta_0+\beta_1*1+\beta_2*2\right)=\exp(6.24+(-1.32)*1+(-0.29)*2)=283 $$
$$ E_{21}=\exp\left(\beta_0+\beta_1*2+\beta_2*1\right)=\exp(6.24+(-1.32)*2+(-0.29)*1)=382 $$
$$ E_{22}=\exp\left(\beta_0+\beta_1*2+\beta_2*2\right)=\exp(6.24+(-1.32)*2+(-0.29)*2)=283 $$
Agora, mostramos o resultado obtidos pelo software Action para o teste Qui-Quadrado:
(imagem em falta)
Observe que os valores da tabela dos Valores Esperados são os mesmos obtidos pelo preditor linear do modelo Poisson e o p-valor da estatística Qui-Quadrado é bem próximo do p-valor para o coeficiente do efeito, com isso, temos as mesmas conclusões, ou seja, as variáveis são independentes.
22.9 Aplicações de Tabela Cruzada
Nesta seção, vamos mostrar algumas aplicações da Tabela Cruzada. Todos os casos apresentados são reais e foram elaborados pelo cliente com a participação da equipe Portal Action.
Teste de independência para estudo da quantidade de erro na distribuição de materiais de uma editora
Uma editora quer realizar um estudo sobre a quantidade de erros que acontecem na distribuição de materiais produzidos por duas empresas. Para isso realizamos um estudo considerando duas variáveis, a empresa que produz o exemplar e o número de exemplares faltantes que deveriam ser recebidos pelo distribuidor, estas variáveis foram divididas da seguinte forma:
(imagem em falta)
Iniciamos montando a tabela cruzada das observações:
| A | B | C | Total | |
|---|---|---|---|---|
| Empresa A | 1093 | 1222 | 770 | 3085 |
| Empresa B | 1472 | 908 | 750 | 3130 |
| Total | 2565 | 2130 | 1520 | 6215 |
Tabela 9.1.1: Tabela cruzada.
(imagem em falta)
Agora calculamos as frequências esperadas:

$$E_{11}=\cfrac{3085*2566}{6215}=1273,21$$
$$E_{12}=\cfrac{3085*2130}{6215}=1057,29$$
$$E_{13}=\cfrac{3085*1520}{6215}=754,50$$
$$E_{21}=\cfrac{3130*2565}{6215}=1291,79$$
$$E_{22}=\cfrac{3130*2130}{6215}=1072,71$$
$$E_{23}=\cfrac{3130*1520}{6215}=765,50$$
Dessa forma, montamos uma tabela das frequências esperadas:
| A | B | C | |
|---|---|---|---|
| Empresa A | 1273,21 | 1057,29 | 754,50 |
| Empresa B | 1291,79 | 1072,71 | 765,50 |
Tabela 9.1.2: Frequências esperadas.
Agora calculamos os valores padronizados:

$$Q^2_{11}=\cfrac{(1093-1273.71)^2}{1273.71}=25.51$$
$$Q^2_{12}=\cfrac{(1222-1057.29)^2}{1057.29}=25.66$$
$$Q^2_{13}=\cfrac{(770-754.50)^2}{754.50}=0.32$$
$$Q^2_{21}=\cfrac{(1472-1291.79)^2}{1291.79}=25.14$$
$$Q^2_{22}=\cfrac{(908-1072.71)^2}{1072.71}=25.29$$
$$Q^2_{23}=\cfrac{(750-765.50)^2}{765.50}=0.31$$
Dessa forma, montamos uma tabela com os valores de $ Q^2 $ no ponto $ (i,j) $:
| A | B | C | |
|---|---|---|---|
| Empresa A | 25,51 | 25,66 | 0,32 |
| Empresa B | 25,14 | 25,29 | 0,31 |
Tabela 9.1.3: Valores de $ Q^2 $ no ponto $ (i,j) $.
$$Q^2_{obs}=\sum^r_{i=1}\sum^c_{j=1}\cfrac{(O_{ij}-E_{ij})^2}{E_{ij}}=25.51+25.66+0.32+25.14+25.29+0.31=102.23$$
$${p-value}=P[102,23> \chi^2_{(2-1)(3-1)}|H_0]=6.31744E^{-23}$$
Como obtemos $ Q^2_{obs}=102,23 $ e do $ p-valor=6,31744E^{-23} $, rejeitarmos a hipótese nula. Portanto, concluímos que existe dependência entre a empresa e a falta de exemplares, ao nível de significância de 5%, ou seja, não são independentes.
Agora calculamos as medidas de associação:
- Coeficiente de contingência quadrático médio:
$$\Phi^2=\cfrac{Q^2_{obs}}{n}=\cfrac{102,23}{6215}=0.016$$
- Coeficiente de contingência
$$P=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{1+\frac{Q^2_{obs}}{n}}}=\sqrt{\cfrac{Q^2_{obs}}{n+Q^2_{obs}}}=\sqrt{\cfrac{102,23}{6215+102,23}}=0.127$$
- Coeficiente de Tschuprov
$$T=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{(r-1)(c-1)}}=\sqrt{\cfrac{\frac{102,23}{6215}}{(3-1)(2-1)}}=0.091$$
- Coeficiente de Cramer
$$C=\cfrac{\frac{Q^2_{obs}}{n}}{\min(r-1;c-1)}=\cfrac{\frac{102,23}{6215}}{\min(3-1,2-1)}=0.016$$
Notamos que nos 4 casos o valor do coeficiente é muito baixo, o que significa que a associação entre as variáveis é muito pequena.
Veja a seguir os resultados obtidos pelo software Action para o mesmo exemplo.
(imagem em falta)
Teste de independência para estudo de produtos rejeitados
Uma empresa quer realizar um estudo sobre a quantidade de produtos que foi rejeitado por mês, no primeiro semestre do ano. Para isso realizamos um estudo considerando duas variáveis, ação que refere-se a ação de rejeitar ou não rejeitar o produto e o mês em que a ação foi tomada, estas variáveis foram divididas da seguinte forma:
(imagem em falta)
Iniciamos montando a tabela cruzada das observações:
| Não Rejeitado | Rejeitado | Total | |
|---|---|---|---|
| Janeiro | 357 | 249 | 606 |
| Fevereiro | 383 | 328 | 711 |
| Março | 535 | 295 | 830 |
| Abril | 605 | 354 | 959 |
| Maio | 553 | 554 | 1107 |
| Junho | 425 | 460 | 885 |
| Total | 2858 | 2240 | 5098 |
Tabela 9.2.1: Tabela cruzada.
(imagem em falta)
Agora calculamos as frequências esperadas:

$$E_{11}=\cfrac{606*2858}{5098}=339,73$$
$$\vdots$$
$$E_{62}=\cfrac{885*2240}{5098}=388,86$$
Dessa forma, montamos uma tabela das frequências esperadas:
| Não Rejeitado | Rejeitado | |
|---|---|---|
| Janeiro | 339,73 | 266,27 |
| Fevereiro | 398,6 | 312,4 |
| Março | 465,31 | 364,69 |
| Abril | 537,63 | 421,37 |
| Maio | 620,6 | 486,4 |
| Junho | 496,14 | 388,86 |
Tabela 9.2.2: Frequências esperadas.
Agora calculamos os valores padronizados:

$$Q^2_{11}=\cfrac{(357-339.73)^2}{339.73}=0.88$$
$$\vdots$$
$$Q^2_{62}=\cfrac{(460-388.86)^2}{388.86}=13.02$$
Dessa forma, montamos uma tabela com os valores de $ Q^2 $ no ponto $ (i,j) $:
| Não Rejeitado | Rejeitado | |
|---|---|---|
| Janeiro | 0,88 | 1,12 |
| Fevereiro | 0,61 | 0,78 |
| Março | 10,44 | 13,32 |
| Abril | 8,44 | 10,77 |
| Maio | 7,36 | 9,39 |
| Junho | 10,20 | 13,02 |
Tabela 9.2.3: Valores de $ Q^2 $ no ponto $ (i,j) $.
$$Q^2_{obs}=\sum^r_{i=1}\sum^c_{j=1}\cfrac{(O_{ij}-E_{ij})^2}{E_{ij}}=0 .88+1.12+0.61+0.78+10.44+13.32+8.44+10.77+7.36+9.39+10.20+13.02=86.33$$
$${p-value}=P[86.33> \chi^2_{(6-1)(2-1)}|H_0]=3.95762E^{-17}$$
Como obtemos $ Q^2_{obs}=86,33 $ e do $ p-valor=3,95762E^{-17} $, rejeitarmos a hipótese nula. Portanto, concluímos que existe dependência entre o mês e a ação, ao nível de significância de 5%, ou seja, não são independentes.
Agora calculamos as medidas de associação:
- Coeficiente de contingência quadrático médio:
$$\Phi^2=\cfrac{Q^2_{obs}}{n}=0.02$$
- Coeficiente de contingência
$$P=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{1+\frac{Q^2_{obs}}{n}}}=\sqrt{\cfrac{Q^2_{obs}}{n+Q^2_{obs}}}=0.13$$
- Coeficiente de Tschuprov
$$T=\sqrt{\cfrac{\frac{Q^2_{obs}}{n}}{(r-1)(c-1)}}=0.06$$
- Coeficiente de Cramer
$$C=\cfrac{\frac{Q^2_{obs}}{n}}{\min(r-1;c-1)}=0.02$$
We note that in all 4 cases the coefficient value is very low, which means that the association between the variables is very small.
See below the results obtained by the Action software for the same example.
(image missing)
Appendix
Chi-Square Distribution
| Degrees of Freedom | 97,50% | 95% | 5% | 2,5% |
|---|---|---|---|---|
| 1 | 0,001 | 0,004 | 3,841 | 5,024 |
| 2 | 0,051 | 0,103 | 5,991 | 7,378 |
| 3 | 0,216 | 0,352 | 7,815 | 9,348 |
| 4 | 0,48 | 0,71 | 9,49 | 11,14 |
| 5 | 0,83 | 1,15 | 11,07 | 12,83 |
| 6 | 1,24 | 1,64 | 12,59 | 14,45 |
| 7 | 1,69 | 2,17 | 14,07 | 16,01 |
| 8 | 2,18 | 2,73 | 15,51 | 17,53 |
| 9 | 2,7 | 3,33 | 16,92 | 19,02 |
| 10 | 3,25 | 3,94 | 18,31 | 20,48 |
| 11 | 3,82 | 4,57 | 19,68 | 21,92 |
| 12 | 4,4 | 5,23 | 21,03 | 23,34 |
| 13 | 5,01 | 5,89 | 22,36 | 24,74 |
| 14 | 5,63 | 6,57 | 22,68 | 26,12 |
| 15 | 6,26 | 7,26 | 25 | 27,49 |
| 16 | 6,91 | 7,96 | 26,3 | 28,85 |
| 17 | 7,56 | 8,67 | 27,59 | 30,19 |
| 18 | 8,23 | 9,39 | 28,87 | 31,53 |
| 19 | 8,91 | 10,12 | 30,14 | 32,85 |
| 20 | 9,59 | 10,85 | 31,41 | 34,17 |
| 21 | 10,28 | 11,59 | 32,67 | 35,48 |
| 22 | 10,98 | 12,34 | 33,92 | 36,78 |
| 23 | 11,69 | 13,09 | 35,17 | 38,08 |
| 24 | 12,4 | 13,85 | 36,42 | 39,36 |
| 25 | 13,12 | 14,61 | 37,65 | 40,65 |
| 26 | 13,84 | 15,38 | 38,89 | 41,92 |
| 27 | 14,57 | 16,15 | 40,11 | 43,19 |
| 28 | 15,31 | 16,93 | 41,34 | 44,46 |
| 29 | 16,05 | 17,71 | 42,56 | 45,72 |
| 30 | 16,79 | 18,49 | 43,77 | 46,98 |
Table: values of $ \nu_C $ such that $P(\chi^2\geq \nu_C) = p$
Bibliographic References
- Agresti, A. (2002) Categorical Data Analysis. New York: Wiley.
- Berger, V.W. (2000) Pros and cons of permutation tests in clinical trials. Statistics in Medicine, 19, 1319-1328.
- Conover, W.J. (1974) Some reasons for not using the Yates continuity correction on 2 x 2 contingency tables. Journal of the American Statistical Association, 69, 374-376.
- Fisher, R. A. (1934) Statistical Methods for Research Workers. 5th Edition, Edinburgh: Oliver and Boyd.
- Grizzle, J.E. (1967) Continuity correction in the 2 test for 2 x 2 tables. The American Statistician, 21, 28-32.
- Haber, M. (1980) A comparison of some continuity corrections for the chi-squared test on 2 x 2 tables. Journal of the American Statistical Association, 75, 510-515.
- Haber, M. (1982) The continuity correction and statistical testing. International Statistical Review, 50, 135-144.
- Kendall, M.G. and Stuart, A. (1967) The Advanced Theory of Statistics. Vol 2, 2nd Edition, London: Griffin.
- Mantel, N. (1976) The continuity correction. The American Statistician, 30, 103-104.
- Maxwell, E. A. (1976) Analysis of contingency tables and further reasons for not using Yates correction in 2 x 2 tables. Canadian Journal of Statistics, 4, 277-290.
- Pearson, E.S. (1947) The choice of statistical tests illustrated on the interpretation of data classified in a 2 x 2 table. Biometrika, 34, 139-167.
- Plackett, R.L. (1964) The continuity correction in 2 x 2 tables. Biometrika, 51, 327-337.
- Richardson, J.T.E. (1990) Variants of chi-square for 2 x 2 contingency tables. British Journal of Mathematical and Statistical Psychology, 43, 309-326.
- Richardson, J.T.E. (1994) The analysis of 2 x 1 and 2 x 2 contingency tables: an historical review. Statistical Methods in Medical Research, 3, 107-133.
- Salsburg, D. (2002) The Lady Tasting Tea: How Statistics Revolutionized Science in the Twentieth Century. London: Owl Books.
- Siegel, S. and Castellan, N.J. (1988) Nonparametric Statistics for the Behavioral Sciences. 2nd Edition, New York: McGraw-Hill.
- Yates, F. (1934) Contingency tables involving small numbers and the 2 test. Journal of the Royal Statistical Society, Suppl.1, 217-235.
- Yates, F. (1984) Tests of significance for 2 x 2 contingency tables. Journal of the Royal Statistical Society Series A, 147, 426-463.
- S. E. Fienberg. Log-linear Models in Contingency Tables. Wiley Online Library, 2006.