2
$\begingroup$

I have two categorical variables X and Y that each are multi-label e.g. each x and y is a set of labels say $x \subseteq lbls_1$ and $y \subseteq lbls_2$. I want to get a measure of the correlation between the two variables.

I know that Cramér's V can be used to compute the correlation between two categorical variables that take a single value out of a set, e.g. $x \in lbls_1$ and $y \in lbls_2$. Can this be generalized for multiple labels?

I can compute the correlation for each pair of labels separately i.e. for $l \in lbls_1, m \in lbls_2$ create two binary variables $x_l = 1_{l \in x}$ and $y_m = 1_{m \in y}$ and then compute the correlation between $x_l$ and $y_m$. Is this a good way of doing this or is there a better way?

Edit To give a concrete example - say I have a list of cancer trials each with various properties. Property A is the type of treatment in the trial say (a) surgery (b) medication taken by swallowing (c) medication injected into the skin etc. Each trial can include multiple treatment types. Property B is the stages of cancer. It can be directed at stage 1 cancer or stage 2,3,4. It can also be directed at multiple stages. I have hundreds of such properties and I would like to get the associations between them. This is to help in a machine learning task of reading all these properties from free text.

$\endgroup$
2
  • $\begingroup$ I edited the question to make it more clear. I meant for example that if the set of labels is {1,2,3} then the variable can take the value of {1,2} and not only the value 1,2 or 3. $\endgroup$
    – Daniel
    Commented Dec 13, 2022 at 10:55
  • 1
    $\begingroup$ Why do you want to know this? How will this information help you? For instance, while I see serious problems with such an approach, since you have labels that you give numbers, why not calculate the correlation between those numbers? (There are major issues with that, but your objections will be informative.) $\endgroup$
    – Dave
    Commented Dec 13, 2022 at 12:27

1 Answer 1

3
$\begingroup$

The question uses an extraordinarily wide sense of the word correlation, which is already used quite widely in statistics.

The default and major sense of correlation is Pearson (product-moment) correlation, which measures the extent to which counted or measured data for two variables can be summarized by a straight line. In many contexts, but not all, statistical people usually mean precisely this when they refer to correlation, unqualified.

There are various extensions to that, most commonly some measure of rank correlation, say those named for Spearman or Kendall, which focus rather on how far data can be summarized by a monotonic relationship, that is, either a rising line or a falling line, where the rise or fall can be as wiggly as is needed, so long as it is a rise or fall.

You will confuse most readers who know less statistics than you do, and annoy or irritate most reviewers who know more statistics than you do, if you use the term correlation to include any measure of association, which is a much better term for relationships between variables like yours.

All that said:

  1. I can't follow what meaning there might be to an association between one value in one set and one value in another set. Defining notation doesn't help as much as giving an example. I read this as being say that there are 42 observations that are say for variables (a) items of clothing and (b) main colour (a) socks and (b) black, so black socks. That is just a cell frequency or a proportion or percent if scaled by some total in some way. I am probably misunderstanding you there.

  2. The correlation between two binary variables is well defined so long as you have some 0s and some 1s for each variable. See Is it meaningful to calculate Pearson or Spearman correlation between two Boolean vectors?

  3. https://en.wikipedia.org/wiki/Cram%C3%A9r%27s_V and other sources explain that Cramér's V is well defined for two nominal variables. It is not a correlation in even a wide sense; for example, there is no question of sign of relationship. I think it is fair to say that many statistical people find it hard to think about values of this measure as compared with correlation, but that may go all in a circle with how far one has looked at correlations and results for this measure. A simple but fundamental point about correlation is that you can always look at a scatter plot to help you think about it, although in machine learning with many, many variables that may be not so practical.

$\endgroup$
3
  • $\begingroup$ Sorry for the bad use of words. My background in statistics is minimal. I edited the question to make it more clear. I think you didn't understand the question or I did not understand your first point. $\endgroup$
    – Daniel
    Commented Dec 14, 2022 at 12:20
  • 1
    $\begingroup$ Thanks for your edit. It's no help at all but your example and what you are proposing seem a long, long way away from (a) what I ever do (b) what is best current practice in so far as the outcome(s) of a clinical trial would usually be modelled using as many predictors as seem relevant, and not at all by just looking at a mass of bivariate associations. I appreciate that your goal is different but (a) and (b) together mean that I should leave further answers to people with expertise and experience in medical statistics. $\endgroup$
    – Nick Cox
    Commented Dec 14, 2022 at 12:49
  • 2
    $\begingroup$ I have to state some concern that you are embarking on something in which the statistical problems are numerous and often subtle with minimal background. $\endgroup$
    – Nick Cox
    Commented Dec 14, 2022 at 12:50

Your Answer

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

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