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 ^(th) 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 is equal to 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 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 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^(th) and j^(th) marginals of dist, respectively, and is the ^(th) marginal of dist.
  • SpearmanRho[dist] gives a matrix where the ^(th) entry is given by SpearmanRho[dist,i,j].

ExamplesExamplesopen allclose all

Basic Examples  (4)Basic Examples  (4)

Spearman's for two vectors:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Spearman's for a matrix:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Spearman's for two matrices:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]//MatrixForm=

Compute Spearman's for a bivariate distribution:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]//MatrixForm=

Compare to a simulated value:

In[3]:=
Click for copyable input
Out[3]//MatrixForm=
Introduced in 2012
(9.0)