# How to choose between Pearson and Spearman correlation?

How do I know when to choose between Spearman's $\rho$ and Pearson's $r$? My variable includes satisfaction and the scores were interpreted using the sum of the scores. However, these scores could also be ranked.

• see also this question on pearson versus spearman for non-normal data stats.stackexchange.com/questions/3730/… – Jeromy Anglim Mar 9 '11 at 12:14
• in case of normal data, produce pearson. in case of non-normal data, produce spearman. – user36239 Dec 15 '13 at 21:28

If you want to explore your data it is best to compute both, since the relation between the Spearman (S) and Pearson (P) correlations will give some information. Briefly, S is computed on ranks and so depicts monotonic relationships while P is on true values and depicts linear relationships.

As an example, if you set:

x=(1:100);
y=exp(x);                         % then,
corr(x,y,'type','Spearman');      % will equal 1, and
corr(x,y,'type','Pearson');       % will be about equal to 0.25


This is because $y$ increases monotonically with $x$ so the Spearman correlation is perfect, but not linearly, so the Pearson correlation is imperfect.

corr(x,log(y),'type','Pearson');  % will equal 1


Doing both is interesting because if you have S > P, that means that you have a correlation that is monotonic but not linear. Since it is good to have linearity in statistics (it is easier) you can try to apply a transformation on $y$ (such a log).

I hope this helps to make the differences between the types of correlations easier to understand.

• I'm guessing that this is a given from what you have said already, but I just want to confirm that it is not possible for S<P to occur. – Jonathan Thiele Jun 26 '12 at 16:33
• @JonathanThiele it is perfectly possible to have S<P. For example, sets II and IV from Anscombe's Quartets demonstrate this behaviour. Also, see this question: stats.stackexchange.com/questions/27127/… – atomicules Jul 24 '12 at 14:55
• @atomicules Thanks for the information. I just checked the correlations in Anscombe's Quartet, and your link was helpful. – Jonathan Thiele Jul 25 '12 at 17:59
• How can you include Pearson and Spearson correlations in one corrgram presentation? - - I am thinking here the case stackoverflow.com/a/40523080/54964 - - I have a multifactorial problem so I think Spearson would be valid to include and I cannot go only with Pearson. – Léo Léopold Hertz 준영 Nov 10 '16 at 13:33
• This is the approach I usually take, as it has the added benefit of sidestepping painstaking justification of one test vs. another, particularly when testing correlation among many variables. Rather than examining each variable to see whether the assumptions of Pearson or Spearman correlation are met, just run both on everything. In many practical applications, they will give similar measures of significance of association, so you only need to dig deeper on the relatively few instances where their results differ greatly, and those are the interesting cases to learn more about anyway. – Nuclear Wang Feb 22 '19 at 15:54

Shortest and mostly correct answer is:

Pearson benchmarks linear relationship, Spearman benchmarks monotonic relationship (few infinities more general case, but for some power tradeoff).

So if you assume/think that the relation is linear (or, as a special case, that those are a two measures of the same thing, so the relation is $y=1\cdot x+0$) and the situation is not too weired (check other answers for details), go with Pearson. Otherwise use Spearman.

This happens often in statistics: there are a variety of methods which could be applied in your situation, and you don't know which one to choose. You should base your decision the pros and cons of the methods under consideration and the specifics of your problem, but even then the decision is usually subjective with no agreed-upon "correct" answer. Usually it is a good idea to try out as many methods as seem reasonable and that your patience will allow and see which ones give you the best results in the end.

The difference between the Pearson correlation and the Spearman correlation is that the Pearson is most appropriate for measurements taken from an interval scale, while the Spearman is more appropriate for measurements taken from ordinal scales. Examples of interval scales include "temperature in Farenheit" and "length in inches", in which the individual units (1 deg F, 1 in) are meaningful. Things like "satisfaction scores" tend to of the ordinal type since while it is clear that "5 happiness" is happier than "3 happiness", it is not clear whether you could give a meaningful interpretation of "1 unit of happiness". But when you add up many measurements of the ordinal type, which is what you have in your case, you end up with a measurement which is really neither ordinal nor interval, and is difficult to interpret.

