# SpearmanRho

SpearmanRho[v1,v2]

gives Spearman's rank correlation coefficient for the vectors v1 and v2.

SpearmanRho[m]

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

SpearmanRho[m1,m2]

gives Spearman's rank correlation coefficient for the matrices m1 and m2.

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.

# Details • SpearmanRho[v1,v2] gives Spearman's rank correlation coefficient between v1 and v2.
• 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 is equal to Length[xlist], is the rank difference between and , is the correction term for ties in v1, and is the correction term for ties in v2.
• SpearmanRho[{v11,v12,},{v21,v22,}] is equivalent to Correlation[{r11,r12,},{r21,r22,}] where rij is the tie-corrected ranking corresponding to vij.
• The arguments v1 and v2 can be any realvalued 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 m1 and an × matrix m2 SpearmanRho[m1,m2] is a × matrix of the rank correlations between columns of m1 and columns of m2.
• 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 disti,j is the  marginal of dist.
• SpearmanRho[dist] gives a matrix where the  entry is given by SpearmanRho[dist,i,j].

# Examples

open all close all

## Basic Examples(4)

Spearman's for two vectors:

 In:= In:= Out= Spearman's for a matrix:

 In:= In:= Out//MatrixForm= Spearman's for two matrices:

 In:= In:= In:= Out//MatrixForm= Compute Spearman's for a bivariate distribution:

 In:= In:= Out//MatrixForm= Compare to a simulated value:

 In:= Out//MatrixForm= ## Properties & Relations(10)

Introduced in 2012
(9.0)