How do you measure the association or correlation between a continuous variable and a categorical variable?

Quick Overview

Asks how to measure the association between a continuous variable and a categorical one, whether the category is binary, nominal or ordinal. It tests whether you can pick a measure that fits the type of category, separate effect size from significance, and spot the pitfalls of sparse, high-cardinality categories.

How do you measure the association or correlation between a continuous variable and a categorical variable?

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Other

How do you measure the association or correlation between a continuous variable and a categorical variable? For example, you want to know how strongly order value is associated with the acquisition channel a customer came from. ```hint Split the variance Look at how much of the continuous variable's total variation lies between the category means and how much lies within each category. ``` ```hint Kind of category Ask whether your answer changes when the category has two levels, many unordered levels, or levels with a natural order. ``` ### What a Strong Answer Covers - A measure matched to the type of categorical variable: binary, nominal with several levels, or ordinal - The definition of the correlation ratio and the variance decomposition behind it - The difference between an effect size and a significance test, and which test goes with which measure - The assumptions involved and what to use when they fail - Pitfalls such as integer-coding nominal levels and inflated values with many sparse categories ### Follow-up Questions - The category is a zip code with 3,000 levels and only a few rows per level. Why might eta squared look large, and what would you do about it? - The group means are equal but the variances differ a lot. Which of these measures would detect the association? - How does eta squared relate to the R-squared of a regression on dummy variables? - How would you measure association between two categorical variables instead?

Overview: Asks how to measure the association between a continuous variable and a categorical one, whether the category is binary, nominal or ordinal. It tests whether you can pick a measure that fits the type of category, separate effect size from significance, and spot the pitfalls of sparse, high-cardinality categories.

Nov 25, 2026
mediumData ScientistOtherStatistics & Math
0
0

How do you measure the association or correlation between a continuous variable and a categorical variable?

For example, you want to know how strongly order value is associated with the acquisition channel a customer came from.

What a Strong Answer Covers Guidance

  • A measure matched to the type of categorical variable: binary, nominal with several levels, or ordinal
  • The definition of the correlation ratio and the variance decomposition behind it
  • The difference between an effect size and a significance test, and which test goes with which measure
  • The assumptions involved and what to use when they fail
  • Pitfalls such as integer-coding nominal levels and inflated values with many sparse categories

Follow-up Questions Guidance

  • The category is a zip code with 3,000 levels and only a few rows per level. Why might eta squared look large, and what would you do about it?
  • The group means are equal but the variances differ a lot. Which of these measures would detect the association?
  • How does eta squared relate to the R-squared of a regression on dummy variables?
  • How would you measure association between two categorical variables instead?