# cancor

0th

Percentile

##### Canonical Correlations

Compute the canonical correlations between two data matrices.

Keywords
multivariate
##### Usage
cancor(x, y, xcenter = TRUE, ycenter = TRUE)
##### Arguments
x

numeric matrix ($$n \times p_1$$), containing the x coordinates.

y

numeric matrix ($$n \times p_2$$), containing the y coordinates.

xcenter

logical or numeric vector of length $$p_1$$, 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.

##### Details

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.

##### Value

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.

##### References

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. 10.1093/biomet/28.3-4.321.

Seber, G. A. F. (1984). Multivariate Observations. New York: Wiley. Page506f.

qr, svd.
library(stats) # NOT RUN { ## 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) # }
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5738503336906433, "perplexity": 9907.348458621611}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-50/segments/1606141182794.28/warc/CC-MAIN-20201125125427-20201125155427-00484.warc.gz"}