Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I am currently reading up on assumptions for Pearson correlations. An important assumption for the ensuing t-test seems to be that both variables come from normal distributions; if they don't, then the use of alternative measures such as the Spearman rho is advocated. The Spearman correlation is computed like the Pearson correlation, only using the ranks of X and Y instead of X and Y themselves, correct?

My question is: If the input variables into a Pearson correlation need to be normally distributed, why is the calculation of a Spearman correlation valid even though the input variables are ranks? My ranks certainly don't come from normal distributions...

The only explanation I have come up with so far is that rho's significance might be tested differently from that of the Pearson correlation t-test (in a way that does not require normality), but so far I have found no formula. However, when I ran a few examples, the p-values for rho and for the t-test of the Pearson correlation of ranks always matched, save for the last few digits. To me this does not look like a groundbreakingly different procedure.

Any explanations and ideas you might have would be appreciated!

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Normality is not required to calculate a Pearson correlation; it's just that some forms of inference about the corresponding population quantity are based on the normal assumptions (CIs and hypothesis tests).

If you don't have normality, the implied properties of that particular form of inference won't hold.

In the case of the Spearman correlation, you don't have normality, but that's fine because the inference calculations for the Spearman correlation (such as the hypothesis test) are not based on a normality assumption.

They're derived based on being a set of paired ranks from a continuous bivariate distribution; in this case the hypothesis test uses the permutation distribution of the test statistic based on the ranks.

When the usual assumptions for inference with the Pearson correlation hold (bivariate normality) the Spearman correlation is usually very close (though on average a little closer to 0).

(So when you could use the Pearson, the Spearman often does quite well. If you had nearly bivariate normal data apart from some contamination with some other process (that caused outliers), the Spearman would be a more robust way to estimate the correlation in the uncontaminated distribution.)

share|improve this answer
    
Thank you, the reference to the permutation distribution is helpful! –  GST95 Jul 1 at 23:42
    
"the Spearman would be a more robust way to estimate the correlation" To nitpick, Spearman would estimate association, NOT linear correlation. –  landroni Sep 15 at 19:35
1  
@landroni If I was talking about the Spearman generally, you correctly characterize what the Spearman does -- but in that sentence I'm explicitly talking about comparing two estimates of the population correlation under contamination, and I mean what I say there quite literally. Imagine a bivariate normal with correlation $\rho$ and then add a really extreme outlier. If I want to estimate $\rho$ in that situation, the Spearman is a more robust estimator of $\rho$ than the Pearson correlation. –  Glen_b Sep 15 at 20:44
1  
@landroni ... Such a situation can occur where you have the main process which is nicely behaved and some contaminating process which can be very extreme but only happens occasionally. If you're interested in estimating the correlation of the uncontaminated process, the Pearson correlation is very susceptible to the contamination, to a much greater extent than the Spearman. –  Glen_b Sep 15 at 22:42
    
Makes sense. Thanks a lot for the clarification. –  landroni Sep 16 at 9:41

when I ran a few examples, the p-values for rho and for the t-test of the Pearson correlation of ranks always matched, save for the last few digits

Well you've been running the wrong examples then!

a = c(1,2,3,4,5,6,7,8,9)
b = c(1,2,3,4,5,6,7,8,90)
cor.test(a,b,method='pearson')

    Pearson's product-moment correlation

data:  a and b
t = 2.0528, df = 7, p-value = 0.0792
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.08621009  0.90762506
sample estimates:
      cor 
0.6130088 

cor.test(a,b,method='spearman')

    Spearman's rank correlation rho

data:  a and b
S = 0, p-value = 5.511e-06
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho 
  1 

Vectors a and b have a good, but far from perfect linear (Pearson) correlation. However, they have perfect rank correlation. See - to Spearman's $\rho$, in this case, it matters not if the last digit of b is 8.1, 9, 90 or 9000 (try it!), it matters only if it's larger than 8. That's what a difference correlating ranks makes.

Conversely, while a and b have perfect rank correlation, their Pearson correlation coefficient is smaller than 1. This shows that the Pearson correlation is not reflecting ranks.
A Pearson correlation reflects a linear function, a rank correlation simply a monotonic function. In the case of normal data, the two will strongly resemble each other, and I suspect this is why your data does not show big differences between Spearman and Pearson.

For a practical example, consider the following; you want to see if taller people weigh more. Yes, it's a silly question ... but just assume this is what you care about. Now, mass does not scale linearly with weight, as tall people are also wider than small people; so weight is not a linear function of height. Somebody who is 10% taller than you is (on average) more than 10% heavier. This is why the body/mass index uses the cube in the denominator.
Consequently, you would assume a linear correlation to inaccurately reflect the height/weight relationship. In contrast, rank correlation is insensitive to the annoying laws of physics and biology in this case; it doesn't reflect if people grow heavier linearly as they gain in height, it simply reflects if taller people (higher in rank on one scale) are heavier (higher in rank on the other scale).

A more typical example might be that of Likert-like questionnaire rankings, such as people rating something as "perfect/good/decent/mediocre/bad/awful". "perfect" is as far from "decent" as "decent" is from "bad" on the scale, but can we really say that the distance between the two is the same? A linear correlation is not necessarily appropriate. Rank correlation is more natural.

To more directly address your question: no, p values for Pearson and Spearman correlations mustn't be calculated differently. Much is different about the two, conceptually as well as numerically, but if the test statistic is equivalent, the p value will be equivalent.

On the question of an assumption of normality in Pearson correlation, see this.
More generally, other people have elaborated much better than I could regarding the topic of parametric vs. non-parametric correlations (also see here), and what this means regarding distributional assumptions.

share|improve this answer
    
Thank you! Next time I'll be sure to experiment with the examples more. :) –  GST95 Jul 1 at 23:44
1  
No, wait, actually that wasn't my question. I didn't compare the method="pearson" with the method="spearman" version of x and y. I compared cor.test(x, y, method = "spearman") with cor.test(rank(x), rank(y), method = "pearson"). These estimates will be identical no matter which data one chooses. Thank you nonetheless! :) –  GST95 Jul 2 at 0:22
    
@ GST95, Spearman's correlation is exactly Pearson's correlation performed on rank-transformed data. Your two "methods" are really precisely the same method. –  Dennis Jul 2 at 4:54
    
@Dennis , exactly, I wasn't comparing the (identical) rho coefficients but the p-values to see if they were both obtained with a t-test. –  GST95 Jul 2 at 9:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.