A command that creates a canonical correlation object from the selected SSCP object.


Dimension of dependent variate (ny)
defines a partition of the square n x n SSCP matrix S into the parts Syy of dimension ny x ny, Sxx of dimension nx x nx, and the parts Sxy and Syx of dimensions nx x ny and ny x nx, respectively.


The partition for the square SSCP-matrix is as follows:

The canonical correlation equations we have to solve are:

(1) (Syx Sxx-1 Syx′ -λ Syy)y = 0
(2) (SyxSyy-1 SyxSxx)x = 0

where Syy [ny × ny] and Sxx [nx × nx] are symmetric, positive definite matrices belonging to the dependent and the independent variables, respectively.

These two equations are not independent and we will show that both equations have the same eigenvalues and that the eigenvectors x for equation (2) can be obtained from the eigenvectors y of equation (1).

We can solve equation (1) in several ways, however, the numerically stablest algorithm is probably by performing first a Cholesky decomposition of Sxx and Syy, followed by a generalized singular value decomposition. The algorithm goes as follows:

The Cholesky decompositions ("square roots") of Syy and Sxx are:

Syy = UU and Sxx = HH,

where U and H are upper triangular matrices. From these decompositions, the inverse for Sxx-1 is easily computed. Let K be the inverse of H, then we can write:

Sxx-1 = K K′.

We next substitute in equation (1) and rewrite as:

((KSyx′)′ (KSyx′) - λ UU)x = 0

This equation can be solved for eigenvalues and eigenvectors by the generalized singular value decomposition because it is of the form AABB.

Now, given the solution for equation (1) we can find the solution for equation (2) by first multiplying (1) from the left with SyxSyy-1, resulting in:

(SyxSyy-1SyxSxx-1Syx′ -λ Syx′) y = 0

Now we split of the term Sxx-1Syx′ and obtain:

(SyxSyy-1Syx - λ Sxx) Sxx-1Syxy = 0

This equation is like equation (2) and it has therefore the same eigenvalues and eigenvectors. (We also proved this fact in the algorithmic section of TableOfReal: To CCA....)

The eigenvectors x is now

x = Sxx-1Syxy.

© djmw, November 3, 2003