Contingency tables display the frequency distributions of two or more variables at once. They are useful for finding patterns among the variables. They are made by listing all of the categories of one variable as columns and the categories of the other as rows.
In a previous post we created frequency distributions for the 30 companies in the Dow Jones Industrial Average by sector and by size. We can now create a contingency table for both variables.
<250B | 250-500B | 500-750B | 750B-1T | >1T | Total | |
Information Technology | 4 | 1 | 0 | 0 | 2 | 7 |
Industrials | 4 | 0 | 0 | 0 | 0 | 4 |
Healthcare | 2 | 2 | 0 | 0 | 0 | 4 |
Financials | 3 | 1 | 0 | 0 | 0 | 4 |
Consumer Staples | 2 | 2 | 0 | 0 | 0 | 4 |
Consumer Discretionary | 2 | 1 | 0 | 0 | 0 | 3 |
Communication Services | 1 | 1 | 0 | 0 | 0 | 2 |
Materials | 1 | 0 | 0 | 0 | 0 | 1 |
Energy | 1 | 0 | 0 | 0 | 0 | 1 |
Total | 20 | 8 | 0 | 0 | 2 | 30 |
The total for each row or column is the marginal frequency for that category. For example, the information technology sector has a marginal frequency of 7 and stocks with a market cap between 250 and 500 billion have a marginal frequency of 8.
We also see that there are 4 information technology companies with a market cap below 250 billion. This is the joint frequency of the 2 variables.
As with frequency distributions, contingency tables can be presented on a relative (percentage) basis, as shown below.
<250B | 250-500B | 500-750B | 750B-1T | >1T | Total | |
Information Technology | 13% | 3% | 0% | 0% | 7% | 23% |
Industrials | 13% | 0% | 0% | 0% | 0% | 13% |
Healthcare | 7% | 7% | 0% | 0% | 0% | 13% |
Financials | 10% | 3% | 0% | 0% | 0% | 13% |
Consumer Staples | 7% | 7% | 0% | 0% | 0% | 13% |
Consumer Discretionary | 7% | 3% | 0% | 0% | 0% | 10% |
Communication Services | 3% | 3% | 0% | 0% | 0% | 7% |
Materials | 3% | 0% | 0% | 0% | 0% | 3% |
Energy | 3% | 0% | 0% | 0% | 0% | 3% |
Total | 67% | 27% | 0% | 0% | 7% | 100% |