Spearman's rank correlation coefficient

By Jonesy44 on Sep 30, 2008

Spearman's rank correlation coefficient is a method of seeing how close two sets of data are together, giving a number between -1 and 1 showing if the data is related or not, this script simply shows you the result without the hastle of going through the forumula;

First enter the difference squared, if you don't already know how this works: http://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient Wiki is god :P then enter the amount of data you have and it'll display the result

I tried to keep the code as short as possible using the $iif idents so dont bitch :P hope this helps some students out slaving away at their geography/math coursework :P

alias sr {
  var %d2 = $$input(Enter Sum of Difference^2,eq,Spearman's Rank - Input), %n = $$input(Enter number of rows of data you have,eq,Spearman's Rank - Input), %res = $calc(1 - (6 * %d2) / ((%n ^ 3) - %n))
  noop $input($iif(%res isnum -1 - 1,Correlation: %res ( $+ $calc($remove(%res,-) * 100) $+ % match $+ ),An Error Occured; your data is incorrect),oi,Spearman's Rank - Result)


Sign in to comment.
Jonesy44   -  Oct 01, 2008

Simply get 2 sets of data group them into order and arrange low to high square the diff between each group then put the sum of it into this snippet

Paul_1337noob   -  Oct 01, 2008

whats that in english?

Jonesy44   -  Sep 30, 2008

Booya, pwnage! this sure will save me hours of work with my geog c/w ;P

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.