68
$\begingroup$

I would like to find the correlation between a continuous (dependent variable) and a categorical (nominal: gender, independent variable) variable. Continuous data is not normally distributed. Before, I had computed it using the Spearman's $\rho$. However, I have been told that it is not right.

While searching on the internet, I found that the boxplot can provide an idea about how much they are associated; however, I was looking for a quantified value such as Pearson's product moment coefficient or Spearman's $\rho$. Can you please help me on how to do this? Or, inform on which method would be appropriate?

Would Point Biserial Coefficient be the right option?

$\endgroup$
5
  • 1
    $\begingroup$ Normally, one cannot advice only on the basis of the format of the data! What do the data represent, and what do you want to achieve with your analysis? $\endgroup$ Commented Jun 10, 2014 at 8:29
  • 2
    $\begingroup$ Thanks kjetil, I would like to compare the association between gender and other continuous variables. Simply to know, which continuous variables are moderately/strongly correlated and which variables are not. $\endgroup$ Commented Jun 10, 2014 at 8:37
  • 1
    $\begingroup$ Seems like a duplicate of stats.stackexchange.com/questions/25229/… Can you tell us if the answers to that one helps you? $\endgroup$ Commented Jun 10, 2014 at 8:41
  • $\begingroup$ Yes, my question is similar to that. However, I got a feedback where reviewer indicated that Spearman's $\rho$ is not appropriate. My sample size is 31. According to the answer (the link provided), non-normal wouldn't be an issue and any correlation method can be used (Spearman/Pearson/Point-Biserial) for the large dataset. Would it be true for the small dataset too? By the way, gender is not an artificially created dichotomous nominal scale. The above link should use biserial correlation coefficient. $\endgroup$ Commented Jun 10, 2014 at 9:03
  • 4
    $\begingroup$ Correlation between nominal and interval or ordinal variable stats.stackexchange.com/q/73065/3277 $\endgroup$
    – ttnphns
    Commented Dec 25, 2015 at 20:59

6 Answers 6

44
$\begingroup$

The reviewer should have told you why the Spearman $\rho$ is not appropriate. Here is one version of that: Let the data be $(Z_i, I_i)$ where $Z$ is the measured variable and $I$ is the gender indicator, say it is 0 (man), 1 (woman). Then Spearman's $\rho$ is calculated based on the ranks of $Z, I$ respectively. Since there are only two possible values for the indicator $I$, there will be a lot of ties, so this formula is not appropriate. If you replace rank with mean rank, then you will get only two different values, one for men, another for women. Then $\rho$ will become basically some rescaled version of the mean ranks between the two groups. It would be simpler (more interpretable) to simply compare the means! Another approach is the following.

Let $X_1, \dots, X_n$ be the observations of the continuous variable among men, $Y_1, \dots, Y_m$ same among women. Now, if the distribution of $X$ and of $Y$ are the same, then $P(X>Y)$ will be 0.5 (let's assume the distribution is purely absolutely continuous, so there are no ties). In the general case, define $$ \theta = P(X>Y) $$ where $X$ is a random draw among men, $Y$ among women. Can we estimate $\theta$ from our sample? Form all pairs $(X_i, Y_j)$ (assume no ties) and count for how many we have "man is larger" ($X_i > Y_j$)($M$) and for how many "woman is larger" ($ X_i < Y_j$) ($W$). Then one sample estimate of $\theta$ is $$ \frac{M}{M+W} $$ That is one reasonable measure of correlation! (If there are only a few ties, just ignore them). But I am not sure what that is called, if it has a name. This one may be close: https://en.wikipedia.org/wiki/Goodman_and_Kruskal%27s_gamma

$\endgroup$
10
  • 8
    $\begingroup$ Spearman's rank correlation is just Pearson's correlation applied to the ranks of the numeric variable and the values of the original binary variable (ranking has no effect here). So Spearman's rho is the rank analogon of the Point-biserial correlation. I don't see any problem in using Spearman's rho descriptively in this situation. $\endgroup$
    – Michael M
    Commented Jun 10, 2014 at 14:51
  • 1
    $\begingroup$ Is a difference in ranks much simpler to interprete as Spearman's rho? Even if so, would you call Spearman's rho wrong? Sad that we don't see the reviewers reasoning. $\endgroup$
    – Michael M
    Commented Jun 10, 2014 at 15:12
  • 1
    $\begingroup$ What you suggest is nice. It seems to be related to the test statistic of Wilcoxon's two-sample test, which is itself similar to Kendall's rank correlation between the numeric outcome and the binary group variable. $\endgroup$
    – Michael M
    Commented Jun 10, 2014 at 15:29
  • 1
    $\begingroup$ @tao.hong In which sense do you think it is asymetric? If you switch labels (men/women), then both $\theta$ and $\hat{\theta}$ switches in the same way, to $1-\theta$. $\endgroup$ Commented Sep 8, 2016 at 19:48
  • 1
    $\begingroup$ This answer is excellent piece of work! If you can extend it with appropriate sources, it would be great because there is so much confusing threads about the topic. $\endgroup$ Commented Nov 12, 2016 at 18:46
12
$\begingroup$

I'm having the same issue now. I didn't see anyone reference this just yet, but I'm researching the Point-Biserial Correlation which is built off the Pearson correlation coefficient. It is mean for a continuous variable and a dichotomous variable.

Quick read: https://statistics.laerd.com/spss-tutorials/point-biserial-correlation-using-spss-statistics.php

I use R, but I find SPSS has great documentation.

$\endgroup$
1
  • 2
    $\begingroup$ Great reference for finding a correlation between a continuous variable and a dichotomous variable! However, assumptions listed are bit strong. $\endgroup$
    – SUNDONG
    Commented Jan 31, 2018 at 5:34
1
$\begingroup$

It would seem that the most appropriate comparison would be to compare the medians (as it is non-normal) and distribution between the binary categories. I would suggest the non-parametric Mann-Whitney test...

$\endgroup$
1
  • 7
    $\begingroup$ While the Mann-Whitney would be a way of identifying location shift in a variable (or indeed more general forms of stochastic dominance) across a binary categorical variable, the Mann-Whitney doesn't compare medians, at least not without additional assumptions. $\endgroup$
    – Glen_b
    Commented Jun 12, 2015 at 0:01
1
$\begingroup$

For the specified problem, measuring the Area Under the Curve of a Receiver Operator Characteristic curve might help.

I am not an expert in this so I try to keep it simple. Please comment on any error or wrong interpretation so I can change it.

$x$ is your continuous variable. $y$ is your categorical. See how many True Positives and False Positives do you get if you choose a value of $x$ as being the threshold between positives and negatives (or male and female) and you compare this to the real labels. For e.g. you choose 7, then above $x$=7 are all female (1) and below $x$=7 all male (0). Compare this to the real labels and get the number of true positives and false positives of your prediction.

Repeating the procedure explained above, from min($x$) to max($x$) you will generate the true positive and the false positive rates and then you can plot them like in the figure below and you can calculate the Area Under the Curve.

The idea is that if there is no correlation between the variables, you will get the same ratio of true positives and true negatives for all values of $x$, nevertheless, if there is good correlation (and the same stands for anti-correlation) the ratio of true positives to true negatives will strongly vary as $x$ varies.

The above statement is calulcated with the Area Under the Curve.

Example of good correlation (right) and fair anti-correlation (left) Example of good correlation (right) and fair anti-correlation (left).

$\endgroup$
1
  • 2
    $\begingroup$ Welcome to CV! Your answer is a bit too short, and it does not seem to help find: "the correlation between a continuous (dependent variable) and a categorical (nominal: gender, independent variable) variable". Could you edit your answer to include how AUROC is supposed to achieve this? $\endgroup$ Commented Aug 16, 2018 at 3:45
0
$\begingroup$

I like to think of it in more practical terms. A simple use case for continuous vs. categorical comparison is when you want to analyze treatment vs. control in an experiment. If you show statistical significance between treatment and control that implies that the categorical value (Treatment vs. Control) does indeed affect the continuous variable. You can do this same thing with ANOVA metric when you have multiple treatment groups. I think this is the most practical way of evaluating whether your categorical variable in any way affects the distribution of the continuous value.

$\endgroup$
0
$\begingroup$

I found this article helpful in understanding why and where which correlation will be used How to Calculate the Correlation Between Categorical and Continuous Values

$\endgroup$
1
  • $\begingroup$ While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review $\endgroup$ Commented Jul 1 at 6:02

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.