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?


# 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)))

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
  • $\begingroup$ You're saying - non linear will give greater correlation in Spearman? $\endgroup$
    – pogibas
    Sep 11 '18 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
    Sep 11 '18 at 9:26

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

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


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.