cancor                  package:mva                  R Documentation

_C_a_n_o_n_i_c_a_l _C_o_r_r_e_l_a_t_i_o_n_s

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

     Compute the canonical correlations between two data matrices.

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

     cancor(x, y, xcenter = TRUE, ycenter = TRUE)

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

       x: numeric matrix (n * p1), containing the x coordinates.

       y: numeric matrix (n * p2), containing the y coordinates.

 xcenter: logical or numeric vector of length p1, describing any
          centering to be done on the x values before the analysis.  If
          `TRUE' (default), subtract the column means. If `FALSE', do
          not adjust the columns.  Otherwise, a vector of values to be
          subtracted from the columns.

 ycenter: analogous to `xcenter', but for the y values.

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

     The canonical correlation analysis seeks linear combinations of
     the `y' variables which are well explained by linear combinations
     of the `x' variables. The relationship is symmetric as `well
     explained' is measured by correlations.

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

     A list containing the following components: 

     cor: correlations.

   xcoef: estimated coefficients for the `x' variables.

   ycoef: estimated coefficients for the `y' variables.

 xcenter: the values used to adjust the `x' variables.

 ycenter: the values used to adjust the `x' variables.

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

     Hotelling H. (1936). Relations between two sets of variables.
     Biometrika, 28, 321-327.

     Seber, G. A. F. (1984). Multivariate Analysis. New York: Wiley, p.
     506f.

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

     `qr', `svd'.

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

     data(LifeCycleSavings)
     pop <- LifeCycleSavings[, 2:3]
     oec <- LifeCycleSavings[, -(2:3)]
     str(cancor(pop, oec))

     x <- matrix(rnorm(150), 50, 3)
     y <- matrix(rnorm(250), 50, 5)
     str(cxy <- cancor(x, y))
     all(abs(cor(x %*% cxy$xcoef,
                 y %*% cxy$ycoef)[,1:3] - diag(cxy $ cor)) < 1e-15)
     all(abs(cor(x %*% cxy$xcoef) - diag(3)) < 1e-15)
     all(abs(cor(y %*% cxy$ycoef) - diag(5)) < 1e-15)

