2
$\begingroup$

Question

I implemented the approach mentioned in this answer and applied it to a car dataset, where I am focused on the correlation between brand (categorical) and the price (continuous variable). The description of the data could be found here.

The result I got looks like following, where I only include the correlation of maximum and minimum absolute value.

...
mercedes-benz: 0.5603995843314602
...
nissan: -0.06261400477790607
...

However, I am not sure how should I interpret this result. More specifically, does this mean "mercedes-benz" has larger correlation (absolute value) because the brand name could better explain the price while "nissan" could not?

The following are histograms of two brands (top - "nissan", bottom - "mercedes-benz") enter image description here enter image description here

$\endgroup$
1

1 Answer 1

2
$\begingroup$

I am the user that wrote the linked answer on computing correlation between categorical variables and continuous variables. This answer merely notes how the correlation is computed between these kinds of variables --- it does not suggest plotting the correlation values as a useful visual description of the data. In my view, it is not very useful for you to plot these correlation values. As you will see from the correlation formulae, the correlation values are really just comparisons of the conditional mean of individual categories compared to the overall mean taken over all categories. It is not adding any information beyond knowledge of the sample means of the categories.

For that reason, if you want to plot something here, it would be much more informative (and simpler) for you to use a standard plot showing a comparison between a categorical variable and a continuous variable. A simple boxplot would suffice, but I prefer a jitter-plot (you can find an example here showing a jitterplot with overlayed boxplots). This is a standard plot used for this kind of data. It gives the reader a clear visual summary of the distribution of the continuous variable over each category, and also shows the sample mean of each category. There is no sense trying to reinvent the wheel here --- just use the standard plots for this problem.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you for your explanation. I haven't thought of plotting the boxplot and now I think this would be a good choice for visualization purpose. $\endgroup$
    – Mr.Robot
    Sep 18, 2020 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.