Before you can calculate a Spearman’s rho or Kendall’s tau, there’s one non-negotiable step you must complete first: ranking your data. This process – converting raw scores into ordered positions – is the backbone of non-parametric correlation analysis. Get it right, and your correlation results will be valid and reliable. Get it wrong, and everything downstream falls apart. This guide walks you through exactly how to rank data for non-parametric correlation, including how to handle the tricky situation where two or more values are identical.
Table of Contents
- Why ranking is necessary in non-parametric statistics
- The basic rules for ranking data
- Step-by-step: how to rank a dataset
- Step 1 – Sort the data from lowest to highest
- Step 2 – Assign initial rank positions
- Step 3 – Handle tied values by averaging their ranks
- Step 4 – Assign the final ranks back to the original dataset
- Understanding tied ranks and why the average method matters
- Verifying your rankings: the sum check
- Ranking two variables for correlation
- Ranking as the gateway to Spearman’s rho and Kendall’s tau
- Spearman’s rho (ฯ)
- Kendall’s tau (ฯ)
- Common mistakes to avoid when ranking
- A note on software and manual ranking
Why ranking is necessary in non-parametric statistics
Parametric tests like Pearson’s correlation work directly with raw numerical values and assume the data follows a normal distribution. But in psychology research, data often violates these assumptions – it might be skewed, contain outliers, or be measured on an ordinal scale (like Likert ratings or ranked preferences). This is where non-parametric methods become essential.
Spearman’s rank-order correlation is the most widely used non-parametric alternative to Pearson’s correlation. Rather than analyzing the raw data values themselves, it focuses on the monotonic relationship between the ranks of paired observations. Similarly, Kendall’s tau uses ranks to measure the strength of association between two variables. In both cases, ranking transforms your raw scores into a common, comparable format that these tests can work with – regardless of whether the original data was normally distributed.
As a result, ranking is not just a preliminary task – it is the core data transformation that makes non-parametric correlation possible.
The basic rules for ranking data
The process of ranking follows a clear set of conventions. According to the Introduction to Applied Statistics for Psychology Students, there are two fundamental rules to keep in mind:
- Assign ranks from the lowest score to the highest score. The smallest value in your dataset receives rank 1, the next smallest receives rank 2, and so on.
- If there are ties, assign the average rank to all tied values. This ensures no value is unfairly ranked above another when they are equal.
It is also worth noting that the direction of ranking – whether you start from the lowest or highest value – does not affect the final correlation, as long as you apply the same ranking direction consistently to both sets of data.
Step-by-step: how to rank a dataset
Let’s walk through the ranking process with a clear, practical example. Suppose you collected anxiety scores for 6 participants:
Raw scores: 14, 9, 22, 9, 17, 22
Here is how you rank them:
Step 1 – Sort the data from lowest to highest
Arrange all values in ascending order. This makes the ranking positions easier to see:
9, 9, 14, 17, 22, 22
Step 2 – Assign initial rank positions
Temporarily label each value by its position in the sorted list:
- Position 1: 9
- Position 2: 9
- Position 3: 14
- Position 4: 17
- Position 5: 22
- Position 6: 22
Step 3 – Handle tied values by averaging their ranks
Notice that the value 9 appears in positions 1 and 2, and the value 22 appears in positions 5 and 6. If there are any values that tie, each of the tied values gets the average of the corresponding ranks.
- The two 9s would occupy ranks 1 and 2, so each receives: (1 + 2) / 2 = 1.5
- The value 14 is in position 3: rank = 3
- The value 17 is in position 4: rank = 4
- The two 22s would occupy ranks 5 and 6, so each receives: (5 + 6) / 2 = 5.5
Step 4 – Assign the final ranks back to the original dataset
Go back to the original, unsorted dataset and apply the ranks you calculated:
| Participant | Raw Score | Rank |
|---|---|---|
| 1 | 14 | 3 |
| 2 | 9 | 1.5 |
| 3 | 22 | 5.5 |
| 4 | 9 | 1.5 |
| 5 | 17 | 4 |
| 6 | 22 | 5.5 |
Understanding tied ranks and why the average method matters
The average rank method for handling ties is not arbitrary – it has a solid statistical rationale. Assigning tied values the average of the ranks they would have occupied is advantageous in statistical tests because it preserves the sum of the ranks. This is important because several non-parametric tests rely on the total sum of ranks being consistent and predictable.
To illustrate: in a dataset of 6 values with no ties, the ranks would be 1, 2, 3, 4, 5, 6, and their sum would be 21. In the tied example above, the ranks are 1.5, 1.5, 3, 4, 5.5, 5.5 – and their sum is still 21. The average method keeps this sum intact, maintaining the mathematical integrity of subsequent correlation calculations.
There are actually multiple methods for handling tied ranks (such as assigning the minimum rank or the maximum rank to tied values), but the most common way is to assign the average rank of the tied values – and this is the standard approach used in Spearman’s rho and Kendall’s tau calculations.
Verifying your rankings: the sum check
One simple but effective way to verify that you’ve ranked your data correctly is to check the sum of the ranks. For a dataset of n values, the expected sum of all ranks is always:
Sum = n(n + 1) / 2
For a dataset of 6 values: 6 ร 7 / 2 = 21
If your ranks add up to a different number, you’ve made an error somewhere. This simple check acts as a built-in accuracy test before you proceed to calculate your correlation coefficient. Errors in ranking – even small ones – can meaningfully distort your results, so this verification step is always worth doing.
Ranking two variables for correlation
When calculating a rank-order correlation like Spearman’s rho, you’ll be working with two variables measured on the same participants. Each variable needs to be ranked independently using the exact same procedure described above.
For example, suppose you want to examine whether anxiety scores and sleep quality ratings are related. You would rank the anxiety scores (Variable X) and the sleep quality ratings (Variable Y) separately – each from lowest to highest – handling any ties within each variable independently. Once both variables are ranked, those ranked values are what feed into the Spearman or Kendall formula.
Spearman’s correlation measures the strength and direction of the monotonic association between two ranked variables – meaning it tells you whether, as one variable’s rank increases, the other variable’s rank tends to increase (positive correlation) or decrease (negative correlation).
Ranking as the gateway to Spearman’s rho and Kendall’s tau
Ranking data is the shared foundation for the two most commonly used non-parametric correlation coefficients in psychology research.
Spearman’s rho (ฯ)
Spearman’s rank-order correlation coefficient is a nonparametric measure of the strength and direction of association that exists between two variables measured on at least an ordinal scale. Once both variables are ranked, Spearman’s rho uses the difference between each pair of ranks (d) to compute the correlation. It is particularly well-suited when your data contains outliers, is skewed, or doesn’t meet parametric assumptions.
Kendall’s tau (ฯ)
Kendall’s tau is another rank-based correlation coefficient that works slightly differently – rather than using rank differences, it counts the number of concordant and discordant pairs in the data. It is particularly useful when there are a large number of tied ranks in your data, making it a strong complement to Spearman’s rho in datasets where ties are common.
Both methods depend entirely on the quality of your rankings. If you’ve ranked your data accurately – including handling ties correctly – these correlation coefficients will produce valid, interpretable results.
Common mistakes to avoid when ranking
Even experienced researchers can make errors in the ranking process. Here are the most frequent ones to watch out for:
- Forgetting to identify all ties. A quick sort of the data before ranking helps surface duplicates that might otherwise be missed.
- Ranking each variable in a different direction. If you rank Variable X from lowest to highest, you must rank Variable Y from lowest to highest too. Inconsistent direction will distort the correlation.
- Skipping the sum check. Always verify your ranks sum to n(n+1)/2 before moving forward. This catches arithmetic errors early.
- Treating tied ranks as distinct. Assigning different ranks to identical values – say, giving one a rank of 3 and another a rank of 4 when both should be 3.5 – introduces bias into the analysis.
A note on software and manual ranking
Statistical software packages like SPSS, R, and SAS can handle ranking automatically. In SPSS, for instance, running a Spearman’s correlation will rank the data in the background before computing the coefficient – you don’t need to manually create a ranked variable. However, understanding the manual process is critical. It helps you catch data entry errors, interpret what the software is doing, and make informed decisions about how to handle unusual data structures like large numbers of ties.
As the University of Texas statistics resources explain, Spearman’s correlation is simply the Pearson correlation calculated on the ranked versions of the data – a reminder that the quality of your ranks directly determines the quality of your correlation output.
What do you think? When you look at real-world psychological data – such as personality scores or wellbeing ratings – how often do you expect to encounter tied values, and how might that affect the choice between Spearman’s rho and Kendall’s tau? If two datasets have the same Spearman’s rho but were ranked with different methods for handling ties, would you trust their results equally?
References
- https://statistics.laerd.com/statistical-guides/spearmans-rank-order-correlation-statistical-guide.php
- https://scales.arabpsychology.com/stats/spearmans-rho/
- https://www.saskoer.ca/introtoappliedstatsforpsych/chapter/16-1-how-to-rank-data/
- https://explorable.com/spearman-rank-correlation-coefficient
- https://stats.libretexts.org/Courses/Colby_College/EC225:_Research_Methods_and_Statistics_for_Economics/New_Page/13:_Nonparametric_Tests_(not_covered_in_EC225)/13.03:_Ranking_Data
- https://blogs.sas.com/content/iml/2021/04/19/tied-ranks.html
- https://statistics.laerd.com/spss-tutorials/spearmans-rank-order-correlation-using-spss-statistics.php
- https://sites.utexas.edu/sos/guided/inferential/numeric/bivariate/rankcor/
Leave a Reply