hetcor                package:polycor                R Documentation

_H_e_t_e_r_o_g_e_n_e_o_u_s _C_o_r_r_e_l_a_t_i_o_n _M_a_t_r_i_x

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

     Computes a heterogenous correlation matrix, consisting of Pearson
     product-moment correlations between numeric variables, polyserial
     correlations between numeric  and ordinal variables, and
     polychoric correlations between ordinal variables.

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

     hetcor(data, ..., ML = FALSE, std.err = TRUE, bins=4)
     ## S3 method for class 'data.frame':
     hetcor(data, ML = FALSE, std.err = TRUE, 
       use = c("complete.obs", "pairwise.complete.obs"), bins=4, ...)
     ## Default S3 method:
     hetcor(data, ..., ML = FALSE, std.err = TRUE, bins=4)
     ## S3 method for class 'hetcor':
     print(x, digits = max(3, getOption("digits") - 3), ...)
     ## S3 method for class 'hetcor':
     as.matrix(x)

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

    data: a data frame consisting of factors and/or numeric variables,
          or the first of several variables.

     ...: variables and/or arguments to be passed down.

      ML: if 'TRUE', compute maximum-likelihood estimates; if 'FALSE',
          compute quick two-step estimates.

 std.err: if 'TRUE', compute standard errors.

    bins: number of bins to use for continuous variables in testing
          bivariate normality; the default is 4.

     use: if '"complete.obs"', remove observations with any missing
          data;  if '"pairwise.complete.obs"', compute each correlation
          using all observations with valid data for that pair of
          variables.

       x: an object of class '"hetcor"' to be printed, or from which to
          extract the correlation matrix.

  digits: number of significant digits.

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

     Returns an object of class '"hetcor"' with the following
     components: 

correlations: the correlation matrix.

    type: the type of each correlation: '"Pearson"', '"Polychoric"', or
          '"Polyserial"'.

std.errors: the standard errors of the correlations, if requested.

       n: the number (or numbers) of observations on which the
          correlations are based.

NA.method: the method by which any missing data were handled:
          '"complete.obs"'  or '"pairwise.complete.obs"'.

      ML: 'TRUE' for ML estimates, 'FALSE' for two-step estimates.

_N_o_t_e:

     Although the function reports standard errors for product-moment
     correlations, transformations (the most well known is Fisher's
     _z_-transformation) are available that make the approach to
     asymptotic normality much more rapid.

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

     John Fox jfox@mcmaster.ca

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

     Drasgow, F. (1986)  Polychoric and polyserial correlations.  Pp.
     68-74 in S. Kotz and N. Johnson, eds., _The Encyclopedia of
     Statistics, Volume 7._ Wiley.

     Olsson, U. (1979) Maximum likelihood estimation of the polychoric
     correlation coefficient. _Psychometrika_ *44*, 443-460.

     Rodriguez, R.N. (1982) Correlation. Pp. 193-204 in S. Kotz and N.
     Johnson, eds., _The Encyclopedia of Statistics, Volume 2._ Wiley.

     Ghosh, B.K. (1966) Asymptotic expansion for the moments of the
     distribution of correlation coefficient. _Biometrika_ *53*,
     258-262.

     Olkin, I., and Pratt, J.W. (1958) Unbiased estimation of certain
     correlation coefficients. _Annals of Mathematical Statistics_
     *29*, 201-211.

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

     'polychor', 'polyserial'

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

     R <- matrix(0, 4, 4)
     R[upper.tri(R)] <- runif(6)
     diag(R) <- 1
     R <- cov2cor(t(R) %*% R)
     round(R, 4)  # population correlations
     data <- rmvnorm(1000, rep(0, 4), R)
     round(cor(data), 4)   # sample correlations
     x1 <- data[,1]
     x2 <- data[,2]
     y1 <- cut(data[,3], c(-Inf, .75, Inf))
     y2 <- cut(data[,4], c(-Inf, -1, .5, 1.5, Inf))
     data <- data.frame(x1, x2, y1, y2)
     hetcor(data)  # Pearson, polychoric, and polyserial correlations, 2-step est.
     hetcor(x1, x2, y1, y2, ML=TRUE) # Pearson, polychoric, polyserial correlations, ML est.

