g02bqf

g02bqf © Numerical Algorithms Group, 2002.

Purpose

G02BQF Kendall/Spearman non-parametric rank correlation coefficients, no missing values, preserving input data

Synopsis

[rr,ifail] = g02bqf(x,itype<,ifail>)

Description

 
 The input data consists of n observations for each of m 
 variables, given as an array
 
     [x  ],   i=1,2,...,n (n>=2)
       ij     
              j=1,2,...,m (m>=2)
 
 where x   is the ith observation on the jth variable.
        ij                                   
 
 The observations are first ranked, as follows:
 
 For a given variable, j say, each of the n observations, 
 x  ,x  ,...,x  , has associated with it an additional number, the
  1j  2j      nj                                               
 'rank' of the observation, which indicates the magnitude of that 
 observation relative to the magnitude of the other n-1 
 observations on that same variable.
 
 The smallest observation for variable j is assigned the rank 1, 
 the second smallest observation for variable j the rank 2, the 
 third smallest the rank 3, and so on until the largest 
 observation for variable j is given the rank n.
 
 If a number of cases all have the same value for the given 
 variable, j, then they are each given an 'average' rank -- e.g. 
 if in attempting to assign the rank h+1, k observations were 
 found to have the same value, then instead of giving them the 
 ranks
 
                         h+1,h+2,...,h+k,
 
 all k observations would be assigned the rank
 
                               2h+k+1
                               ------
                                 2
 
 and the next value in ascending order would be assigned the rank
 
                              h+k+1.
 
 The process is repeated for each of the m variables.
 
 Let y   be the rank assigned to the observation x   when the jth 
      ij                                          ij             
 variable is being ranked.
 
 The quantities calculated are:
 
 (a) Kendall's tau rank correlation coefficients:
                      n   n                            
                      --  --                           
                      >   >  sign(y  -y  )sign(y  -y  )
                      --  --       hj  ij       hk  ik 
                      h=1 i=1                          
                R  = ----------------------------------,
                 jk         ______________________     
                           /[n(n-1)-T ][n(n-1)-T ]     
                         \/          j          k      
       j,k=1,2,...,m;
       where  signu=1 if u>0
       
              signu=0 if u=0
       
              signu=-1 if u<0
               --                                          
       and T = > t (t -1), t  being the number of ties of a 
            j  -- j  j      j                              
       particular value of variable j, and the summation being 
       over all tied values of variable j.
 
 (b) Spearman's rank correlation coefficients:
                                n                     
                         2      --          2  1  *  *
                      n(n -1)-6 >  (y  -y  ) - -(T +T )
                                --   ij  ik    2  j  k
                  *             i=1                   
                 R  = ---------------------------------
                  jk        ________________________
                           /    2     *     2     *
                          / [n(n -1)-T ][n(n -1)-T ]
                        \/            j           k
 
                             *  --    2                          
       j,k=1,2,...,m; where T = > t (t -1) where t  is the number 
                             j  -- j  j           j              
       of ties of a particular value of variable j, and the 
       summation is over all tied values of variable j.
 

Parameters

g02bqf

Required Input Arguments:

x (:,:)                               real
itype                                 integer

Optional Input Arguments:                       <Default>

ifail                                 integer  -1

Output Arguments:

rr (:,:)                              real
ifail                                 integer