4
$\begingroup$

If Spearman correlation is Pearson correlation, but on ranks of the data - does it mean that absolute Spearman will always be lower or equal to absolute Pearson correlation, but never greater? Is it possible to have variables that show greater absolute Spearman than absolute Pearson?

Example:

# Spearman == Pearson
# We're correlating ranked variables from the beginning 
foo <- 1:1e3
bar <- 1:1e3
sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))

# Spearman < Pearson
foo <- rnorm(1e3)
bar <- rnorm(1e3)
sapply(c("pearson", "spearman"), function(x) abs(cor(foo, bar, method = x)))
$\endgroup$
1

2 Answers 2

8
$\begingroup$

Simple example in which Spearman correlation is greater than Pearson correlation:

x = 1:10;  y = x^2
cor(x,y, meth = "p")
[1] 0.9745586
cor(x,y, meth = "s")
[1] 1
$\endgroup$
2
  • $\begingroup$ You're saying - non linear will give greater correlation in Spearman? $\endgroup$
    – pogibas
    Commented Sep 11, 2018 at 9:10
  • 3
    $\begingroup$ Yes, as long as the nonlinear function $y = f(x)$ is increasing. (Or, if you're interested in absolute values, decreasing also works.) Spearman only looks at the ranks (relative orders). $\endgroup$
    – BruceET
    Commented Sep 11, 2018 at 9:26
3
$\begingroup$

Using your own example we can see there is no particular bias for two independent normal distributions:

library(tidyverse)
d <- data_frame(
  x = replicate(1e4, rnorm(1e3), FALSE),
  y = replicate(1e4, rnorm(1e3), FALSE),
  pearson  = map2_dbl(x, y, cor, method = 'pearson'),
  spearman = map2_dbl(x, y, cor, method = 'spearman'),
  p_min_s = pearson - spearman
)

qplot(d$p_min_s, xlab = c('pearson - spearman'))

enter image description here

$\endgroup$

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.