COLLEGE STATISTICS • DESCRIPTIVE STATISTICS

Categorical Association

Quantifying and visualizing the relationship between two qualitative variables using contingency tables and association measures.

Historical Context & Motivation

The quantitative study of relationships among categorical variables emerged from a broader movement in the late nineteenth and early twentieth centuries to bring mathematical rigor to biology, medicine, and the social sciences. Before formal methods existed, researchers often relied on intuition or anecdotal evidence to claim that two qualities—such as a patient's treatment group and their recovery status—were related. The development of categorical association techniques provided a principled framework for deciding whether the distribution of one categorical variable genuinely differs across levels of another, or whether observed patterns are merely artifacts of sampling variability.

The intellectual roots of categorical association stretch back to the emergence of contingency tables—cross-tabulations that display joint frequency counts for two categorical variables. Karl Pearson, building on the foundational work of Francis Galton and the biometric school, formalized the chi-squared statistic in 1900, providing the first broadly applicable test for independence in a two-way table. Subsequent decades saw refinements in measures of association strength, including Cramér's V and the odds ratio, each designed to capture different facets of the relationship between qualitative variables.

1888
Galton's Co-Relations
Francis Galton published his work on co-relations, establishing the conceptual groundwork for measuring the degree to which two characteristics co-occur in a population.
1900
Pearson's Chi-Squared Test
Karl Pearson introduced the chi-squared goodness-of-fit statistic, which was quickly adapted for contingency table analysis and became the standard tool for testing independence between categorical variables.
1935
Fisher's Exact Test
R. A. Fisher proposed an exact probability test for 2 × 2 tables, addressing the limitations of the chi-squared approximation when expected cell counts are small.
1946
Cramér's V Introduced
Harald Cramér formalized V as a normalized measure of association for tables larger than 2 × 2, enabling meaningful comparison of association strength across tables of different dimensions.

The central question that categorical association addresses is deceptively simple: given two qualitative variables measured on the same set of observations, does knowing the value of one variable tell us anything useful about the value of the other? This question pervades research design in epidemiology, marketing analytics, political science, and virtually every discipline that relies on survey or classification data. The descriptive tools covered in this lesson provide the foundation upon which inferential tests—such as the chi-squared test of independence—are later built.

Core Principles & Definitions

Understanding categorical association requires a firm grasp of several interconnected ideas. A categorical variable (also called a qualitative or nominal variable) is one whose values represent distinct groups or labels rather than numerical quantities on a continuous scale. Examples include blood type (A, B, AB, O), political affiliation (Democrat, Republican, Independent), or customer satisfaction rating (Satisfied, Neutral, Dissatisfied). When two such variables are observed on the same individuals, we organize the resulting data in a contingency table (also known as a cross-tabulation or two-way frequency table), which displays the joint and marginal frequencies.

1

Contingency Table

A rectangular array that cross-classifies observations by two categorical variables. Each cell contains the count (or proportion) of observations falling into the intersection of a specific row category and column category. Row and column totals form the marginal distributions.
2

Joint, Marginal & Conditional Distributions

The joint distribution gives the proportion in each cell relative to the grand total. Marginal distributions summarize one variable by collapsing over the other. Conditional distributions express cell proportions relative to a single row or column total and are the key tool for detecting association.
3

Independence vs. Association

Two categorical variables are independent if the conditional distribution of one is identical across all levels of the other. When these conditional distributions differ, the variables exhibit association—the degree and nature of which we seek to quantify.
4

Expected Counts Under Independence

If two variables were truly independent, the expected count for each cell equals (row total × column total) / grand total. Comparing observed counts to these expected counts reveals whether deviations are substantial enough to indicate real association.
5

Measures of Association Strength

Numerical summaries such as Cramér's V, the phi coefficient, and the odds ratio quantify how strongly two categorical variables are related, ranging from no association to perfect association.
KEY TAKEAWAY
Think of categorical association like a seating chart at a large conference. If attendees' table assignments are completely independent of their professional field, you would expect every table to have roughly the same mix of engineers, biologists, and economists—mirroring the overall conference composition. Association means that certain tables are disproportionately populated by certain fields, suggesting that some systematic factor (perhaps shared interests or pre-arranged networking sessions) is linking table choice to profession. Contingency tables let you compare each table's professional breakdown against the conference-wide average to see whether such clustering exists.

Visual Explanation: The Contingency Table

