Example of Canonical Correlation Analysis
Given:
[Tex]X = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] [/Tex]
[Tex]Y = [[-1, -2], [-3, -4], [-5, -6], [-7, -8]][/Tex]
Step 1: Mean Centering Calculate the mean of each variable in X and Y, and subtract the means from the respective variables to center the data:
[Tex]X’ = X – mean(X) Y’ = Y – mean(Y)[/Tex]
[Tex]X’ = [[-4.5, -4.5, -4.5], [-1.5, -1.5, -1.5], [1.5, 1.5, 1.5], [4.5, 4.5, 4.5]][/Tex]
[Tex]Y’ = [[3.5, 3.5], [1.5, 1.5], [-0.5, -0.5], [-2.5, -2.5]] [/Tex]
Step 2: Covariance Matrix Calculate the covariance matrix between X’ and Y’:
[Tex]Cov(X’, Y’) = (X’Y’) / (n – 1) [/Tex]
[Tex]Cov(X’, Y’) = [[ 12.66666667, 12.66666667], [ 5.66666667, 5.66666667], [ -0.66666667, -0.66666667], [-6.66666667, -6.66666667]] [/Tex]
Step 3: Singular Value Decomposition (SVD) Perform SVD on the covariance matrix to obtain the matrices U, S, and V:
[Tex]U, S, V = svd(Cov(X’, Y’))[/Tex]
Step 4: Canonical Correlation Coefficients The canonical correlation coefficients (ρ) are the square roots of the eigenvalues of the product of the covariance matrix and its transpose:
[Tex]ρ = sqrt(eigenvalues(Cov(X’, Y’) * Cov(X’, Y’)’))[/Tex]
What is Canonical Correlation Analysis?
Canonical Correlation Analysis (CCA) is an advanced statistical technique used to probe the relationships between two sets of multivariate variables on the same subjects. It is particularly applicable in circumstances where multiple regression would be appropriate, but there are multiple intercorrelated outcome variables. CCA identifies and quantifies the associations among these two variable groups. It computes a set of canonical variates, which are orthogonal linear combinations of the variables within each group, that optimally explain the variability both within and between the groups.