Description Usage Arguments Value Examples
Canonical correlation analysis (CCA) finds pairs of vectors (w,v) such that projections Xw and Yv have maximal possible correlations. The pairs are ordered in decreasing order of the correlations. In addition, projection vectors are normalized such that the variance of Xw and of Yv is equal to 1. This means that projections are not only correlated, but "on the same scale" and hence can be directly compared.
1 | canonical_correlation_analysis(x, y, epsilon = 1e-04)
|
x |
Matrix of size n-by-p with n observations from p variables. Alternatively, data frames and numeric vectors are supported and automatically converted. |
y |
Matrix of size n-by-p with n observations from p variables. Alternatively, data frames and numeric vectors are supported and automatically converted. |
epsilon |
Numeric value usued as tolerance threshold for rank reduction of the
input matrices. Default is |
A list containing the following components
xcoefEstimated estimated coefficients for the x
variable.
ycoefEstimated estimated coefficients for the y
variable.
corMatrix with correlation coefficients.
1 2 3 4 5 6 7 8 9 10 11 | library(MASS)
library(pracma)
X <- mvrnorm(1000, mu = c(0, 0), Sigma = eye(2))
cca <- canonical_correlation_analysis(X, X)
cca
X <- mvrnorm(1000, mu = c(1, 2),
Sigma = matrix(c(1.5, 0.5, 0.5, 1.5), ncol = 2))
cca <- canonical_correlation_analysis(X, X)
cca
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.