I'm doing some practice questions in my statistics book, and started doing this one:
Find Spearman's rank correlation coefficient between X and Y for this set of data:
$X$ $13$ $20$ $22$ $18$ $19$ $11$ $10$ $15$
$Y$ $17$ $19$ $23$ $16$ $20$ $10$ $11$ $18$
I set out the data in a table, and found the difference between each value.
$d$ $4$ $1$ $1$ $2$ $1$ $1$ $1$ $3$
$d^2$ $16$ $1$ $1$ $4$ $1$ $1$ $1$ $9$
From this we can see that $\Sigma d^2 = 34$
I then calculated $r_s$ using the formula $r_s = 1- \frac{6\Sigma d^2}{n(n^2 -1)}$:
$r_s = 1- \frac{6\Sigma d^2}{n(n^2 -1)}$
$=1 – \frac{6*34}{8*63}$
$= 1- \frac{204}{504}$
$\approx 0.5952$
However, in the book the answer is given as $0.881$. So, am I wrong or is the book wrong?
Best Answer
To calculate spearman's rank correlation coefficient, you need to first convert the values of X and Y into ranks. For example in the X values, you should replace the lowest value (10) with a 1, then the second lowest (11) with a 2 until the largest (22) is replaced with 8.
Once you have done this to both the X and Y values, you can proceed with the method as above.
Hope that helps!