Skip to content

Test statistic for Spearman correlation

6 messages · Brett Magill, Thomas W Blackwell, Peter Dalgaard +3 more

#
In the ouput below, what is the "S" statistic (S = 96) that is used for Spearman?  I don't have easy access to the books cited on the help page.  Other texts and web sources that I have found use t or z as a test for Spearman, perhaps inappropriately.  Can anyone tell me how S is computed or refer to a web resource?

I see from the code for that: 

  q <- as.integer((n^3 - n) * (1 - ESTIMATE)/6)
  STATISTIC <- c(S = q)  

I couldn't decipher the next part.  Would appreciate some help.

R 1.7.0 Windows 98.
_________________________________________
        Spearman's rank correlation rho

data:  x and y 
S = 96, p-value = 0.2324
alternative hypothesis: true rho is not equal to 0 
sample estimates:
      rho 
0.4181818
#
Brett  -

I can give you a further reference, but you may not
find it much help !

E. G. Olds.  Distribution of sums of squares of rank
differences for small numbers of individuals.  Annals
of Mathematical Statistics, v.9, pp. 133-148, 1938.

My source says that "Olds (1938) tabulated the exact
distribution of a quantity S related to rho by the
equation

    R = 1 - 6 * S / (n^3 - n) ."

Olds must have been using a Comptometer or a Marchant
calculator, so presumably, this construct guarantees
always to be an integer.  Algorithm AS 89 is certainly
available on line from Statlib.

HTH  -  tom blackwell  -  u michigan medical school  -  ann arbor  -
On Thu, 1 May 2003, Brett Magill wrote:

            
#
Thomas W Blackwell <tblackw at umich.edu> writes:
The title of Olds paper might have given you a hint:
[1] -0.2242424
[1] 202
[1] 202

BTW, the identity breaks down when there are ties, something that we
probably ought to look into at some point. The code does say that the
p values may be incorrect, but I suspect they may be more incorrect
than need be.
#
PD> Thomas W Blackwell <tblackw at umich.edu> writes:
    >> Brett -
    >> 
    >> I can give you a further reference, but you may not find
    >> it much help !
    >> 
    >> E. G. Olds.  Distribution of sums of squares of rank
    >> differences for small numbers of individuals.  Annals of
    >> Mathematical Statistics, v.9, pp. 133-148, 1938.
    >> 
    >> My source says that "Olds (1938) tabulated the exact
    >> distribution of a quantity S related to rho by the
    >> equation
    >> 
    >> R = 1 - 6 * S / (n^3 - n) ."
    >> 
    >> Olds must have been using a Comptometer or a Marchant
    >> calculator, so presumably, this construct guarantees
    >> always to be an integer.  Algorithm AS 89 is certainly
    >> available on line from Statlib.

    PD> The title of Olds paper might have given you a hint:

    >> x <- rank(rnorm(10)) y <- rank(rnorm(10)) cor(x,y)
    PD> [1] -0.2242424
    >> 990/6*(1-cor(x,y))
    PD> [1] 202
    >> sum((x-y)^2)
    PD> [1] 202

    PD> BTW, the identity breaks down when there are ties,
    PD> something that we probably ought to look into at some
    PD> point. The code does say that the p values may be
    PD> incorrect, but I suspect they may be more incorrect than
    PD> need be.

Yes, I'm quite sure of this (both/all statements).

Note that I still have uncommitted fixes to the problem large n.
For the "proper" fix, I did get interested, and during the last weeks have spent quite
some time reading several of the original papers on these.
I also found that there now are much better (i.e. faster)
methods available for exact calculation of P-values.

Currently I plan for 1.7.1 to have an improvement here, and for
1.8.0 to have more.

Martin
2 days later
#
Good morning R-masters,      
      
I would like to ask help to you for the a problem. 
I need to keep in a variable several matrix generated by my routine.
It?s  possible?
How to I make this?


Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil
#
Bernardo Rangel Tura wrote:
Use a list (of matrices), see ?list and the manuals for how to work with 
lists.

If all the matrices have the same dimensions, you might want to use an 
array instead, see ?array and the manuals for details.

Uwe Ligges