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.

**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 *n *= 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

Since |*t*| = 3.29 > 2.16 = *t _{crit} *= 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.

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

**Figure 3 – Output from SCORREL function**

Thank you so much. Life has become much easier with real-statistics.

Walid (MSc, PhD)

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 !

Hi Taufiq,

The RhoCRIT function is only valid for values of n between 4 and 30 (see http://www.real-statistics.com/statistics-tables/spearmans-rho-table/). For n = 275 you use the t-test as described in http://www.real-statistics.com/correlation/spearmans-rank-correlation/spearmans-rank-correlation-detailed/ (see example following Figure 4 on that webpage).

Charles

Thank you sir

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?

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

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

Sir,

What is the different between Pearson’s correlation and Spearman’s rho ?

What’s the correlation we should use?

Thank

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

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”

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

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?

Kate,

By connected ranks do you mean tied ranks?

Charles

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.

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

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

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.

Lalit,

I just tried =RhoCRIT(4), =RhoCRIT(5), …, =RhoCRIT(30) and they work perfectly. They generate the values found in the table shown on the webpage http://www.real-statistics.com/statistics-tables/spearmans-rho-table/.

What version of the Real Statistics Resource Pack are you using? You can find this out by entering the formula =VER() in any cell.

Charles

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

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

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

Charles,

I’m experimenting with the Spearman Rho, using ranked data that contain ties. The examples given in text books use rank date with no ties. My interest is comparing the rho value using SCORREL and the conventional 1-sum(d^2)/n(n^2-1) formula.

Thanks

Dan

Dan,

I have not tried to make such a comparison, but would be interested to in hearing what you discover.

Charles

Excel freezes everytime i try using the =Scorrel function!! i really do need it, what should i do?? thanks!

Richard,

If you send me an Excel spreadsheet with your data, I will try to figure out what is going wrong. Send it to czaiontz@gmail.com. Also which version of Excel are you using?

Charles

Hi! Could somebody please help on my Master`s thesis I am doing. I have an observation instrument and a questionnaire to compare and make a correlation between them based on some categories and points. I need Spearman`s correlation function to do this in Excel 2007. I would be so grateful if you could help me.

You can do this as explained on the referenced webpage. In particular, you can use the SCORREL function found in the Real Statistics Resource Pack. There is a version for Excel 2007 which you can download for free.

Charles

Thank you Charles, but could you tell me how exactly can I use SCORREL function to correlate the questionnaire and the observation?