Spearman’s Rank Correlation Detailed

We show how to calculate Spearman’s rho and how to use it for hypothesis testing.

Example 1: The table in Figure 1 associates the IQ of each adolescent in a sample with the number of hours they listen to rap music per month. Determine the strength of the correlation between IQ and rap music using both the Pearson’s correlation coefficient and Spearman’s rank correlation. Compare the results.

Data Spearman's rho Excel

Figure 1 – Data for Example 1

To calculate Spearman’s rho, we need to determine the rank for each of the IQ scores and each of the Rap scores. E.g. the rank of the first IQ score (cell A4 in Figure E3.1) is =RANK.AVG(A4,A$4:A$13,1), and so we put this formula in cell C4. If you are using Excel 2007 you would use the supplemental function RANK_AVG instead of RANK.AVG (as explained in Ranking).

We now calculate both correlation coefficients as follows:

Pearson’s correlation = CORREL(A4:A13,B4:B13) = -0.036

Spearman’s rho = CORREL(C4:C13,D4:D13) = -0.115

The above analysis shows there isn’t much of a correlation between IQ and listening to rap music based on the sample, although the Spearman’s rho is closer to zero (indicating independent samples) than the Pearson’s.

Observation: For sufficiently high values of  (some say n > 10), Theorem 1 and 2 of One Sample Hypothesis Testing for Correlation can now be used for hypothesis testing using the Spearman’s rank coefficient instead of the correlation coefficient. For lower values, the table of critical values found in Spearman’s Rho Table can be used

When conducting an analysis, if you discover the presence of outliers (e.g. via a histogram or scatter diagram), proceed as follows:

Calculate the Pearson’s correlation coefficient for the sample with and without the outliers. If there isn’t much difference, then you can be pretty confident that the outliers are not influencing the results. You can also calculate the Spearman’s rank coefficient. If this is pretty similar to the Pearson’s correlation coefficient, this is also a good indicator that the outliers are not substantially influencing the results.

If there are clear differences then you will need to be cautious about how you treat the outliers.

Similarly if you test the sample data for the x and y variables and see that either one of them is not roughly normal (using the techniques described in Testing for Normality and Symmetry), then you will need to use the Spearman’s coefficient rather than Pearson’s.

Figure 2 displays a scatter diagram for the data in Example 1 We see that the data is pretty randomly scattered although there is a potential outlier where the rap music listening spikes to 45. This gives some evidence that the Spearman’s rho might be a better choice.

Scatter plot Spearman's rho

Figure 2 – Scatter diagram for data from Example 1

Observation: When there are no ties in the ranking, there is alternative way of calculating Spearman’s rho using the following property.

Property 1: When there are no ties, Spearman’s rho =

Spearman's rho

where di = rank xi – rank yi.

Example 2: Calculate Spearman’s rho for the data from Example 1 using Property 1.

Spearman's rank correlation Excel

Figure 3 – Alternative way of calculating rho for Example 1

Using Property 1 and the table in Figure 3:

image3655

Example 3: Repeat the analysis for Example 1 of One Sample Hypothesis Testing for Correlation using Spearman’s rho.

Data ranking

Figure 4 – Ranking of data for Example 3

As for Example 1, Spearman’s rho is the correlation coefficient on the ranked data, namely CORREL(C5:C19,D5:D19) = -.674 (see Figure 4).

We now use the table in Spearman’s Rho Table to find the critical value for the two-tail test where = 15 and α = .05. Interpolating between the values for n = 14 and 16, we get a critical value of .525. Since the absolute value of rho is larger than the critical value, we reject the null hypothesis that there is no correlation between cigarette smoking and longevity.

Since n = 15 ≥ 10, we can use a t-test instead of the table. By Theorem 1 of One Sample Hypothesis Testing for Correlation, we use the test statistic

image3657

Since |t| = 3.29 > 2.16 = tcrit = TINV(.05,13), we again conclude that there is a significant negative correlation between the number of cigarettes smoked and longevity.

Observation: To conduct a one-tail test, use the table in Spearman’s Rho Table with α divided by 2.

Real Statistics Excel Function: The following function is provided in the Real Statistics Resource Pack:

RhoCRIT(n, α, t) = the critical value of the Spearman’s rho test for samples of size n, for the given value of alpha, and t = 1 (one tail) or 2 (two tails).

9 Responses to Spearman’s Rank Correlation Detailed

  1. Walid says:

    Thank you so much. Life has become much easier with real-statistics.
    Walid (MSc, PhD)

  2. Taufiq says:

    Hi ! I tried using the formula RhoCRIT to find a critical value for my data, but all it shows is #N/A .

    I already installed the resources from the site following the step-by-step guide, so it should’ve worked.

    My sample size is 275, alpha 0.05, 2 tailed. Can you use the formula to calculate it ? Thanks !

  3. Colin says:

    Sir
    In example 1, you wrote:”We now calculate both correlation coefficients as follows:

    Pearson’s correlation = CORREL(A4:A13,B4:B13) = -0.036

    Spearman’s rho = CORREL(C4:C13,D4:D13) = -0.115

    The above analysis shows there isn’t much of a correlation between IQ and listening to rap music based on the sample, although the Spearman’s rho is closer to zero (indicating independent samples) than the Pearson’s.”

    Spearman’s rho is closer to zero?

  4. valen says:

    kindly give me the answer of this..How will i rank the same 4 scores example 1,2,3,4,5,5,5,5,6,7,8

    • Charles says:

      Valen,
      I don’t completely understand your question, but the rankings for the 11 numbers you listed are 1, 2, 3, 4, 6.5, 6.5, 6.5,6.5, 9, 10, 11.
      Charles

  5. Vinh says:

    Sir,
    What is the different between Pearson’s correlation and Spearman’s rho ?
    What’s the correlation we should use?

    Thank

    • Charles says:

      Vinh,
      Pearson’s correlation is the usual correlation coefficient calculated on the raw data. Spearman’s rho is Pearson’s correlation calculated on the ranks of the raw data. Generally you should use Pearson’s correlation.
      Charles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>