I have a dataset of about 2000 entries, containing two numerical values, one categorical and one sub-categorical label for each entry. The data is from chemistry lab data, but for the purpose of this question I've re-mapped it to contain heights and salaries of some people from either an Asian or a European country (and I've tried to make my mapping to be not based on reality as to be polite...).

To be more concrete, every point of my dataset is either from the three European countries Germany, Poland or Italy, or the three Asian countries Vietnam, Cambodia or Mongolia.

Some entries would look as such


Based on some exploratory data analysis, I have the following two hypotheses:

  1. The height of the people in the dataset mainly depends on which country the person is from. This means that the variation is about the same between the two continents (that is for example, the distribution in Cambodia is just as different from Vietnam as from Germany).
  2. The salary of the people in the dataset manly depends on which continent the person is from, and it is mostly independent from the actual country (that is for example, the salary distribution in Germany is approximately the same as the salary distribution in Poland, but is significantly different from the Mongolian one, which in turn is similar to the Cambodian one)

Due to the nature of my training as a chemist, I've got some experience in hypothesis testing for numerical data, but I've never worked with any categorical labels before, so I am really not sure in what I should be looking at. I've tried to make some basic plots, for example this one

enter image description here

This plot hints me that the salary and the height of the person is independent, and this can indeed be tested by just calculating the correlation between the two numerical values (Which turned out to be -0.29, so they are fairly independent).

It also shows that it looks like each country spans about the whole range of the dataset in salary, while only being somewhat limited in height values. This seems to fit with both of my hypotheses.

It also seems to be true that the differences between countries is much larger in height than in salary.

However, I really don't know how am I supposed to assign numerical values (such as the correlation matrix elements for numerical data) to these observation.

Even if I somehow manage to assign numbers to these correlations, I am not sure how those would then translate to the goodness of my hypotheses.

Could someone provide me in some ideas, or methods, that I could use to answer such a question? The best would be to find a method that I could implement somewhat easily in Python, but of course I am mostly looking at theoretical understanding at this point.


I'm not very knowledgeable about this but here a some ideas:

  • Statistical testing: in order to know whether there is any statistical difference between the values in two categories, one can use the Student t-test (for normal distributions) or the Wilcoxon test (for any distribution).
  • In the case where there is a significant difference there are methods to quantify this difference, i.e. determine how much the category "explains" the variations in value. Unfortunately I don't know much about these.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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