BUILT-IN MATHEMATICA SYMBOL

# SpearmanRho

SpearmanRho[v1, v2]
gives Spearman's rank correlation coefficient for the vectors and .

SpearmanRho[m]
gives Spearman's rank correlation coefficient for the matrix m.

SpearmanRho[m1, m2]
gives Spearman's rank correlation coefficient for the matrices and .

SpearmanRho[dist]
gives Spearman's rank correlation matrix for the multivariate symbolic distribution dist.

SpearmanRho[dist, i, j]
gives the Spearman rank correlation for the multivariate symbolic distribution dist.

## DetailsDetails

• SpearmanRho[v1, v2] gives Spearman's rank correlation coefficient between and .
• Spearman's is a measure of association based on the rank differences between two lists which indicates how well a monotonic function describes their relationship.
• Spearman's is given by , where n=Length[xlist], is the rank difference between and , is the correction term for ties in , and is the correction term for ties in .
• SpearmanRho[{v11, v12, ...}, {v21, v22, ...}] is equivalent to Correlation[{r11, r12, ...}, {r21, r22, ...}] where is the tie-corrected ranking corresponding to .
• The arguments and can be any real-valued vectors of equal length.
• For a matrix m with columns SpearmanRho[m] is a × matrix of the rank correlations between columns of m.
• For an × matrix and an × matrix SpearmanRho[m1, m2] is a × matrix of the rank correlations between columns of and columns of .
• SpearmanRho[dist, i, j] is 12 Expectation[F[x]G[y], {x, y}disti, j] - 3 where F[x] and G[y] are the CDFs of the i and j marginals of dist, respectively, and is the marginal of dist.
• SpearmanRho[dist] gives a matrix where the entry is given by SpearmanRho[dist, i, j].

## ExamplesExamplesopen allclose all

### Basic Examples (4)Basic Examples (4)

Spearman's for two vectors:

 Out[2]=

Spearman's for a matrix:

 Out[2]//MatrixForm=

Spearman's for two matrices:

 Out[3]//MatrixForm=

Compute Spearman's for a bivariate distribution:

 Out[2]//MatrixForm=

Compare to a simulated value:

 Out[3]//MatrixForm=