The diagram below presents a complete 2 × 3 contingency table for a hypothetical study examining the association between Exercise Frequency (None, Moderate, High) and Health Outcome (Healthy, Unhealthy). The table shows observed counts, marginal totals, and the conditional distribution of Health Outcome within each exercise category. Comparing conditional percentages across columns reveals whether the proportion classified as Healthy changes with exercise level—a visual hallmark of association.

The top portion shows the observed contingency table with marginal totals. The bottom stacked bars display the conditional distribution of Health Outcome within each Exercise Frequency level. Under independence, all three bars would display a uniform 50%/50% split (matching the overall marginal). The clear gradient from 30% Healthy to 70% Healthy signals a positive association between exercise and health status.

The key diagnostic for association is whether the conditional distributions vary across the columns. In this example, the proportion classified as Healthy rises steadily from 30% among those with no exercise to 70% among those with high exercise. If the two variables were independent, every column would yield the same conditional distribution—here, 50% Healthy and 50% Unhealthy, matching the overall marginal proportions. The systematic departure from this uniform pattern is precisely what we mean by categorical association, and the remainder of this lesson develops tools to measure its magnitude.

Mathematical Framework

Quantifying categorical association requires computing expected counts under the assumption of independence, then measuring how far the observed counts deviate from those expectations. The mathematical framework below builds from expected counts to the chi-squared statistic, and then to normalized measures of association strength.

EXPECTED COUNT
E_ij = (R_i × C_j) / n
where Eij is the expected count for row i and column j, Ri is the total for row i, Cj is the total for column j, and n is the grand total of all observations.

The expected count formula follows directly from the multiplication rule for independent events. If the row variable and column variable are independent, then P(row i ∩ column j) = P(row i) × P(column j). Multiplying this joint probability by the total sample size n yields Eij = (Ri/n)(Cj/n) × n = RiCj/n.

CHI-SQUARED STATISTIC
χ² = Σ (O_ij − E_ij)² / E_ij
where Oij is the observed count in cell (i, j) and the sum runs over all cells. Larger values of χ² indicate greater departure from independence. This statistic has (r − 1)(c − 1) degrees of freedom, where r and c are the numbers of rows and columns.
PHI COEFFICIENT (2 × 2 TABLES)
ϕ = √(χ² / n)
The phi coefficient rescales χ² to the range [0, 1] for 2 × 2 tables. A value of 0 indicates complete independence; a value of 1 indicates perfect association.
CRAMÉR'S V (GENERAL r × c TABLES)
V = √(χ² / (n × (min(r, c) − 1)))
Cramér's V generalizes the phi coefficient to tables of any dimension. It equals ϕ for 2 × 2 tables. The denominator ensures V ranges from 0 to 1 regardless of table size. Guidelines often classify V < 0.1 as negligible, 0.1–0.3 as moderate, and V > 0.3 as strong association.
⚠️ Important Distinction
The chi-squared statistic measures the total evidence against independence, but it is not a measure of association strength because it scales with sample size. Doubling every cell count doubles χ² even though the association pattern is identical. Cramér's V corrects for this by dividing by n, producing a sample-size-independent measure of effect size.

Measures of Association in Detail

Several measures have been developed to capture different aspects of categorical association. The choice of measure depends on the table dimensions, the measurement level of the variables (nominal vs. ordinal), and the research question. The diagram below provides a decision-tree overview, and the subsequent table offers a detailed comparison.

Decision tree for selecting a measure of categorical association. For 2 × 2 tables, the phi coefficient and odds ratio are the primary choices. For larger nominal tables, Cramér's V provides a bounded, interpretable measure. When both variables are ordinal, directional measures such as Goodman–Kruskal gamma or Kendall's tau-b capture whether the association is positive or negative.
Comparison of common measures of categorical association
MeasureTable SizeRangeDirectional?Key Property
Phi (ϕ)2 × 2[0, 1]NoEquivalent to Pearson correlation for two binary variables
Odds Ratio (OR)2 × 2(0, ∞)Yes (OR > 1 vs. < 1)Invariant under row or column multiplication; central to logistic regression
Cramér's VAny r × c[0, 1]NoNormalizes χ² by sample size and table dimension
Goodman–Kruskal γOrdinal r × c[−1, 1]YesBased on concordant and discordant pairs; ignores ties
Kendall's τ-bOrdinal r × c[−1, 1]YesAdjusts for tied pairs; preferred over γ when ties are common

A critical distinction runs through this table: nominal measures (ϕ, Cramér's V) detect only the magnitude of departure from independence, whereas ordinal measures (γ, τ-b) also capture the direction of the relationship—whether higher levels of one variable tend to coincide with higher or lower levels of the other. This makes ordinal measures more informative when the categories possess a natural ordering, such as education level (High School, Bachelor's, Graduate) or pain severity (Mild, Moderate, Severe).

