Categorical
Association
Learn how to organize, display, and interpret relationships between two categorical variables using two-way tables and conditional distributions.
What Are Categorical Variables?
A categorical variable places individuals into one of several groups or categories. Unlike numerical variables, categorical data cannot be meaningfully averaged or summed: instead, we count how often each category occurs.
The Two-Way Table
A two-way table (also called a contingency table) displays counts for every combination of two categorical variables. Rows represent one variable; columns represent the other.
| Prefers Coffee | Prefers Tea | Total | |
|---|---|---|---|
| Students | 120 | 80 | 200 |
| Faculty | 90 | 60 | 150 |
| Total | 210 | 140 | 350 |
Three Types of Distributions
Computing Conditional Distributions
Using our coffee/tea example for Students:
These proportions must sum to \(1.00\) within each row.
Segmented Bar Charts
A segmented bar chart displays conditional distributions visually. Each bar represents one category of the explanatory variable, divided into segments for the response variable.
What Association Looks Like
Now consider different data where the conditional distributions do differ:
| Exercise Regularly | Don't Exercise | Total | |
|---|---|---|---|
| Under 30 | 140 | 60 | 200 |
| 30 and Over | 80 | 120 | 200 |
| Total | 220 | 180 | 400 |
Association vs. No Association
| Association Present | No Association | |
|---|---|---|
| Conditional distributions | Differ across groups | Same across groups |
| Segmented bars | Bars have different segment widths | Bars look identical |
| Conditional \(\neq\) Marginal? | Yes: knowing group changes the distribution | No: group membership is irrelevant |
| Interpretation | One variable helps predict the other | Variables are independent |
Formal Definition of Independence
If the observed counts closely match the expected counts, the data are consistent with independence. Large discrepancies suggest association.
How to Analyze a Two-Way Table
Example 1: Study Method and Grades
A survey of 300 students recorded their primary study method and whether they earned an A in the course:
| Earned A | Did Not Earn A | Total | |
|---|---|---|---|
| Flashcards | 48 | 72 | 120 |
| Practice Problems | 63 | 42 | 105 |
| Re-reading Notes | 15 | 60 | 75 |
| Total | 126 | 174 | 300 |
Example 1: Visualization
Example 2: Computing Expected Counts
A hospital records patient satisfaction (Satisfied / Not Satisfied) by ward (A / B). Is there an association?
| Satisfied | Not Satisfied | Total | |
|---|---|---|---|
| Ward A | 60 | 40 | 100 |
| Ward B | 90 | 10 | 100 |
| Total | 150 | 50 | 200 |
Example 2: Full Expected Table
| Satisfied (Exp) | Not Satisfied (Exp) | |
|---|---|---|
| Ward A | 75 | 25 |
| Ward B | 75 | 25 |
Common Mistakes
Summary of Key Concepts
| Concept | Formula / Rule | Purpose |
|---|---|---|
| Joint Distribution | \(\frac{\text{cell count}}{\text{grand total}}\). | Proportion in both categories |
| Marginal Distribution | \(\frac{\text{row/col total}}{\text{grand total}}\). | Distribution of one variable |
| Conditional Distribution | \(\frac{\text{cell count}}{\text{row total}}\). | Distribution given a group |
| Expected Count | \(\frac{(\text{row total})(\text{col total})}{\text{grand total}}\). | Count under independence |
| Association Test | Compare conditional distributions | Detect relationship |
Question 1 of 5
In a two-way table with a grand total of 500, row total of 200, and column total of 150, what is the expected count for that cell under independence?
Question 2 of 5
Two categorical variables show no association. Which of the following must be true?
Question 3 of 5
A researcher surveys 400 people about handedness (Left / Right) and favorite sport (Soccer / Basketball). The table shows:
Left-handed: 30 Soccer, 20 Basketball (50 total)
Right-handed: 210 Soccer, 140 Basketball (350 total)
What is \(P(\text{Soccer} \mid \text{Left-handed})\)?
Question 4 of 5
A segmented bar chart shows that \(80\%\) of Group A prefers Option X, while only \(45\%\) of Group B prefers Option X. Which conclusion is most appropriate?
Question 5 of 5
In a two-way table, dividing each cell count by the grand total produces which type of distribution?