0
$\begingroup$

I want to use Spearman's correlation test. My data is not normally distributed. Below is a scatterplot of this data.

I read somewhere that Spearman's correlation coefficient can describe monotonic relationships. Is my data monotonic or linear? Can Spearman's correlation coefficient be used on both linear and monotonic relationships?

enter image description here

New contributor
kaka is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$
1
  • $\begingroup$ previous answers explain it quite well, but if you want more details you can read this article. $\endgroup$ Jan 14 at 17:06
3
$\begingroup$

Monotonic means either '$y$ does not decrease as $x$ increases' (positive monotonic relationship between $y$ and $x$), or '$y$ does not increase as $x$ increases' (negative monotonic relationship between $y$ and $x$).

'Linear' meaning 'line-like' is just one kind of monotonic relationship, so yes you can use Spearman's correlation coefficient whether the relationship is linear or some other monotonic function. Asking whether a relationship is "monotonic or linear" is like asking whether something is "food or an apple": it's a little confused because an apple is a kind of food.

There is a trade-off between the more general 'monotonic association' of Spearman's $\rho_{\text{S}}$ versus the specifically linear association of Pearson's $\rho$: If the relationship between $y$ and $x$ is close to linear, then the magnitude of Spearman's correlation coefficient will likely be smaller than Pearson's, and the power of the t test of $\rho_{\text{S}}$ with $\text{H}_{0}\text{: no monotonic association}$ (i.e. $\text{H}_{0}\text{: }\rho_{\text{S}} = 0$) will be lower than the power of the t test of with $\text{H}_{0}\text{: no linear association}$ (i.e. $\text{H}_{0}\text{: }\rho = 0$).

Finally, because monotonic relationships can actually be flat in places (imagine a function that looks like stair steps), a significantly positive $\rho_{\text{S}}$ might only be interpretable as meaning '$y$ tends to increase as $x$ increases', while a significantly negative $\rho_{\text{S}}$) might only be interpretable as meaning '$y$ tends to decrease as $x$ increases'.

$\endgroup$
6
  • $\begingroup$ So my graph does not show a monotonic relationship because y does not decrease as x increase and y does increase as x increase, right? $\endgroup$
    – kaka
    Jan 14 at 17:45
  • $\begingroup$ @kaka I would say that there is a slight monotonically increasing relationship, but at your apparent sample size, I would not be surprised if that was not significantly different from 0. That said, you can also perform two one-sided tests for equivalence between $\rho$ and $0$: $\text{H}_{01}\text{: }\rho \ge \Delta$ and $\text{H}_{02}\text{: }\rho \le -\Delta$. If your reject both $\text{H}_{01}$ and $\text{H}_{02}$, you found evidence that $\rho$ is equivalent to $0$ within $\pm\Delta$ at the $\alpha$ level, where $\Delta$ is the smallest size correlation you care about. $\endgroup$
    – Alexis
    Jan 14 at 19:14
  • 1
    $\begingroup$ You can also take the ranks of the x variable, and the ranks of the y variable, and plot those. That may give you a better sense of the relationship that Spearman correlation is assessing. $\endgroup$ Jan 14 at 21:06
  • $\begingroup$ @SalMangiafico Correct. Albeit, the behaviors of ranks may or may not have substantive interest (as opposed to the actual measures). In other words, analysis of ranks may be only instrumentally useful. $\endgroup$
    – Alexis
    Jan 14 at 21:07
  • 1
    $\begingroup$ To be fussy: In order for Spearman correlation to be $1,$ a positive association has to be strictly monotonic: In R. cor(1:4, c(1,1,3,4)) returns $0.9467293.$ $\endgroup$
    – BruceET
    2 days ago
0
$\begingroup$

The Spearman null hypothesis is that X and Y are independent. The alternative is that there is dependence between X and Y in such a way that if you consider a larger and a smaller (random) value of X, Y tends to be either systematically larger, or systematically smaller for the larger X. This holds in particular in monotonic relationships, including linear (unless the slope is zero).

So if this is what you want to test, the Spearman correlation test should be fine.

$\endgroup$
0
$\begingroup$

In the illustration below, the association between variables $x$ and $y$ is positive. (Variable $y$ tends to increase as variable $x$ increases.

Also, the relationship between variables $x$ and $y$ is strictly monotonic (every increase in $x$ is accompanied by an increase in $y.)$ Thus, Spearman correlation is $1.$

However, the relationship is not linear (as you can see from the plot below). Thus, Pearson correlation is smaller than $1.$

Computations in R:

x = 1:20
y = x^4
plot(x,y)

cor(x,y)               # Pearson correlation
[1] 0.8730177
cor(x,y, meth="s")     # Spearman correlation
[1] 1

enter image description here

Now, we add a small amount randomness to y and call the result z. The randomness destroys the strictly monotone relationship between x and z. While the xs are still in increasing order, the first two values of z are out of order. The change is too small to see on a plot, but the Spearman correlation is no longer exactly $1.$

set.seed(2022)
z = y + rnorm(20, 0, 10)

z[1:3]
[1]  10.001420   4.266542  72.025146 

cor(x, z)
[1] 0.8730275
cor(x, z, meth="s")
[1] 0.9984962
$\endgroup$

Your Answer

kaka is a new contributor. Be nice, and check out our Code of Conduct.

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.