Worked Example: Computing χ² and Cramér's V

A university surveyed 200 students about their preferred study method (Group Study, Solo Study) and their course performance category (Above Average, Average, Below Average). The observed data are shown below. We will compute the chi-squared statistic and Cramér's V to assess whether study method preference and performance are associated.

Observed counts: Study Method × Performance Category
Above AvgAverageBelow AvgRow Total
Group Study40301080
Solo Study205050120
Col Total608060200
Computing χ² and Cramér's V
1
Step 1 — Compute Expected CountsUsing Eij = (Ri × Cj) / n, we find: E(Group, AboveAvg) = (80 × 60) / 200 = 24; E(Group, Avg) = (80 × 80) / 200 = 32; E(Group, BelowAvg) = (80 × 60) / 200 = 24; E(Solo, AboveAvg) = (120 × 60) / 200 = 36; E(Solo, Avg) = (120 × 80) / 200 = 48; E(Solo, BelowAvg) = (120 × 60) / 200 = 36.
Expected counts: 24, 32, 24, 36, 48, 36
2
Step 2 — Compute Each Cell's Contribution to χ²For each cell, compute (O − E)² / E. Cell (Group, AboveAvg): (40 − 24)² / 24 = 256 / 24 ≈ 10.667. Cell (Group, Avg): (30 − 32)² / 32 = 4 / 32 = 0.125. Cell (Group, BelowAvg): (10 − 24)² / 24 = 196 / 24 ≈ 8.167. Cell (Solo, AboveAvg): (20 − 36)² / 36 = 256 / 36 ≈ 7.111. Cell (Solo, Avg): (50 − 48)² / 48 = 4 / 48 ≈ 0.083. Cell (Solo, BelowAvg): (50 − 36)² / 36 = 196 / 36 ≈ 5.444.
Cell contributions: 10.667, 0.125, 8.167, 7.111, 0.083, 5.444
3
Step 3 — Sum to Obtain χ²χ² = 10.667 + 0.125 + 8.167 + 7.111 + 0.083 + 5.444 = 31.597. With df = (r − 1)(c − 1) = (2 − 1)(3 − 1) = 2, this is a very large chi-squared value, strongly suggesting departure from independence.
χ² ≈ 31.60 with df = 2
4
Step 4 — Compute Cramér's VV = √(χ² / (n × (min(r, c) − 1))) = √(31.60 / (200 × (min(2, 3) − 1))) = √(31.60 / (200 × 1)) = √(0.158) ≈ 0.397.
Cramér's V ≈ 0.40 — a strong association
5
Step 5 — Interpret the ResultA Cramér's V of approximately 0.40 indicates a strong association between study method preference and performance category. Examining the conditional distributions confirms the direction: 50% of group studiers performed above average compared to only 16.7% of solo studiers, while 41.7% of solo studiers fell below average versus just 12.5% of group studiers. The association suggests that group study is linked with higher performance in this sample, though causation cannot be inferred from a descriptive analysis alone.

Strengths, Limitations & Common Pitfalls

Strengths and limitations of standard categorical association methods
AspectStrengthsLimitations
GeneralityApplicable to any pair of categorical variables regardless of the number of categories; no distributional assumptions about the dataCannot capture nonlinear or complex interaction patterns within ordinal data as effectively as specialized ordinal measures
InterpretabilityCramér's V is bounded [0, 1], making it easy to communicate; conditional distributions provide intuitive visual comparisonsV = 0.3 may reflect very different association patterns (e.g., one dominant cell vs. diffuse spread); no single number fully describes the pattern
Sample Size SensitivityCramér's V and ϕ normalize for n, allowing fair comparison across studies of different sizesχ² itself inflates with n; with very large samples, even trivially small associations produce large χ² values and apparent 'significance'
Sparse TablesFisher's exact test provides an alternative when expected counts are small, avoiding the chi-squared approximationWhen many cells have expected counts below 5, the chi-squared approximation is unreliable and V may be misleading
CausalityProvides a rigorous descriptive summary of observed patterns, which can motivate further causal investigationAssociation ≠ causation; confounding variables, Simpson's paradox, and selection bias can distort or reverse observed associations
WATCH FOR SIMPSON'S PARADOX
One of the most striking pitfalls in categorical association is Simpson's paradox: a trend that appears in several subgroups can reverse when the subgroups are combined into a single table. This arises when a lurking variable is unevenly distributed across the groups being compared. The classic example comes from UC Berkeley's 1973 admissions data, where an apparent gender bias in overall admissions disappeared—and even reversed—when examined within individual departments. Always consider whether stratification by a third variable might alter your conclusions about the association between two categorical variables.