I would recommend that you convert your satisfaction scores to quantile scores and then work with the sums of those, as this will give you data which is a little more amenable to interpretation. But even in this case it is not clear whether Pearson or Spearman would be more appropriate.

• How about for example... communication apprehension? A high apprehension has no definite difference with a very high apprehension, right? But I've seen that the variable has been correlated with other variables using Pearson's r. Is that totally okay? Thank you! – user3636 Mar 9 '11 at 12:57

I ran into an interesting corner case today.

If we are looking at very small numbers of samples, the difference between Spearman and Pearson can be dramatic.

In case below, the two methods report an exactly opposite correlation. Some quick rules of thumb to decide on Spearman vs. Pearson:

• The assumptions of Pearsons are constant variance and linearity (or something reasonably close to that), and if these are not met, it might be worth trying Spearmans.
• The example above is a corner case that only pops up if there is a handful (<5) of datapoints. If there is >100 data points, and the data is linear or close to it, then Pearson will be very similar to Spearman.
• If you feel that linear regression is a suitable method to analyze your data, then the output of Pearsons will match the sign and magnitude of a linear regression slope (if the variables are standardized).
• If your data has some non-linear components that linear regression won't pick up, then first try to straighten out the data into a linear form by applying a transform (perhaps log e). If that doesn't work, then Spearman may be appropriate.
• I always try Pearson's first, and if that doesn't work, then I try Spearman.
• Can you add any more rules of thumb or correct the ones I have just deduced? I have made this question a community Wiki so you can do so.

p.s. Here is the R code to reproduce the graph above:

# Script that shows that in some corner cases, the reported correlation for spearman can be
# exactly opposite to that for pearson. In this case, spearman is +0.4 and pearson is -0.4.
y = c(+2.5,-0.5, -0.8, -1)
x = c(+0.2,-3,   -2.5,+0.6)

plot(y ~ x,xlim=c(-6,+6),ylim=c(-1,+2.5))
title("Correlation: corner case for Spearman vs. Pearson\nNote that they are exactly opposite each other (-0.4 vs. +0.4)")
abline(v=0)
abline(h=0)
lm1=lm(y ~ x)
abline(lm1,col="red")

spearman = cor(y,x,method="spearman")
pearson = cor(y,x,method="pearson")
legend("topleft",
c("Red line: regression.",
sprintf("Spearman: %.5f",spearman),
sprintf("Pearson:   +%.5f",pearson)
))


While agreeing with charles answer, i would suggest (on a strictly practical level) that you compute both of the coefficients and look at the differences. In many cases, they will be exactly the same, so you don't need to worry.

If however, they are different then you need to look at whether or not you met the assumptions of Pearsons (constant variance and linearity) and if these are not met, you are probably better off using Spearmans.

• as a machine learner I am certainly not a saint regarding statistical correctness, but checking the assumptions AFTER performing the test seems like heresy to me. – steffen Mar 9 '11 at 12:11
• @steffen I think it's fine. One assumption of regression is that the residuals are normally distributed. How would you check that before running the regression? – Glen Mar 9 '11 at 13:27
• @Glen: In this case I cannot. But when I compare the quality of different models, I generally prefer to check the assumption (e.g. approximately normally distributed) before performing the test to reduce the tendency to relax assumptions in favor of certain test outcomes. Call it prevention of a mind trick. I guess it is just me ;). – steffen Mar 9 '11 at 14:26
• @ steffen: you are correct about the heresy, but if the two procedures give the same results then its a matter of taste which to use, but if they dont then checking the asumptions and where they fail can often give useful insight into the data. Personally, i use spearman wherever possible, but this is not common practice in my field. – richiemorrisroe Mar 10 '11 at 10:37