0
$\begingroup$

For ratio scale data it is relatively simple to create and visualize a correlation matrix e.g. as shown below. Ho can I do the same for a data frame that contains also nominal scale data? I would like to see associations (e.g. Cramer's Phi or others) for nominal-nominal, and nominal-ratio pairs and correlation for ratio-ratio pair variables. Something like the matrix the sweetviz pyhton package generates for an automatic exploratory data analysis.

I appreciate each answer.

import seaborn as sns
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(15, 15))  # Sample figsize in inches (width, heights)
hm = sns.heatmap(df[meta_data + summary_ravenscroft].corr(method='spearman'), vmin=-1, vmax=1, annot=True, ax=ax);

# Give a title to the heatmap. Pad defines the distance of the title from the top of the heatmap.
hm.set_title('Correlation Heatmap', fontdict={'fontsize':12}, pad=12);

Update 1 what sweetviz does and what I would like to do: "A major source of insight and unique feature of Sweetviz' associations graph and analysis is that it unifies in a single graph (and detail views):

  1. Numerical correlation (between numerical features)
  2. Uncertainty coefficient (for categorical-categorical)
  3. Correlation ratio (for categorical-numerical) Pairwise sample

Squares represent categorical-featured-related variables and circles represent numerical-numerical correlations. Note that the trivial diagonal is left empty, for clarity."

$\endgroup$
2
  • $\begingroup$ What does sweetviz say it does? If it it ambiguous, do you have access to the source code to see what it does? If it is clear, do you have access to the source code to (trust but) verify what it does? $\endgroup$ Commented Sep 27, 2024 at 11:08
  • $\begingroup$ I added an update, the source code of sweetviz I havn't checked. $\endgroup$ Commented Sep 27, 2024 at 16:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.