Page 90 - Applied Statistics Using SPSS, STATISTICA, MATLAB and R
P. 90

2.3 Summarising the Data   69


              STATISTICA and SPSS afford the possibility of computing partial correlations
           as indicated in Commands 2.9. For the previous example, the partial correlation of
           PRTG and ARTG, given PRT and ART, is 0.79. We see, therefore, that PRT and
           ART can “explain” about 20% of the high correlation (0.99) of those two variables.
              Another measure  of association for continuous  variables is the  multiple
           correlation coefficient, which measures the degree of association of one variable Y
           in relation to a set of variables, X 1, X 2, …, X  n, that linearly “predict” Y. Details on
           multiple correlation will be postponed to Chapter 7.

           Commands 2.9. SPSS, STATISTICA, MATLAB and R commands used to obtain
           measures of association for continuous variables.

             SPSS          Analyze; Correlate; Bivariate | Partial
                           Statistics; Basic Statistics/Tables;
             STATISTICA  Correlation matrices (Quick |Advanced;
                           Partial Correlations)
             MATLAB        corrcoef(x) ; cov(x)

             R             cor(x,y)   ;  cov(x,y)

           Partial  correlations  are  computed  in MATLAB and R as part of the regression
           functions (see Chapter 7).


           2.3.5 Measures of Association for Ordinal Variables


           2.3.5.1  The Spearman Rank Correlation

           When dealing with ordinal data the correlation coefficient, previously described,
           can be computed in a simplified way. Consider the ordinal variables X and Y with
           ranks between 1 and N. It seems natural to measure the lack of agreement between
           X and Y by means of the difference of the ranks d i = x i − y i for each data pair (x i, y i).
           Using these differences we can express 2.18 as:
                 ∑  n  x 2  + ∑  n  y  2  − ∑ n  d  2
                            = i 1
              r  =  =  i   i 1  i   = i 1  i  .                            2.20
                     2  ∑  n =  x i 2 ∑  n i 1  y i 2
                                = i 1
              Assuming the values of x i and y i are ranked from 1 through N and that there are
           no tied ranks in any variable, we have:

                n
              ∑ i= 1 i ∑ n i= 1 y = (N −  N  / )  12 .
                            2
                                 3
                   2
                  x =
                           i
              Applying this result to 2.20, the following Spearman’s rank correlation (also
           known as rank correlation coefficient) is derived:
   85   86   87   88   89   90   91   92   93   94   95