<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tcs.nju.edu.cn/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=41.212.128.48</id>
	<title>TCS Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://tcs.nju.edu.cn/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=41.212.128.48"/>
	<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=Special:Contributions/41.212.128.48"/>
	<updated>2026-05-26T16:11:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://tcs.nju.edu.cn/wiki/index.php?title=Spearman%27s_rank_correlation_coefficient&amp;diff=7702</id>
		<title>Spearman&#039;s rank correlation coefficient</title>
		<link rel="alternate" type="text/html" href="https://tcs.nju.edu.cn/wiki/index.php?title=Spearman%27s_rank_correlation_coefficient&amp;diff=7702"/>
		<updated>2017-01-06T12:36:42Z</updated>

		<summary type="html">&lt;p&gt;41.212.128.48: /* Related pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In [[mathematics]] and [[statistics]], &#039;&#039;&#039;Spearman&#039;s rank correlation coefficient&#039;&#039;&#039; is a measure of [[correlation]], named after its maker, [[Charles Spearman]]. It is written in short as the Greek letter &#039;&#039;rho&#039;&#039; (&amp;lt;math&amp;gt;\rho&amp;lt;/math&amp;gt;) or sometimes as &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt;. It is a number that shows how closely two sets of [[Information|data]] are linked. It only can be used for data which can be put in order, such as highest to lowest.&lt;br /&gt;
&lt;br /&gt;
The general formula for &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;\rho=1-\cfrac {6\sum d^2}{n(n^2-1)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
For example, if you have data for how expensive different [[computers]] are, and data for how fast the computers are, you could see if they are linked, and how closely they are linked, using &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Working it out ==&lt;br /&gt;
=== Step one ===&lt;br /&gt;
To work out &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt; you first have to &#039;&#039;rank&#039;&#039; each piece of data. We are going to use the example from the intro of computers and their speed.&lt;br /&gt;
&lt;br /&gt;
So, the computer with the lowest price would be rank &#039;&#039;&#039;1&#039;&#039;&#039;. The one higher than that would have &#039;&#039;&#039;2&#039;&#039;&#039;. Then, it goes up until it is all ranked. You have to do this to both sets of data.&amp;lt;ref name=&amp;quot;CGP-book&amp;quot;&amp;gt;{{cite book |last=Parsons |first=Richard |title=GCSE Statistics |publisher=[http://www.cgpbooks.co.uk Coordination Group Publications] |year= 2008 |isbn= 184762149X }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;[[PC]]&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Price ($)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;&amp;lt;math&amp;gt;Rank_1&amp;lt;/math&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Speed (GHz)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;&amp;lt;math&amp;gt;Rank_2&amp;lt;/math&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| A||200||1||1.80||2&lt;br /&gt;
|-&lt;br /&gt;
| B||275||2||1.60||1&lt;br /&gt;
|-&lt;br /&gt;
| C||300||3||2.20||4&lt;br /&gt;
|-&lt;br /&gt;
| D||350||4||2.10||3&lt;br /&gt;
|-&lt;br /&gt;
| E||600||5||4.00||5&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Step two ===&lt;br /&gt;
Next, we have to find the &#039;&#039;difference&#039;&#039; between the two ranks. Then, you multiply the difference by itself, which is called squaring. The difference is called &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt;, and the number you get when you square &amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt; is called &amp;lt;math&amp;gt;d^2&amp;lt;/math&amp;gt;.&amp;lt;ref name=CGP-book/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;&amp;lt;math&amp;gt;Rank_1&amp;lt;/math&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;&amp;lt;math&amp;gt;Rank_2&amp;lt;/math&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;&amp;lt;math&amp;gt;d&amp;lt;/math&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;&amp;lt;math&amp;gt;d^2&amp;lt;/math&amp;gt;&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1||2||-1||1&lt;br /&gt;
|-&lt;br /&gt;
| 2||1||1||1&lt;br /&gt;
|-&lt;br /&gt;
| 3||4||-1||1&lt;br /&gt;
|-&lt;br /&gt;
| 4||3||1||1&lt;br /&gt;
|-&lt;br /&gt;
| 5||5||0||0&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Step three ===&lt;br /&gt;
Count how much data we have. This data has ranks 1 to 5, so we have 5 pieces of data. This number is called &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;.&amp;lt;ref name=CGP-book/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Step four ===&lt;br /&gt;
Finally, use everything we have worked out so far in this formula: &amp;lt;math&amp;gt; r_s=1-\cfrac {6\sum d^2}{n(n^2-1)}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\sum d^2&amp;lt;/math&amp;gt; means that we take the total of all the numbers that were in the column &amp;lt;math&amp;gt;d^2&amp;lt;/math&amp;gt;. This is because &amp;lt;math&amp;gt;\sum&amp;lt;/math&amp;gt; means total.&lt;br /&gt;
&lt;br /&gt;
So, &amp;lt;math&amp;gt;\sum d^2&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;1+1+1+1&amp;lt;/math&amp;gt; which is 4. The formula says multiply it by 6, which is 24.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;n(n^2-1)&amp;lt;/math&amp;gt; is &amp;lt;math&amp;gt;5 \times (25-1)&amp;lt;/math&amp;gt; which is 120.&lt;br /&gt;
&lt;br /&gt;
So, to find out &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt;, we simply do &amp;lt;math&amp;gt;1-\cfrac {24}{120} = 0.8 &amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Therefore, Spearman&#039;s rank correlation coefficient is 0.8 for this set of data.&lt;br /&gt;
&lt;br /&gt;
== What the numbers mean ==&lt;br /&gt;
[[File:Positive correltion lobf.JPG|thumb|This scatter graph has positive correlation. The &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt; value would be near 1 or 0.9. The red line is a line of best fit.]]&amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt; always gives an answer between −1 and 1. The numbers between are like a scale, where −1 is a very strong link, 0 is no link, and 1 is also a very strong link. The difference between 1 and −1 is that 1 is a positive correlation, and −1 is a negative correlation.  A graph of data with a &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt; value of −1 would look like the graph shown except the line and points would be going from top left to bottom right.&lt;br /&gt;
&lt;br /&gt;
For example, for the data that we did above, &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt; was 0.8. So this means that there is a positive correlation. Because it is close to 1, it means that the link is strong between the two sets of data. So, we can say that those two sets of data are &#039;&#039;linked&#039;&#039;, and go &#039;&#039;up&#039;&#039; together. If it was −0.8, we could say it was &#039;&#039;linked&#039;&#039; and as one goes up, the other goes down.&lt;br /&gt;
&lt;br /&gt;
== If two numbers are the same ==&lt;br /&gt;
Sometimes, when ranking data, there are two or more numbers that are the same. When this happens in &amp;lt;math&amp;gt;r_s&amp;lt;/math&amp;gt;, we take the [[mean]] or average of the ranks that are the same. These are called &#039;&#039;tied&#039;&#039; ranks. To do this, we rank the tied numbers as if they were not tied. Then, we add up all the ranks that they would have, and divide it by how many there are.&amp;lt;ref&amp;gt;[http://www.statistics4u.info/fundstat_eng/cc_corr_spearman.html Spearman&#039;s Rank at www.statistics4u.info]&amp;lt;/ref&amp;gt;  For example, say we were ranking how well different people did in a spelling test.&lt;br /&gt;
&lt;br /&gt;
{| {{table}}&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Test score&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Rank&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Rank (with tied)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 4||1||1&lt;br /&gt;
|-&lt;br /&gt;
| 6||2||&amp;lt;math&amp;gt;\tfrac {2+3+4}{3} = 3&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 6||3||&amp;lt;math&amp;gt;\tfrac {2+3+4}{3} = 3&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 6||4||&amp;lt;math&amp;gt;\tfrac {2+3+4}{3} = 3&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 8||5||&amp;lt;math&amp;gt;\tfrac {5+6}{2} = 5.5&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 8||6||&amp;lt;math&amp;gt;\tfrac {5+6}{2} = 5.5&amp;lt;/math&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These numbers are used in exactly the same way as normal ranks.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
*[[Correlation]]&lt;br /&gt;
&lt;br /&gt;
== Notes and references ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Statistics]]&lt;br /&gt;
[[Category:Mathematics]]&lt;/div&gt;</summary>
		<author><name>41.212.128.48</name></author>
	</entry>
</feed>