cancor | R Documentation |
Compute the canonical correlations between two data matrices.
cancor(x, y, xcenter = TRUE, ycenter = TRUE)
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 |
ycenter |
analogous to |
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.
A list containing the following components:
cor |
correlations. |
xcoef |
estimated coefficients for the |
ycoef |
estimated coefficients for the |
xcenter |
the values used to adjust the |
ycenter |
the values used to adjust the |
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988). The New S Language. Wadsworth & Brooks/Cole.
Hotelling H. (1936). Relations between two sets of variables. Biometrika, 28, 321–327. \Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("10.1093/biomet/28.3-4.321")}.
Seber, G. A. F. (1984). Multivariate Observations. New York: Wiley. Page 506f.
qr
, svd
.
## signs of results are random pop <- LifeCycleSavings[, 2:3] oec <- LifeCycleSavings[, -(2:3)] cancor(pop, oec) x <- matrix(rnorm(150), 50, 3) y <- matrix(rnorm(250), 50, 5) (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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.