rcorr                 package:Hmisc                 R Documentation

_M_a_t_r_i_x _o_f _C_o_r_r_e_l_a_t_i_o_n_s _a_n_d _P-_v_a_l_u_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'rcorr' Computes a matrix of Pearson's 'r' or Spearman's 'rho'
     rank correlation coefficients for all possible pairs of columns of
     a matrix.  Missing values are deleted in pairs rather than
     deleting all rows of 'x' having any missing variables.  Ranks are
     computed using efficient algorithms (see reference 2), using
     midranks for ties.

_U_s_a_g_e:

     rcorr(x, y, type=c("pearson","spearman"))

     ## S3 method for class 'rcorr':
     print(x, ...)

_A_r_g_u_m_e_n_t_s:

       x: a numeric matrix with at least 5 rows and at least 2 columns
          (if 'y' is absent).  For 'print', 'x' is an object produced
          by 'rcorr'. 

       y: a numeric vector or matrix which will be concatenated to 'x'.
           If 'y' is omitted for 'rcorr', 'x' must be a matrix. 

    type: specifies the type of correlations to compute.  Spearman
          correlations are the Pearson linear correlations computed on
          the ranks of non-missing elements, using midranks for ties. 

     ...: argument for method compatiblity.

_D_e_t_a_i_l_s:

     Uses midranks in case of ties, as described by Hollander and
     Wolfe. P-values are approximated by using the 't' or 'F'
     distributions.

_V_a_l_u_e:

     'rcorr' returns a list with elements 'r', the matrix of
     correlations, 'n' the matrix of number of observations used in
     analyzing each pair of variables, and 'P', the asymptotic
     P-values. Pairs with fewer than 2 non-missing values have the r
     values set to NA. The diagonals of 'n' are the number of non-NAs
     for the single variable corresponding to that row and column.

_A_u_t_h_o_r(_s):

     Frank Harrell 
      Department of Biostatistics 
      Vanderbilt University 
      f.harrell@vanderbilt.edu

_R_e_f_e_r_e_n_c_e_s:

     Hollander M. and Wolfe D.A. (1973).  Nonparametric Statistical
     Methods. New York: Wiley.

     Press WH, Flannery BP, Teukolsky SA, Vetterling, WT (1988):
     Numerical Recipes in C.  Cambridge: Cambridge University Press.

_S_e_e _A_l_s_o:

     'hoeffd', 'cor', 'combine.levels', 'varclus', 'dotchart2',
     'impute', 'chisq.test', 'cut2'.

_E_x_a_m_p_l_e_s:

     x <- c(-2, -1, 0, 1, 2)
     y <- c(4,   1, 0, 1, 4)
     z <- c(1,   2, 3, 4, NA)
     v <- c(1,   2, 3, 4, 5)
     rcorr(cbind(x,y,z,v))

