# Calculating the t-statistic for Hypothesis Testing on Correlation

The Spearman’s rank correlation coefficient is a non-parametric statistical test used to examine whether there is a significant relationship between two sets of data. Like the correlation coefficient, Spearman’s rank correlation can have any value between –1 and +1. A value of 0 indicates no relationship, and values of +1 indicate a perfectly positive correlation, while -1 indicates a perfectly negative correlation.

### Steps of Calculating Spearman’s Rank Correlation Coefficient

1. Rank the values of variables X and Y in descending order.
2. Find the difference (denoted as $$d_i$$) between the rank of the pair values of X and Y.
3. Square the difference and calculate the sum of the difference, that is $$\sum d_i$$.
4.  Calculate the Spearman’s rank correlation coefficient as follows:

$$r_{s}=1-\frac{6 \sum d_{i}^{2}}{n\left(n^{2}-1\right)}$$

Example: Calculatig Spearman’s Rank Correlation Coefficient

An analyst is studying the relationship between returns for two sectors, steel and cement over past 5 years by using spearman’s rank correlation coefficient. The returns of both sectors are provided as under.

$$\begin{array}{c|c|c} \textbf { Year } & \textbf { Steel sector returns } & \textbf { Cement sector returns } \\ \hline 1 & 2.5 \% & 3.2 \% \\ \hline 2 & 5 \% & 4.5 \% \\ \hline 3 & 5.6 \% & 4.2 \% \\ \hline 4 & -3 \% & -1.7 \% \\ \hline 5 & 0.5 \% & 1.1 \% \\ \end{array}$$

The Spearman’s rank correlation coefficient is closest to:

Solution

$$\begin{array}{c|c|c|c|c|c|c} \textbf { Year } & \begin{array}{l} \textbf { Steel } \\ \textbf { sector } \\ \textbf { returns } \\ \textbf { (X) } \end{array} & \begin{array}{l} \textbf { Cement } \\ \textbf { sector } \\ \textbf { returns } \\ \textbf{ (Y) } \end{array} & \begin{array}{l} \textbf { Rank of } \\ \textbf { X } \end{array} & \begin{array}{l} \textbf { Rank of } \\ \mathrm{Y} \end{array} & \bf{d} & \bf{d^2} \\ \hline 1 & 2.50 \% & 1.60 \% & 3 & 4 & -1 & 1 \\ \hline 2 & 5 \% & 4.50 \% & 2 & 1 & 1 & 1 \\ \hline 3 & 5.60 \% & 4.20 \% & 1 & 2 & -1 & 1 \\ \hline 4 & -3 \% & -1.70 \% & 5 & 5 & 0 & 0 \\ \hline 5 & 0.50 \% & 2.20 \% & 4 & 3 & 1 & 1 \\ \hline & & & & & \textbf { Sum } & 4 \\ \end{array}$$

We can now use the formula:

\begin{align} r_{s}&=1-\frac{6 \sum d_{i}^{2}}{n\left(n^{2}-1\right)} \\ &=1- \left[\frac{(6 \times 4)}{ 5 \times (5^2 – 1)}\right] \\ &= 0.8 \end{align}

Shop CFA® Exam Prep

Offered by AnalystPrep

Featured Shop FRM® Exam Prep Learn with Us

Subscribe to our newsletter and keep up with the latest and greatest tips for success

Sergio Torrico
2021-07-23
Excelente para el FRM 2 Escribo esta revisión en español para los hispanohablantes, soy de Bolivia, y utilicé AnalystPrep para dudas y consultas sobre mi preparación para el FRM nivel 2 (lo tomé una sola vez y aprobé muy bien), siempre tuve un soporte claro, directo y rápido, el material sale rápido cuando hay cambios en el temario de GARP, y los ejercicios y exámenes son muy útiles para practicar.
diana
2021-07-17
So helpful. I have been using the videos to prepare for the CFA Level II exam. The videos signpost the reading contents, explain the concepts and provide additional context for specific concepts. The fun light-hearted analogies are also a welcome break to some very dry content. I usually watch the videos before going into more in-depth reading and they are a good way to avoid being overwhelmed by the sheer volume of content when you look at the readings.
Kriti Dhawan
2021-07-16
A great curriculum provider. James sir explains the concept so well that rather than memorising it, you tend to intuitively understand and absorb them. Thank you ! Grateful I saw this at the right time for my CFA prep.
nikhil kumar
2021-06-28
Very well explained and gives a great insight about topics in a very short time. Glad to have found Professor Forjan's lectures.
Marwan
2021-06-22
Great support throughout the course by the team, did not feel neglected
Benjamin anonymous
2021-05-10
I loved using AnalystPrep for FRM. QBank is huge, videos are great. Would recommend to a friend
Daniel Glyn
2021-03-24
I have finished my FRM1 thanks to AnalystPrep. And now using AnalystPrep for my FRM2 preparation. Professor Forjan is brilliant. He gives such good explanations and analogies. And more than anything makes learning fun. A big thank you to Analystprep and Professor Forjan. 5 stars all the way!
michael walshe
2021-03-18
Professor James' videos are excellent for understanding the underlying theories behind financial engineering / financial analysis. The AnalystPrep videos were better than any of the others that I searched through on YouTube for providing a clear explanation of some concepts, such as Portfolio theory, CAPM, and Arbitrage Pricing theory. Watching these cleared up many of the unclarities I had in my head. Highly recommended.