August 12

Contingency Tables – Your Top Questions Answered (and more)

Blog, Discover Visualisation

0  comments

Contingency Tables are some of the most used types of graphs in statistics, but perhaps less well-known for everyone else.

That is a shame, because they convey a huuuge amount of information about your data - information that you need to know to make important decisions!

Trust me on this.

During the 8 years of my previous job as a Medical Statistician there wasn't a day went by that I didn't look at a Contingency Table. They really are that important!

And they're not difficult to create, either.

If you want to engage your audience and produce well-crafted Contingency Tables that can inspire your audience, there are only a few simple data visualisation best practices that you need to follow.

And they are all here!

Disclosure: we may earn an affiliate commission for purchases you make when using the links to products on this page. As an Amazon Affiliate we earn from qualifying purchases.

In this guide on how to choose the right chart for your data, I’ll explain about the different types of Contingency Tables you’ll come across.

Then I’ll show you which data goes where.

I’ll show you the different types of Contingency Tables to use, and how to choose the right chart for your data.

We’ll move on to how to review Contingency Tables with a critical eye so that you know how to interpret them correctly.

FREE DataViz Flowchart

DataViz - The Big Picture

Master the Fundamentals of Data Visualisation

Ultra-Hi-Definition PDF

By the time you’ve read this dataviz guide, you’ll know more about plotting charts than pretty much everyone around you!

Your DataViz Jump-Station

This post is part of a series of articles about the most used types of graphs in statistics for presenting data.

You can use the following jump-station to choose the content you're looking for (and there will be another jump-station at the bottom of this post):

DataViz Jump-Station

This post is part of a series on the most used graphs in statistics.

For more detail, choose from the options below:

DataViz:

How to Choose The Right Chart for Your Data

Contingency Table

What is a Contingency Table?

A Contingency Table is a type of table in a matrix format that shows the distribution of one variable in rows and another in columns.

Contingency Tables - How to Choose the Right Chart for Your Data @chi2innovations #datavisualization #charts

Click to Tweet

What does a Contingency Table show?

A Contingency Table (aka a cross tabulation) is used to summarise the relationship between 2 or more categorical variables. It is the categorical equivalent of the Scatter Plot.

VIDEO COURSE

Statistics:

The Big Picture

Free to try - no need to buy or register!

Types of Contingency Table

There are 3 types of Contingency Table you will encounter in statistics:

  • 2x2 Contingency Table
  • MxN Contingency Table
  • Multiple 2x2 Contingency Tables
DataViz - 3 Types of Contingency Table

2x2 Contingency Table.

This is the simplest type of Contingency Table. It is also the most powerful, as it has a whole branch of statistics dedicated to its analysis. If you have a pair of categorical variables, each with only 2 categories, and you wish to investigate their relationship, the 2x2 Contingency Table is how you visualise these data. Results of a Fisher’s Exact Test is usually used to accompany any 2x2 Contingency Table.

Types of Contingency Table - 2x2 Contingency Table

MxN Contingency Table.

Contingency Tables are not restricted to the 2x2 variety – they can come in any size, corresponding to the number of categories of each variable. However, the more categories each variable has, the more difficult it becomes to ‘read’ the Contingency Table, and the statistical measures are considerably less powerful. Results of a Chi-Squared Test (which is less powerful than the Fisher’s Exact Test) is usually used to accompany any MxN Contingency Table.

Types of Contingency Table - MxN Contingency Table

Multiple 2x2 Contingency Tables.

When you have an MxN Contingency Table, you would usually aggregate regions of the table to form Multiple 2x2 Contingency Tables, each of which is then analysed by the more powerful statistical methods. Bear in mind, though, that for each MxN table, you will get (M-1)x(N-1) new 2x2 Contingency Tables to analyse! The upside is that if there is a region in the MxN Contingency Table that is significantly different from the rest, this methodology will find it.

Types of Contingency Table - Multiple 2x2 Contingency Tables

Contingency Table Example

If you had a column of categorical data corresponding to Gender, and another corresponding to whether they are left-handed or right-handed, you would count all the men who are left-handed, and count all those that are right-handed. Do the same with the women, then put them into a Contingency Table, like this:

DataViz - Contingency Table Example

Contingency Table Example – Interpretation

In the Contingency Table example above, note how the feature of interest is (as always) on the vertical axis.

Typically, when analysing Contingency Tables, you should look at the diagonals. If the numbers in one of the diagonals are much larger than those on the other diagonal, that is usually a sign that there is a relationship between the variables.

Interpreting Contingency Tables is not simple, and often requires additional analyses, but in this case, it is very easy. The numbers in one diagonal are not bigger or smaller than the other diagonal, so there is not likely to be a relationship between gender and handedness.

Conversely, though, take a look at the left-most column. Whilst the chances of men and women being right-handed are almost identical (43 versus 44), the chances of men being left-handed (the right-most column) are more than double that of women (9 versus 4).

Do you see now why it is not easy to interpret Contingency Tables, and why you always need to accompany it with the results of a statistical test?

A Fisher’s Exact Test of these data confirm that the association is not significant, and that men are not more likely to be left-handed than women.

FREE DataViz Flowchart

DataViz - The Big Picture

Master the Fundamentals of Data Visualisation

Ultra-Hi-Definition PDF

When To Use Contingency Tables

You use Contingency Tables when you have a pair of variables that are categorical, and they classify outcomes in rows and columns, where the cells at the intersections indicate how often both events coincided.

For example, if you had a Gender column [Male, Female] and a Breast Cancer column [Yes, No] of data, you would tally all the men that had breast cancer, and all those that didn’t, and do similarly with women. This would form a 2x2 Contingency Table (or matrix), which could then be analysed to determine if the likelihood of men getting breast cancer is different to that of women.

When To Avoid Contingency Tables

If the total number of observations is small or any of the row or column totals is small, then results may be misleading. You also shouldn’t use Contingency Tables when an observation can fall into more than one cell of the table.

Contingency Tables - Best Practice

  • Contingency Tables are difficult to ‘read’ – they should be accompanied by an appropriate statistic, such as the Chi-Squared Test or Fisher’s Exact Test (which in themselves can be difficult to understand)
  • Only use when the cell values are not small
  • Consult a statistician to ensure your interpretations are correct!

SOME OF OUR FAVOURITE DATAVIZ BOOKS aT AMAZON

Contingency Tables – Summary

Contingency Tables are among the most used types of graphs in statistics, despite not being very well known outside data analyst circles.

Hopefully, you now have a much better understanding of Contingency Tables, why they are so important, when to use them, and how to present them to inspire those around you to change the world for the better.

Contingency Tables: What they are and how to use them

Pin it for later

Loved it?

Pin it to your favourite board!

Your DataViz Jump-Station

Looking for your next step?

You can use the following jump-station to choose the content you're looking for: