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 ^(th) Spearman rank correlation for the multivariate symbolic distribution dist.

DetailsDetails

  • 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], r_(i) 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^(th) and j^(th) marginals of dist, respectively, and disti,j 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[3]:=
Click for copyable input
Out[3]=

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)