## An R Companion for the Handbook of Biological Statistics

Salvatore S. Mangiafico

# Spearman Rank Correlation

When to use it

Null hypothesis

Assumption

How the test works

See the Handbook for information on these topics.

### Example

#### Example of Spearman rank correlation

### --------------------------------------------------------------
### Spearman rank correlation, frigatebird example
### p. 212
### --------------------------------------------------------------

Input = ("
Volume   Pitch
1760    529
2040    566
2440    473
2550    461
2730    465
2740    532
3010    484
3080    527
3370    488
3740    485
4910    478
5090    434
5090    468
5380    449
5850    425
6730    389
6990    421
7960    416
")

cor.test( ~ Pitch + Volume,
data=Data,
method = "spearman",
continuity = FALSE,
conf.level = 0.95)

Spearman's rank correlation rho

S = 1708.382, p-value = 0.0002302

sample estimates:

rho

-0.7630357

##### Simple plot of the data

plot(Pitch ~ Volume,
data=Data,
pch=16)

#     #     #

Graphing the results

See the Handbook for information on this topic.

### How to do the test

#### Example of Spearman rank correlation

### --------------------------------------------------------------
### Spearman rank correlation, species diversity example
### p. 214
### --------------------------------------------------------------

Input = ("
Town                  State  Latitude  Species
'Bombay Hook'          DE     39.217    128
'Cape Henlopen'        DE     38.800    137
'Middletown'           DE     39.467    108
'Milford'              DE     38.958    118
'Rehoboth'             DE     38.600    135
'Seaford-Nanticoke'    DE     38.583     94
'Wilmington'           DE     39.733    113
'Crisfield'            MD     38.033    118
'Denton'               MD     38.900     96
'Elkton'               MD     39.533     98
'Lower Kent County'    MD     39.133    121
'Ocean City'           MD     38.317    152
'Salisbury'            MD     38.333    108
'S Dorchester County'  MD     38.367    118
'Cape Charles'         VA     37.200    157
'Chincoteague'         VA     37.967    125
'Wachapreague'         VA     37.667    114
")

cor.test( ~ Species + Latitude,
data=Data,
method = "spearman",
continuity = FALSE,
conf.level = 0.95)

Spearman's rank correlation rho

S = 1111.908, p-value = 0.1526

rho

-0.3626323

##### Simple plot of the data

plot(Species ~ Latitude,
data=Data,
pch=16)

#     #     #