Worked example 1
Our worked example uses data from Luiselli (2006) who tested hypotheses on the ecological patterns of rarity using snake communities worldwide. In we looked at whether the percentage of rare species was significantly different among continents. Here we assess whether there is a relationship between the percentage of rare species in an area and species richness. Data are presented below:
Snake data 
No. sp. 
Rank 
% rare 
Rank 
8 24 17 18 16 12 15 13 5 3 12 20 28 6 6 34 6 17 68 7 4 33 23 5 9 46 14 17 18 17 5 10 5 27 17 
11.0 29.0 22.0 25.5 19.0 14.5 18.0 16.0 4.5 1.0 14.5 27.0 31.0 8.0 8.0 33.0 8.0 22.0 35.0 10.0 2.0 32.0 28.0 4.5 12.0 34.0 17.0 22.0 25.5 22.0 4.5 13.0 4.5 30.0 22.0 
12.5 20.8 11.8 16.7 18.7 8.33 20 23.1 0 0 0 10 25 0 0 14.7 0 23.5 14.7 14.2 0 3 17.4 0 0 23.9 21.4 5.9 38.9 11.8 0 10 0 33.3 29.4 
19.0 27.0 17.5 23.0 25.0 14.0 26.0 29.0 6.0 6.0 6.0 15.5 32.0 6.0 6.0
21.5 6.0 30.0 21.5 20.0 6.0 12.0 24.0 6.0 6.0 31.0 28.0 13.0 35.0 17.5 6.0 15.5 6.0 34.0 33.0 
{Fig. 1}
It is not immediately clear from this figure whether the relationship can be considered monotonic. Hence we do a plot of rank (Y) against rank (X) to try to clarify the situation:
{Fig. 2}
The plot of rank (Y) against rank (X) does indeed appear to be linear (albeit with a lot of scatter), so we can assume we are dealing with a monotonic relationship. Whether the bivariate observations are independent is less clear, as it is possible that the areas of some of the studies overlapped. With that word of caution, we proceed with estimation of the Spearman correlation coefficient.
Using
Since there are ties, we will use the full form of the equation.
r_{s} 
= 
13832−(35 x 18^{2}) 

√[14892 − (35 x 18^{2})]
√[14798.5− (35 x 18^{2})]


= 
0.7110 
 
where
 r_{s} is the Spearman correlation coefficient,
 R(X) and R(Y) are the ranks of the individual observations of the two variables,
 n is the number of bivariate observations

The sample size is moderate (n = 35) so we can studentize the statistic by dividing by its standard error:
t 
= 
0.7110 
√ 

= 
5.808 
35 − 2 

1 − 0.7110^{2} 
 
The Pvalue for this value can be obtained from the t distribution (df=2). R gives this as 0.000009 so we accept there is a highly significant positive association between the percentage of rare species in an area and species richness.