Log in

View Full Version : Spearman's rank correlation


Carged
Feb 10, 2009, 07:27 AM
Hi, I am trying to carry out a Spearman's rank correlation on two sets of data.

The first is diversity and altitude and the numbers are:

Altitude Diversity
348 202
555 140
916 39

The second is abundace and altitude:

Altitude Abundance
348 212
555 228
916 97

Now, I cannot seem to do a Spearmans test using this data on SigmaStat or Miinitab and do know why it won't work. I did it by hand instead and got the results -0.5 and -1 respectively, but I was told the first one is wrong.

Can you tell me how to do it?

Also, I do not understand how to check the significance of the results since the n value on the table of critical values starts at 5 but my degrees of freedom is less than this.

Thanks for any help you can give me, Carra.

auceye
Feb 15, 2009, 08:05 AM
Hi, I am trying to carry out a Spearman's rank correlation on two sets of data.

The first is diversity and altitude and the numbers are:

Altitude Diversity
348 202
555 140
916 39

The second is abundace and altitude:

Altitude Abundance
348 212
555 228
916 97

Now, I cannot seem to do a Spearmans test using this data on SigmaStat or Miinitab and do know why it won't work. I did it by hand instead and got the results -0.5 and -1 respectively, but I was told the first one is wrong.

Can you tell me how to do it?

Also, I do not understand how to check the significance of the results since the n value on the table of critical values starts at 5 but my degrees of freedom is less than this.

Thanks for any help you can give me, Carra.

Hi Carra, I've been studying this recently, so hopefully I can help.

Here's how I'd calculate Spearman's (apologies if you know much of this already):

First, rank the columns, i.e. the highest number is ranked 1, the second highest 2...

In your first question:

Altitude Diversity
348 202
555 140
916 39

would become

Altitude Diversity
3 1
2 2
1 3

Find the difference, d, between the rank for altitude and for diversity in each row, and square it:

Altitude Diversity d d^2
3 1 3-1= 2 4
2 2 2-2= 0 0
1 3 1-3= -2 4

Find the total of the d^2 column, ∑d^2 = 8
Note: ∑ means "sum of"

Now substitue into the following formula:

Spearman's rank = 1 - (6∑d^2 / n(n^2 -1))

To do this, multiply ∑d^2 by 6 to get 6x8=48

n is the number of pairs of values you have in the table. In this question, n=3

3(3^2 - 1) = 24

So now we know
6∑d^2 = 48
n(n^2 -1) = 24

we can do 6∑d^2 / n(n^2 -1)

48/24 = 2

now all that remains in the formula is to do the 1- part

1-2 = -1

So there is how you can work it out for any set of data. I won't give away the second one!

As for the significance part, that is not on our syllabus and therefore I simply don't know. I'm sure somebody else out there will be able to help with that. If you find out, do let us all know how this part is done (unless of course you find out from of post on here!)

Best of luck,

Ben