Spearman’s correlation in statistics is a nonparametric alternative to Pearson’s correlation. Use Spearman’s correlation for data that follow curvilinear, monotonic relationships and for ordinal data. Statisticians also refer to Spearman’s rank order correlation coefficient as Spearman’s ρ (rho).
In this post, I’ll cover what all that means so you know when and why you should use Spearman’s correlation instead of the more common Pearson’s correlation.
To learn more about correlation in general, and Pearson’s correlation in particular, read my post about Interpreting Correlation Coefficients.
Throughout this post, I graph the data. Graphing is crucial for understanding the type of relationship between variables. Seeing how variables are related helps you choose the correct analysis!
Related post: Nonparametric versus Parametric Analyses
Choosing Between Spearman’s and Pearson’s Correlation
Let’s start by determining when you should use Pearson’s correlation, which is the more common form. Pearson’s is an excellent choice when you have continuous data for a pair of variables and the relationship follows a straight line. If your data do not meet both of those requirements, it’s time to find a different correlation measure!
The data in the graph have a correlation of 0.8. Pearson’s correlation is valid for these data because the relationship follows a straight line.
Consider Spearman’s rank order correlation when you have pairs of continuous variables and the relationships between them don’t follow a straight line, or you have pairs of ordinal data. I’ll examine those two conditions below.
Why Pearson’s correlation is not Valid for Curvilinear Relationships
The graph below shows why Pearson’s correlation for curvilinear relationships is not valid.
On the graph, the data points are the red line (actually lots and lots of data points and not actually a line!). And, the green line is the linear fit. You don’t usually think of Pearson’s correlation as modeling the data, but it uses a linear fit. Consequently, the green line illustrates how Pearson’s correlation models these data. Clearly, the model doesn’t fit the data adequately. There are systematic (i.e., non-random departures) between the red data points and green model fit. Right there, you know that Pearson’s correlation is invalid for these data.
The Pearson’s correlation is about 0.92, which is pretty high. However, the graph emphasizes how it does not capture the whole relationship. The real strength of the relationship is even higher. Later in this post, we’ll work through a similar example using scientific data.
Determining when to use Spearman’s Correlation
Spearman’s correlation is appropriate for more types of relationships, but it too has requirements your data must satisfy to be a valid. Specifically, Spearman’s correlation requires your data to be continuous data that follow a monotonic relationship or ordinal data.
When you have continuous data that do not follow a line, you must determine whether they exhibit a monotonic relationship. In a monotonic relationship, as one variable increases, the other variable tends to either increase or decrease, but not necessarily in a straight line. This aspect of Spearman’s correlation allows you to fit curvilinear relationships. However, there must be a tendency to change in a particular direction, as illustrated in the graphs below.
Positive Monotonic: tends to increase but not necessarily in a linear fashion. | |
Negative Monotonic: Tends to decrease but not necessarily in a linear fashion. | |
Non-Monotonic: No overall tendency to either increase or decrease |
Spearman’s rho is an excellent choice when you have ordinal data because Pearson’s is not appropriate. Ordinal data have at least three categories and the categories have a natural order. For example, first, second, and third in a race are ordinal data.
For example, imagine the same contestants participate in two spelling competitions. Suppose you have the finishing ranks for all contestants in both matches and want to calculate the correlation between contests. Spearman’s rank order correlation is appropriate for these data.
Spearman’s rho is also a great way to report correlations between Likert scale items!
How to Calculate Spearman’s Rho
Spearman’s correlation is simply the Pearson’s correlation of the rankings of the raw data. If your data are already ordinal, you don’t need to change anything. However, if your data are continuous, you’ll need to convert the continuous data into ranks. Of course, many statistical software packages will do that preprocessing for you and simply calculate the answer!
The example dataset below shows data ranks for two continuous variables. The data are ranked such that a value of 1 indicates the highest, 2 the second highest, and so on.
To determine Spearman’s correlation, simply calculate the Pearson’s correlation for the two rank order columns instead of the raw data. We’ll analyze these data later in the post!
Interpreting Spearman’s Correlation Coefficient
Spearman’s correlation coefficients range from -1 to +1. The sign of the coefficient indicates whether it is a positive or negative monotonic relationship. A positive correlation means that as one variable increases, the other variable also tends to increase. A negative correlation signifies that as one variable increases, the other tends to decrease. Values close to -1 or +1 represent stronger relationships than values closer to zero.
Comparing Spearman’s and Pearson’s Coefficients
If the Pearson’s coefficient is a perfect -1 or +1, Spearman’s correlation coefficient will be the same perfect value unless there are repeating data values.
Correlation of +1 for both Spearman’s and Pearson’s correlations | |
Correlation of -1 for both Spearman’s and Pearson’s correlations |
When there is no tendency for two variables to change in tandem, both Spearman’s and Pearson’s will be close to zero, indicating no relationship.
If there is a curvilinear but non-monotonic relationship, both Spearman’s and Pearson’s correlation will be close to zero.
However, when you have two variables with a curvilinear, monotonic relationship, you’ll find that Spearman’s correlation indicates a stronger relationship (rho has a higher absolute value) than Pearson’s. In those cases, the curvilinear nature “confuses” Pearson’s, and it underestimates the relationship’s strength. The upcoming example illustrates this aspect in action.
Spearman’s Correlations for Likert Items and Other Ordinal Data
Statisticians report correlations of ordinal data, such as ranks and Likert scale items, using Spearman’s rho. Strongly positive Spearman’s correlations indicate that high ranks of one variable tend to coincide with high ranks of the other variable. Negative correlations signify that high ranks of one variable frequently occur with low ranks of the other variable.
For Likert items using the Strongly Agree to Strongly Disagree scale, Spearman’s correlations mean the following:
- Strongly positive coefficients: Strongly Agree values tend to occur together.
- Strongly negative coefficients: Strongly Agree for one item is apt to coincide with Strongly Disagree on the other item.
- Near zero coefficients: The value of one Likert item does not predict the other Likert item’s value. There is no relationship between them.
Related post: Analyzing Likert Scale Data
Example of Spearman’s Rank Order Correlation for a Monotonic Relationship
The graph below displays the relationship between density and electron mobility. The relationship is nonlinear. In fact, I fit a nonlinear regression model to these data. However, instead of fitting a regression model, let’s calculate the correlation between these two variables. These data are a good candidate for Spearman’s correlation because they follow a nonlinear relationship that is monotonic. As Density increases, electron mobility also increases., but not in a linear fashion.
These data are freely available from the NIST and pertain to the relationship between density and electron mobility. Download the Excel data file to try it yourself: ElectronCorrelations.
I’ve done the calculations in Excel so you can see how they compare. Excel’s Data Analysis ToolPak performs Spearman’s correlation. It doesn’t explicitly calculate Spearman’s correlation. However, by using Excel’s rank function to rank both variables, I can then use Pearson’s correlation on those ranks to derive Spearman’s rho.
First, I’ll calculate Pearson’s correlation.
The correlation is a very strong ~+0.96. Despite being nonlinear, Pearson’s indicates it is a strongly positive relationship. However, despite being a high correlation, we know that it underestimates the strength because it can’t model nonlinear relationships.
Now, let’s calculate Spearman’s rho. In the Excel spreadsheet, I used the rank function to convert the raw scores for both variables to ranks. Then, I calculated the correlation for the pair of ranked values to produce Spearman’s rho.
Related post: Using Excel to Calculate Correlation
For the electron mobility data, Spearman’s rho is a near perfect correlation of +0.99. It’s nearly perfect because these data represent a physical process and the lab collected extremely precise measurements.
Spearman’s correlation is a great addition to your statistical toolbox! It allows you to calculate correlations for data where Pearson’s is invalid.
marriam says
Hi this explanation has been really useful, I am new to quantitative methods and have been using spss for the first time. My data set is based on a survey that used likert scales, and I am looking at the relationship between stress at work and impact on homelife. Spearmans rho test has shown a positive correlation. what I wanted to know if I were to further look at the data and look at differences between these associations and gender would I just look at the data separately or would I have to do a different test.
Jim Frost says
Hi Marriam,
To look at the differences between genders, you’d need to use a 2-sample hypothesis test. With Likert data, which is ordinal rather than continuous, there is some debate over whether you can use the 2-sample t-test to compare means or a 2-sample nonparametric test to compare medians. I write a post about how to analyze Likert data where I reference research suggests that either is appropriate.
Weam says
Thank you for this valuable post.
I woudl like ask about monotonic. How can I know if it is a monotonic or linear in order to know wheather I have to use Pearson or Spearman?
Also, if I have an outlier and/or the data is not normal distributed, then which one is the correct one to use? In other words, what are teh requirments to apply Pearson and Spearman?
Thank you in advanced
Jim Frost says
Hi Weam,
There are two things to consider for correlation when it comes to assumptions. One is for the correlation coefficient and the other is for the p-values associated with the coefficient. The p-value assumptions are somewhat more stringent than for the correlation coefficient itself.
For the correlation coefficients, it’s largely the shape of the relationship that matters. If the paired data generally follow a straight line (i.e., the variables change together and at an overall constant rate), then you can use Pearson’s correlation. However, if is a tendency for the variables to change together but the rate is not constant (i.e., some curved relationships), then you have monotonic relationship. I cover that in this post. For monotonic relationships, you can use Spearman’s correlation.
To trust the p-values for these correlation coefficients, you need to consider the distribution of values. Technically, you need a bivariate normal distribution to use Pearson’s correlation to be able to trust the p-value. However, like many tests, the p-values for Pearson’s correlation are robust to departures from normality when you have a sample size greater than ~25.
I’m not entirely sure about the assumptions for the Spearman’s p-values, but I believe they are the same because the use the same underlying methodology.
So, keep in mind that the assumptions for using either method to get the correlation coefficient is largely based on the shape of the relations. Or, if you’re using ordinal/ranked data, use Spearman’s. And that there are additional requirements to trust the p-values, but those can be waived with a large enough sample size.
RABIA NOUSHEEN says
Hi Jim
Thanks for writing such an interesting articles, I really enjoy reading them and learn a lot too.
I am here with a question that is it ok to do correlation with data points as low as 5? For example, I expose my model organism to different doses in replications and see how many of these organisms die during the entire period of their development to a particular stage? I am meausring development in terms of days. I observe that individuals in each treatment and even in different replications of same treatment respond differently. Like in case of treatment 1, There are few mortalities occuring in replication 1 but not in replication 2 and 3 on the same day. same kind of response was observed throughout the experiment. Now I am interested to find out whether the mortalities occuring due to ingestion of contaminant and therefore thinking of correlation. I have divided my data with respect to treatment and each treatment includes the mortalities occuring on different days (irrespective of replication). I have data points for each treatment like this: day 1, 2% mortalities in Replication2, number of particles ingested 3 (data point 1), Day2, no mortalities, no ingestion, day 3, 16% mortalities in replication 1, ingestion of particles in replication 1= 14 particles (data point2), 18% mortality in replication 2 and ingestion of particles= 9 particles (data point 3), day 5 20% mortalities in replication 1, ingestion of particles in replication 1= 11 particles (data point4). Correlation between mortality and ingestion with 4 data points, is it ok? Regression between mortality and ingestion with 4 data points, is it ok? I am making a scatter plot of this,
Jim Frost says
Hi Rabia, that’s too few points for correlation. I suppose you could use it as a preliminary result, but it’ll be hard to obtain any meaningful insight from so few data points. If you try it, I’d recommend calculating a confidence interval for the correlation coefficient. That will tell you the uncertainty of the estimate. You will probably have a relatively wide CI. However, it’s possible that you might glean some insight from it. At least you’d understand the limitations of the estimate.
As for regression, you really need at least 10 observations for one IV. Ideally 15 or 20 for the first IV. Read my post about overfitting regression models to understand why you need a minimum number of observations per coefficient estimate and how many you need.
I’m wondering if you should be using Poisson regression (or negative binomial) because your DV is a count. Read my post about choosing the type of regression to learn more and look near the end of it for a section on count variables.
Ivana Vlachova says
Thank you very much, Jim, your reply was very helpful, supportive and quick!
All the best,
Ivana
Ivana Vlachova says
Hi Jim,
The article was very clear and easy to understand, thank you!
But still, I am struggling with the interpretation of my findings based on Spearman’s Rho correlation analyses. I am analyzing the employee survey data which are quite complex. The correlations between my variables range from about 0.17 to 0.5 (for positive correlations), not higher, but with the p-values of about 0.001 or even 0.000. The ordinal variables being analyzed are compound synthetic variables created by summing up several dichotomic variables that represent one topic (such as “trust”; “rivarly”, etc.). Normally, according to what I read in statistics manuals, the 0.4 correlation should be considered weak. On the other hand, in case you study mutifactorial social phenomena, I am afraid that the chance of getting a 0.7 correlation is very low. My question is whether the correlation coefficients should be always interpreted in the same way, or whether the researcher should consider the complexity of the matter they are correlating and under certain circumstances they could say that – let’s say – even a correlation of 0.3 means there is a relationship. What words should then one use to describe such correlations (0.2, 0.3, 0.4, 0.5)? The problem is that even the low correlations I got all make sense (they are in line with the theory and with the common sense).
Thank you very much for any help!
Jim Frost says
Hi Ivana,
Generally speaking, those correlations are considered weak. However, I’m not a big fan of rules for classifying whether a correlation is weak, medium, or strong because they vary so much by subject area. For example, if you’re measuring physical phenomenon, such as the electron mobility example in this article, an extremely high correlation is normal. However, if you’re measuring psychology attributes, correlations are going to be much lower.
So, a lot of the descriptive words about the strength of the correlations will depend on your field. It sounds like you’re more on the psychology side of things. I’d look at similar studies and see how they phrase the strength of similar correlations. See what correlations are typical and how yours compares. From my understand, I’d agree that correlations of 0.7 are unlikely, but it’s not really my field. So, I don’t want to say definitively how I’d describe, but look at similar studies and see how yours fits in.
While I wouldn’t describe them as overly strong they might well be consistent with other studies. Additionally, your significant p-values suggest that the correlations exist (i.e., do not equal zero) in the population. So, that’s a good thing! From what you write, and the bit I know about your field, I don’t see any glaring issues. If the correlations make theoretical sense and they’re significant, it’s sounding pretty good!
Negin Balfe says
Dear Jim,
Thank you for wondefule explanation of Correlation.
My question is when we use Pvalue less than 0.01 and when P value less than 0.05?
Thank you in advance for your time
Warm regards NB
Jim Frost says
Hi Negin,
I’m so glad you found it to be helpful!
For your question, I’ve written a blog post about that! You’re actually asking about the significance level (alpha), to which you compare the p-value. Click the link below to read a post where I explain the significance level and how to choose between 0.05, 0.01, and even 0.10!
Understanding Significance Levels
Rainer Düsing says
Dear Jim!
Many thanks for the quick reply that helps a lot!
All the best,
Rainer
Jim Frost says
You’re very welcome, Rainer! 🙂
Daniel Gezahegn Badeg says
Thanks Jim Frost but I have one questions do you have the books about Spearman’s correlation
Rainer Düsing says
Dear Jim,
I have a question concerning the use of Spearman’s correlation for test-restest reliability. I have clearly ordinal data and conducted a CFA with unweighted least squares which seems appropriate for it. Then I calculated oridnal versions of Cronbach’s Alpha and McDonald’s Omega as measure of internal consistency and everything worked fine. But then I was wondering how to assess test-retest reliability for ordinal data. Publications covering this topic seem scarce, therefore, it would be very helpful to hear your expertise on this topic. Many thanks in advance for any help!
All the best,
Rainer
Jim Frost says
Hi Rainer,
Yes, it sounds like Spearman’s rho is a good way to assess test-retest reliability for your data.
jeremy says
Thanks, Jim, that’s a good refresher on using Spearman’s rho. In the example, what if the midsection of the graph (roughly between density of 200 and 1200 is not monotonic, but mostly horizontal (with some scatter) instead? Or if the midsection dips downward? How would that affect Spearman’s rho?
Jim Frost says
Hi Jeremy,
The key point with Spearman’s is the tendency of the data points to increase or decrease on an overall basis for a dataset. Imagine a dataset we sort the X-Y pairs based on the ascending X values. If we go down the list of increasing X values and notice that each subsequent Y value is always higher than the previous Y, Spearman’s rho is +1. It doesn’t matter how much each Y increase from one to the next as long as each subsequent Y is higher than the previous Y when sorted by X. There are many different shapes that describes. You get the perfect correlation because the ranks for X and Y perfectly agree.
Now, on to your question. What I write above almost describes the electron mobility data. There are a few ranks that are out of order, which is why we have a near but not perfect +0.99. If you fiddle with the middle of the distribution so it flattens or dips, you’ll have more ranks that don’t perfectly align. The result would be a lowering of Spearman’s rho. How much depends on how many ranks are not aligned perfectly.
Elijah Mwaniki says
How can i buy hard Copy of the text book?
Jim Frost says
Hi Elijah,
Yes, you definitely can! You can get them from Amazon. Go to My Webstore for the Amazon links by country. You can also find them for order from other online retailers. Many physical bookstores can also order copies for you.
Elijah Mwaniki says
you have simplified particularly on when to use.