6
$\begingroup$

I want to convey in a heatmap how well are some correlations $[-1, 1]$ with its p-value $[0, 1]$. To normalize the plotting, the resulting numbers must be between $-1$ and $1$ and the sign must be the same as in the correlation in order to plot with a different color if the correlation is positive or negative. The higher the absolute value of a correlation is and the lowest the p-value, the higher must be the resulting number to be used for the heatmap.

How can I do that transformation to visualize easier the correlation and its p-value?

If $r = 0.8$ and $p = 0.04$, I want it with a value closer to $0$ than a correlation with $r = 0.8$ and $p = 0.03$. But a correlation with $r = -0.8$ and $p = 0.03$ must be minus the same number as for $r = 0.8$ and p-value $0.03$. Because usually low correlations tend to have high p-value (at least on my data) I would like to have the p-value and the correlation with the same influence on color.

$\endgroup$
15
  • 2
    $\begingroup$ I'll assume you already know that it's not really sensible to interpret p values like this... If you want to combine $r$ and $p$ into a single number then it seems like you'll have to decide the relative importance of each variable (i.e. decide if you want a difference of .1 in $r$ to have the same influence on colour as a difference of .1 in $p$, or a different influence) $\endgroup$
    – Ian_Fin
    Nov 16 '16 at 12:20
  • 2
    $\begingroup$ Just to be clear, re: your final sentence, you do know that the size of $r$ and $p$ are related? If $N$ is constant then the larger $r$ is, the smaller $p$ will be. $\endgroup$
    – Ian_Fin
    Nov 16 '16 at 14:15
  • 3
    $\begingroup$ I've re-opened your q. as it seems you're interested in the principle rather than implementation using specific software. $\endgroup$ Nov 16 '16 at 14:15
  • 1
    $\begingroup$ What Jake is getting at is the fact that if $r_1=r_2$, and $N_1=N_2$, then the two $p$ values must be equal. Similarly, if $r_1<r_2$ and $N_1=N_2$ then $r_1$ will always have a larger $p$ value. Furthermore, if $r_1=r_2$, but $p_1<p_2$ then you know that $N_1>N_2$. $\endgroup$
    – Ian_Fin
    Nov 16 '16 at 16:15
  • 2
    $\begingroup$ If you really think you need to visualise something like this I keep coming back to thinking that what might make more sense is something like this but where the size of the circle instead represents N. I would stay away from visualising p because, as I alluded to earlier, it encourages thinking that there's something meaningful about the difference between, e.g., $p=.03$ and $p=.04$ $\endgroup$
    – Ian_Fin
    Nov 16 '16 at 16:21
-2
$\begingroup$

I use the following transformation: I multiply the correlation measure by 1 minus the p-value: cor.value * (1 - p.value). And the resulting heatmap looks like this:

enter image description here The numbers in the heatmap are the correlation coefficient and inside the brackets the p-values. In the axes between parenthesis represent the number of variables of the datasets used.

$\endgroup$
12
  • 1
    $\begingroup$ One thing that really jumps out at me are the two -.28 correlations in the bottom right corner. The top is not significant at an $\alpha=.05$ level, while the bottom would be significant even at an $\alpha=.001$ level, and yet the difference between the two colours is almost imperceptible. If I have to inspect the $p$-values for two equal correlations to determine which is and which isn't significant then I'm not what the purpose is of having $p$ influence the colours. $\endgroup$
    – Ian_Fin
    Nov 17 '16 at 10:20
  • 2
    $\begingroup$ Your example does illustrate what I said in my first comment to the question though: If you want to aggregate $r$ and $p$ you need to decide on the relative importance of each. In this formula, they have equal importance so a big difference in what is arguably the less interesting variable can warp differences in the more interesting one $\endgroup$
    – Ian_Fin
    Nov 17 '16 at 10:50
  • 2
    $\begingroup$ The multiplication of a statistic by a complementary p-value looks ad hoc. Is there some theoretical basis for it? $\endgroup$
    – whuber
    Nov 17 '16 at 13:46
  • 1
    $\begingroup$ @Llopis The formula you ought to use probably depends on what information you want to convey and, perhaps more critically, what you want to do with the information. It's not obvious why you want to represent differences in $p$-values, when often the only use for a $p$-value is to see if it's below some $\alpha$-level. $\endgroup$
    – Ian_Fin
    Nov 17 '16 at 16:08
  • 1
    $\begingroup$ But why wouldn't using cor.value^3 * cos(p.value) make it even easier to spot interesting cells? $\endgroup$ Nov 23 '16 at 17:45

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.