Connection to Inferential Methods & Advanced Theory

The descriptive measures of categorical association covered in this lesson lay the groundwork for inferential procedures that formally test whether observed associations are statistically significant or merely due to chance. The table below maps each descriptive concept to its inferential counterpart, illustrating how the descriptive toolkit extends naturally into hypothesis testing and modeling.

From descriptive association to inferential and modeling frameworks
Descriptive ConceptInferential / Advanced ExtensionKey Idea
χ² statistic as a descriptive measure of deviationChi-squared test of independenceCompare observed χ² to the chi-squared distribution with (r−1)(c−1) df to obtain a p-value
Odds ratio in a 2 × 2 tableLogistic regressionModels the log-odds of a binary outcome as a linear function of predictors; coefficients exponentiate to odds ratios
Conditional distributions across strataCochran–Mantel–Haenszel testTests for association while controlling for a stratifying variable, addressing Simpson's paradox
Cramér's V as effect sizePower analysis for χ² testsV serves as the effect size parameter when computing required sample sizes for detecting associations
Multi-way contingency tablesLog-linear modelsModel expected cell counts as functions of main effects and interactions among multiple categorical variables simultaneously

Beyond classical methods, modern data science has expanded the toolkit for categorical association. Correspondence analysis provides a dimension-reduction technique analogous to principal component analysis but designed specifically for contingency tables, projecting row and column categories into a low-dimensional space where proximity reflects association. Meanwhile, information-theoretic measures such as mutual information quantify how much knowing one variable reduces uncertainty about the other, connecting categorical association to concepts in machine learning feature selection and decision tree construction. These advanced methods all build upon the foundational ideas of expected versus observed frequencies, conditional distributions, and normalized deviation measures that you have studied in this lesson.

Practice Problems

PROBLEM 1CONCEPTUAL
A researcher constructs a contingency table for two categorical variables and finds that the conditional distributions of one variable are identical across all levels of the other variable. What does this tell us about the association between the two variables? Explain why examining conditional distributions is more informative than simply comparing observed cell counts.
PROBLEM 2BASIC CALCULATION
In a 2 × 2 contingency table with n = 100, the row totals are 40 and 60, and the column totals are 50 and 50. Compute the four expected counts under the assumption of independence.
PROBLEM 3INTERMEDIATE
A 3 × 2 contingency table yields χ² = 12.8 with n = 250. Compute Cramér's V and interpret its magnitude. How many degrees of freedom does this table have?
PROBLEM 4APPLIED
A hospital collects data on 400 patients, cross-classifying Treatment (Drug A, Drug B) by Recovery Status (Full Recovery, Partial Recovery, No Recovery). The observed table is: Drug A → (100, 60, 40) with row total 200; Drug B → (60, 80, 60) with row total 200; column totals are (160, 140, 100). Compute χ², Cramér's V, and comment on whether the treatment appears to be associated with recovery status.
PROBLEM 5CRITICAL THINKING
Suppose you observe a strong positive association between Smoking Status (Smoker, Non-Smoker) and Lung Disease (Yes, No) in the overall population, with Cramér's V ≈ 0.45. However, when you stratify by Occupation (Office Worker, Industrial Worker), the association within each stratum drops to V ≈ 0.10. Explain how this could happen, what statistical phenomenon this illustrates, and what analytical strategy you would recommend.

Lesson Summary

Categorical association refers to the relationship between two qualitative variables, detected by comparing conditional distributions across levels of a grouping variable. When these distributions are identical, the variables are independent; when they differ, association is present. The contingency table organizes the joint, marginal, and conditional frequency data, while expected counts under independence (Eij = RiCj / n) provide the benchmark against which observed counts are compared.

The chi-squared statistic (χ² = Σ(O − E)² / E) aggregates deviations from independence across all cells, but it scales with sample size and is therefore unsuitable as a standalone measure of association strength. Cramér's V normalizes χ² to the [0, 1] range, enabling meaningful comparison across studies. For 2 × 2 tables, the phi coefficient and odds ratio offer additional perspectives, while ordinal tables benefit from directional measures such as Goodman–Kruskal gamma and Kendall's tau. Always remember that association does not imply causation, and be vigilant for Simpson's paradox when lurking variables may confound your results.

Varsity Tutors • College Statistics • Categorical Association