# How to create a correlation matrix in a dataset with multiple datatypes?

I am stuck in a peculiar problem where I need to know the correlation between attributes. So far it has been easier, where all of my input attributes used to be only numeric, and hence without any hesitance, I used to generate a Pearson coefficient based correlation matrix. But now I am working with a business stakeholder, and they have provided me a data that has:

2 Discrete numeric attributes

2 Ordinal attributes (non-dichotomous)

5 Nominal attributes (dichotomous)

Following are the datatypes:

Attribute 1: Numeric (skewed)

Attribute 2: Numeric (skewed)

Attribute 3: Ordinal

Attribute 4: Ordinal

Attribute 5: Nominal (dichotomous)

Attribute 6: Nominal (dichotomous)

Attribute 7: Nominal (dichotomous)

Attribute 8: Nominal (dichotomous)

Attribute 9: Nominal (dichotomous)

I googled and found that for different kind of pairs, I need to have a different method and thus a different scale each time, to judge whether a pair of attributes are correlated or not.

Numeric and Numeric: Pearson method

Numeric (skewed) and Numeric (skewed or normal): Spearman method

Ordinal and Numeric (skewed or normal): Spearman method

Ordinal (non-dichotomous) and Ordinal (non-dichotomous): ?? (I am not able to figure out this one)

Ordinal and Nominal (dichotomous): Chi-square based Cramer's V method

Nominal (dichotomous) and Nominal (dichotomous): Chi-square based Cramer's V method

Nominal (dichotomous) and Numeric: Logistic/ANOVA/Point-Biserial

At the end of the day, I wanted to produce something like this, where I can easily explain which attributes (categorical or numerical) is correlated with others, in just one place.

Any correction, best-practice, comment or suggestion is most welcome.

• Hi - Just waiting for any direction/guidance even if it doesn't qualify for an answer. Otherwise I am thinking of doing pairwise calculations in Python and building a matrix manually in excel for the client. Commented May 13, 2021 at 19:02