How to calculate and interpret correlation for binary or categorical variables (point-biserial, phi, Cramer's V)
Quick Overview
Asks how to measure association when one or both variables are binary or categorical, using point-biserial correlation, phi and Cramer's V. Tests whether you can match each measure to the variable types, compute it, and read its size and sign correctly.
How to calculate and interpret correlation for binary or categorical variables (point-biserial, phi, Cramer's V)
Role: Data Scientist
Category: Statistics & Math
Difficulty: medium
Interview Round: Other
How do you calculate and interpret correlation when one or both variables are binary or categorical (e.g., point-biserial, phi, Cramer's V)?
Cover three cases: one binary and one continuous variable, two binary variables, and two categorical variables that may have more than two levels.
```hint Start from Pearson
Write out Pearson's r and ask what happens to it when one or both variables only take the values 0 and 1.
```
```hint Unordered categories
For two nominal variables, think about the test of independence you already use on a contingency table and how its statistic could be scaled to a bounded number. Then ask whether a sign would mean anything.
```
### What a Strong Answer Covers
- Which measure fits each pairing of variable types
- How each measure is computed, including how it relates to Pearson's r or the chi-square statistic
- The range of each measure and whether its sign carries meaning
- Conditions that distort the value, such as unbalanced groups, unequal marginals, sparse cells and table size
- What to use for pairings outside these three, such as ordinal data or a multi-level category against a continuous variable
### Follow-up Questions
- Two binary variables are as strongly associated as their marginal proportions allow, yet phi is only 0.4. Why can that happen?
- When would you use the biserial or tetrachoric correlation instead of point-biserial or phi?
- How would you measure association between a multi-level categorical feature and a continuous target, and how does that relate to one-way ANOVA?
- Cramer's V is symmetric. When would you want an asymmetric measure instead?
Overview: Asks how to measure association when one or both variables are binary or categorical, using point-biserial correlation, phi and Cramer's V. Tests whether you can match each measure to the variable types, compute it, and read its size and sign correctly.