# 6.1 - Two Different Categorical Variables

6.1 - Two Different Categorical Variables

## Example 6.2

Consider the following survey question that was asked of four different samples of Penn State students: 100  freshman (Fr), 100 sophomores (So), 100 juniors (Jr), and 100 seniors (Sr).

Question: Do you currently own at least one credit card?

1. Yes
2. No

The results for the responses to this question are found in Table 6.2 below.

Table 6.2. Responses to Credit Card Ownership by Year in School

Credit Card Response Freshman Sophomore Junior Senior Total
Yes 42 55 76 81 254
No 58 45 24 19 146
Total 100 100 100 100 400

This is an example of a 2 × 4 contingency table because there are 2 rows and 4 columns to the data in the table. Conditioning on the class rank (i.e. looking at the distribution within each column separately), we find that the percentage of Seniors who have a credit card is 81%.  Conditioning on credit card ownership, we find that the percentage of credit card holders in the study who are seniors = 81 / 254 or about 32%.

In this example, the most relevant percentages of interest for comparison are the ones that condition in the class rank.  Table 6.3 shows the conversion of counts to percents for this sample. Each of these percents is called conditional percents because each calculation is restricted to or contingent on the year in school.  In this case, it was trivial to convert the counts into percents because the sample size is exactly 100 for each sample. However, since this doesn't usually happen, it is good practice to include the percentages most relevant to the problem at hand in the table and to include a total that allows the reader to quickly pick out what is adding to 100%.  Of course, the comparison of interest might also be displayed graphically in a cluster bar graph.  Figure 6.4 is an example of a cluster bar graph that displays the conditional percents for the data found in Table 6.3.

Table 6.3. Conditional Percents for Data in Table 6.2

Credit Card Response Freshman Sophomore Junior Senior Total
Yes 42 / 100 = .42 (42%) 55 (55%) 76 (76%) 81 (81%) 254 (63.5%)
No 58 / 100 = .58 (58%) 45 (45%) 24 (24%) 19 (19%) 146 (36.5%)
Total 100 / 100 = 1.00 (100%) 100 (100%) 100 (100%) 100 (100%) 400 (100%)

Figure 6.3. Credit Card Ownership by Year in School

The graph in Figure 6.3  above does suggest that there is a difference in the percent of Penn State students who own at least one credit card when considering the year in school.  Specifically, as a Penn State student progresses from freshman to senior year, it is more likely that he or she will own at least one credit card.

You should also notice that there is redundant information on the graph because the question allows for only a "yes" or "no" response. As the percent who say "yes" increases from freshman to senior year, the percent who say "no" also decreases from freshman to senior year. This holds true because the data is summarized as percents within each school year.

 [1] Link ↥ Has Tooltip/Popover Toggleable Visibility