Spearman’s Rank Correlation Hypothesis Testing

On this webpage we show how to use Spearman’s rank correlation for hypothesis testing. In particular, we show how to test whether there is a correlation between two random variables by testing whether or not Spearman’s rho = 0 (the null hypothesis).

For low values of rho, a table of critical values can be used (see Spearman’s Rho Table). For higher values (generally about n > 10), Theorem 1 and 2 of One Sample Hypothesis Testing for Correlation is applied using Spearman’s rho in place of Pearson’s correlation r.

In general, however, Kendall’s tau is often the preferred non-parametric approach since it has more desirable statistical properties.

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

We show the data along with the rankings in Figure 1.

Data ranking

Figure 1 – Data and ranking of data for Example 1

Spearman’s rho is the correlation coefficient on the ranked data, namely CORREL(C5:C19,D5:D19) = -.674. Alternatively it can be computed using the Real Statistics formula =SCORREL(A5:A19,B5:B19).

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

image9001

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. The details of the analysis are shown in Figure 2.

Spearman's rho hypothesis testing

Figure 2 – Hypothesis testing of Spearman’s rho

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, α, tails) = the critical value of the Spearman’s rho test for samples of size n, for the given value of alpha (default .05), and tails = 1 or 2 (default).

The SCORREL function described in Spearman’s Correlation can also be used for hypothesis testing.

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

SCORREL(R1, R2, lab, tails): in addition to calculating Spearman’s correlation coefficient (rho), this statistic is tested for the null hypothesis rho = 0 using a t test and the t-stat and p-value of the test are returned. If lab = TRUE then a column of labels are added to the output. tails = 1 or 2 (default) and lab = TRUE or FALSE (default).

For Example 1 of Spearman’s Correlation, SCORREL(A5:A19,B5:B19,TRUE) returns the output shown in Figure 3.

Spearman's rho function output

Figure 3 – Output from SCORREL function

21 Responses to Spearman’s Rank Correlation Hypothesis Testing

  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

  6. kirk barrett says:

    thanks for the explanation.

    I think it would be a little clearer if you explained that even tho
    its called “spearman’s rho”, if is often represented r with a subscript of s (to distinguish it from pearson’s corr. coeff)

    Also the calculation of t shows “r” (implying pearson’s coef)
    when i believe it should be “r sub s”

    • Charles says:

      Kirk,
      You are correct. I actually used r with a subscripted s in one place on the webpage but not in the others. I have now made this change. Thanks for your valuable suggestions.
      Charles

  7. Kate says:

    Sir, thank You for such perfect resource!
    Just one question. Sir, in case of significant amount of the connected ranks does the spearsman rho show still correct result? Starting from which number of connected rank groups the correction for spearsman rho coefficient should be applied? or it will be not applicable at all?

    • Charles says:

      Kate,
      By connected ranks do you mean tied ranks?
      Charles

      • Lily says:

        Yes, could you please explain how you would do this if there are tied ranks in one of the values. I know there is a formula, but I don’t understand how exactly you would substitute values into that formula.

        • Charles says:

          Lily,
          If there are no ties you can use Property 1 of the referenced page to calculate Spearman’s rho. The more ties, the less accurate the results.
          Even if there are ties, however, you can use the approach shown in Example 3 of the referenced page (using RANK.AVG and CORREL). I believe this approach produces the correct result even if there are a lot of ties.
          Charles

    • Charles says:

      Kate,
      If there are no ties you can use Property 1 to calculate Spearman’s rho. The more ties, the less accurate the result. In any case you can use the approach shown in Example 3 of the referenced page. I believe this approach produces the correct result even if there are a lot of ties.
      Charles

  8. Lalit says:

    Sir, the command for finding critical value of t statistic ie.RhoCrit do not work if n= 4:30. Please give suggetion, because it takes more time to get critical value in other way.

  9. natalie says:

    i am now doing a proyect based on spearman and i have come to a problem, what should i do if i have only one sample instead, i have nothing to compare that sample with. i was wondering how could i calculate it, if its possible to do so.
    thanks

    • Charles says:

      Natalie,
      Correlation coefficients such as Spearman’s only make sense if there are at least two data sets. Sorry, but I don’t know of any way to calculate this coefficient with only one sample.
      Charles

  10. Mart says:

    Dear Charles,
    The clarity of your presentation and examples combined with the comprehensive cross-referencing of all relevant techniques make your site a real winner. After 25 years without touching stats it has been a tough week getting back into it. I have fought with the examples on many other sites but the simplicity of your presentation has allowed me to quickly overcome the hurdles I had faced elsewhere. Thank-you for your outstanding work,
    Mart

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>