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.

    in case of normal data, produce pearson. in case of non-normal data, produce spearman.

  • 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:

    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

    @JonathanThiele it is perfectly possible to have S

    @atomicules Thanks for the information. I just checked the correlations in Anscombe's Quartet, and your link was helpful.

    How can you include Pearson and Spearson correlations in one corrgram presentation? - - I am thinking here the case - - I have a multifactorial problem so I think Spearson would be valid to include and I cannot go only with Pearson.

    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.

    I don't care if I'm not allowed to say thank you. This simple answer just blew my mind and did more to inform me about Spearman's than the last 3 hours of reading Wikipedia articles.

  • 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!

  • 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.

    enter image description here

    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)")
    lm1=lm(y ~ x)
    spearman = cor(y,x,method="spearman")
    pearson = cor(y,x,method="pearson")
        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 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: 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: 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.

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM