When we collect data by counting things in various categories, like red, blue, or yellow, we call the data “categorical data,” and we say that color is a “categorical variable.”
We can use two-way tables to investigate possible connections between two categorical variables.
For example, this two-way table of frequencies shows the results of a study of meditation and state of mind of athletes before a track meet.
| meditated | did not meditate | total | |
|---|---|---|---|
| calm | 45 | 8 | 53 |
| agitated | 23 | 21 | 44 |
| total | 68 | 29 | 97 |
If we are interested in the question of whether there is an association between meditating and being calm, we might present the frequencies in a bar graph, grouping data about those who meditated and those who did not meditate, so we can compare the numbers of calm and agitated athletes in each group.
Notice that the number of athletes who did not meditate is small compared to the number who meditated (29 as compared to 68, as shown in the table).
If we want to know the proportions of calm meditators and calm non-meditators, we can make a two-way table of relative frequencies and present the relative frequencies in a segmented bar graph.
| meditated | did not meditate | |
|---|---|---|
| calm | 66% | 28% |
| agitated | 34% | 72% |
| total | 100% | 100% |