Why is Pearson correlation misleading on one-hot encoded or nominal categorical data?

Quick Overview

Asks why a Pearson correlation computed on nominal categorical features, stored as integer codes or one-hot columns, gives misleading numbers. Tests understanding of measurement scales, encoding artifacts, multicollinearity among dummies, and the association measures that suit categorical data.

Why is Pearson correlation misleading on one-hot encoded or nominal categorical data?

Role: Data Scientist

Category: Statistics & Math

Difficulty: medium

Interview Round: Other

Why is using a plain Pearson correlation coefficient on one-hot encoded or nominal categorical data generally inappropriate or misleading? Picture a nominal feature such as color (red, green, blue) that has been stored either as integer codes or as one-hot dummy columns before someone computes a correlation matrix. ```hint Try relabeling Assign the integer codes to the categories in a different order and ask whether the coefficient should change. ``` ```hint Look at the dummies together Write down what the one-hot columns of a single variable add up to in every row, and what that forces their covariance to be. ``` ### What a Strong Answer Covers - The assumptions behind Pearson (interval scale, meaningful order and spacing, linear relationship) and which of them nominal data violates - What happens to the coefficient when the integer codes are permuted - What Pearson on a single dummy column does and does not measure, and the negative correlation that dummies of one variable have by construction - Association measures that fit categorical-categorical and categorical-continuous pairs - The link to multicollinearity when dummy columns go into a regression ### Follow-up Questions - How is Cramér's V computed from a contingency table, and what are its limits when the table is sparse or has many levels? - For an ordinal variable such as a 1-5 satisfaction rating, which correlation measure would you choose, and why? - What goes wrong if you put all k dummies of a variable plus an intercept into a linear regression, and how do you fix it? - How would you build a single association matrix for a dataset that mixes numeric, binary and nominal features?

Overview: Asks why a Pearson correlation computed on nominal categorical features, stored as integer codes or one-hot columns, gives misleading numbers. Tests understanding of measurement scales, encoding artifacts, multicollinearity among dummies, and the association measures that suit categorical data.

PracHub logo
General
Nov 24, 2026
mediumData ScientistOtherStatistics & Math
0
0

Why is using a plain Pearson correlation coefficient on one-hot encoded or nominal categorical data generally inappropriate or misleading?

Picture a nominal feature such as color (red, green, blue) that has been stored either as integer codes or as one-hot dummy columns before someone computes a correlation matrix.

What a Strong Answer Covers Guidance

  • The assumptions behind Pearson (interval scale, meaningful order and spacing, linear relationship) and which of them nominal data violates
  • What happens to the coefficient when the integer codes are permuted
  • What Pearson on a single dummy column does and does not measure, and the negative correlation that dummies of one variable have by construction
  • Association measures that fit categorical-categorical and categorical-continuous pairs
  • The link to multicollinearity when dummy columns go into a regression

Follow-up Questions Guidance

  • How is Cramér's V computed from a contingency table, and what are its limits when the table is sparse or has many levels?
  • For an ordinal variable such as a 1-5 satisfaction rating, which correlation measure would you choose, and why?
  • What goes wrong if you put all k dummies of a variable plus an intercept into a linear regression, and how do you fix it?
  • How would you build a single association matrix for a dataset that mixes numeric, binary and nominal features?