

   cancor {mva}                                 R Documentation

   CCaannoonniiccaall CCoorrrreellaattiioonnss

   DDeessccrriippttiioonn::

        Compute the canonical correlations between two data
        matrices.

   UUssaaggee::

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

   AArrgguummeennttss::

          x: numeric matrix (n * p1), containing the x coordi-
             nates.

          y: numeric matrix (n * p2), containing the y coordi-
             nates.

    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 sub-
             tracted from the columns.

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

   DDeettaaiillss::

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

   VVaalluue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Reeffeerreennccees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Seeee AAllssoo::

        `qr', `svd'.

   EExxaammppllees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)

