By Elaine Eisenbeisz, Omega Statistics
I would guess every researcher has come across a contingency table. Contingency tables are a type of classification table used in statistics to simultaneously summarize relationships between two categorical variables. (Let's call them Variable X and Variable Y.) Contingency tables are also called two-way tables, cross-tabulation tables (cross-tabs), and frequency distribution tables, because statisticians like to have at least three to five names for everything.
Contingency tables can be used to summarize probability distributions, namely (a) joint, (b) marginal, and (c) conditional distributions. As you can see from the definitions below, the sum of probabilities in each type of distribution must add up to one, which in statistician thinking is 100 percent.
The simplest type of contingency table is a 2x2 table, with two levels of Variable X and two levels of Variable Y. However, they can be larger than 2x2, and they do not have to be uniform. One can have 2x6 tables if they want. However, the different distributions must add up to one (100 percent), as noted above.
Contingency tables can be used to derive much more than distributional probabilities, and this is why they are so useful in clinical research and diagnostic testing to compare observed effects with effects predicted from a statistical model, such as a logistic regression, or to investigate adverse events between treatment arms.
In this article I will show a simple 2x2 contingency table and how you can derive many useful statistics from the information presented. Figure 1 is a template of how to set up the classification table; each of the fours cells is given a letter for reference (a, b, c, or d).
Figure 2 is a contingency table with data comparing the subjects in two study arms of (a) treatment or (b) control, with the occurrence of an adverse event (AE; AE = yes vs. AE = no). Each of the 1,000 study subjects was classified into only one of the four available cells in the classification table.
Figure 1: Contingency (cross-tabulation) table with cell descriptors (a, b, c, d) for ease of reference
Figure 2: Contingency (cross-tabulation) table of the Variable X (study arm: two levels of treatment vs. control) and Variable Y (adverse event classification: two levels of adverse event = yes vs. adverse event = no). A total of 1,000 subjects were classified.
The probability distributions can be found as:
Joint Distributions of the Four Cells:
The four percentages add up to 100 percent (probability of one). So that is good!
Marginal Distributions of Rows (Variable X, Study Arm)
The percentages of the two rows add up to 100 percent. We're happy!
Marginal Distributions of the Columns (Variable Y, Adverse Event Status)
The percentages of the two columns add up to 100 percent. We're still happy!
Each of the four pairs adds up to 100 percent, so we are totally happy!
But wait, there's more! The cells of the 2x2 contingency table can be used to derive many other useful statistics and measurements. I won't go into detail on each one. Figure 3 is a presentation of measurements and associated formulas that can be used to derive numbers from contingency tables. In the formulas, N is the total number of subjects. (We used 1,000 subjects in our example.)
Some of the measurements are better used in diagnostic or genetic testing. I adjusted the contingency table cell names to show the proper setup for predicted vs. observed values.
However, some of the formulas are useful in our example of adverse events. For instance:
Figure 3: Generic contingency table format and table of measurement formulas
As we've seen, statistics do not have to be complicated to be useful. Contingency tables are a great example of setting up your numbers in a particular way so that you can obtain important information with just simple math. I didn't cover statistical tests for contingency tables. However, if you would like to learn more about contingency tables and the statistical tests that can be used with the tables (such as chi-square and Fisher's Exact Test), check out my webinar Chi-Square and Friends: Fun with Contingency Tables. It is an overview, but I include some more details and a few references.
I would also like to know what statistical concepts or applications you want to know more about, so I can write future columns that are interesting and informative. So let me know your ideas by posting a comment below or by emailing me at elaine@OmegaStatistics.com.
About The Author
Elaine Eisenbeisz is a private practice statistician and owner of Omega Statistics, a statistical consulting firm based in southern California.
Eisenbeisz earned her B.S. in statistics at UC Riverside, received her master's certification in applied statistics from Texas A&M, and is currently finishing her graduate studies at Rochester Institute of Technology. She is a member in good standing with the American Statistical Association and a member of the Mensa High IQ Society. Omega Statistics holds an A+ rating with the Better Business Bureau.
Eisenbeisz works as a contract statistician providing study design and data analysis for private researchers and biotech startups as well as for larger companies such as Allergan and Rio Tinto Minerals. Throughout her tenure as a private practice statistician, she has published work with researchers and colleagues in peer-reviewed journals. You can reach her at (877) 461-7226 or elaine@OmegaStatistics.com.