How do you measure the association or correlation between two categorical variables?

Quick Overview

Asks how to measure association between two categorical variables, such as device type and subscription plan. Tests whether you can separate testing for an association from measuring its strength, handle sparse tables, and pick a measure suited to ordinal or direction-aware cases.

How do you measure the association or correlation between two categorical variables?

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Other

How do you measure the association or correlation between two categorical variables? For example, you want to know how strongly a user's device type is related to the subscription plan they choose. ```hint Start from counts Two categorical variables can be summarized by a table of counts. Ask what those counts would look like if the variables were independent. ``` ```hint Two separate questions Whether an association exists and how strong it is are different questions, and sample size affects them differently. ``` ### What a Strong Answer Covers - The contingency table and the expected counts under independence - The chi-square test of independence, its degrees of freedom, and when its approximation breaks down - A normalized effect size such as Cramér's V or phi, and why the raw chi-square statistic is not one - Alternatives for direction-aware association and for ordinal categories ### Follow-up Questions - Your table has 200,000 rows, the chi-square p-value is below 0.001, and Cramér's V is 0.03. What do you conclude? - Several cells have expected counts below 5. What do you do? - When would you prefer Theil's U over Cramér's V, for example when screening features for a model? - How would you measure the association between a categorical variable and a continuous one?

Overview: Asks how to measure association between two categorical variables, such as device type and subscription plan. Tests whether you can separate testing for an association from measuring its strength, handle sparse tables, and pick a measure suited to ordinal or direction-aware cases.

General logo
General
Nov 25, 2026
mediumData ScientistOtherStatistics & Math
0
0

How do you measure the association or correlation between two categorical variables?

For example, you want to know how strongly a user's device type is related to the subscription plan they choose.

What a Strong Answer Covers Guidance

  • The contingency table and the expected counts under independence
  • The chi-square test of independence, its degrees of freedom, and when its approximation breaks down
  • A normalized effect size such as Cramér's V or phi, and why the raw chi-square statistic is not one
  • Alternatives for direction-aware association and for ordinal categories

Follow-up Questions Guidance

  • Your table has 200,000 rows, the chi-square p-value is below 0.001, and Cramér's V is 0.03. What do you conclude?
  • Several cells have expected counts below 5. What do you do?
  • When would you prefer Theil's U over Cramér's V, for example when screening features for a model?
  • How would you measure the association between a categorical variable and a continuous one?