Skip to content

Canonical correlation analysis

Canonical correlation analysis finds the most correlated linear scores in two variable blocks. See whitening, the SVD solution, a checked example and estimation limits.

Canonical correlation analysis (CCA) finds linear combinations of two blocks of variables whose correlation is as large as possible. It produces paired scores, called canonical variates, and a correlation for each pair. A quant researcher can use it to ask which combination of macroeconomic surprises is most closely associated with which combination of sector returns, instead of inspecting every surprise–sector correlation separately.

The blocks must describe matched observations. In that fictional application, each row might contain surprises available at a release time and returns over the same specified window after that release. CCA summarises association; a strong fitted relationship alone establishes neither a causal mechanism nor a profitable forecasting rule.

Choose a score on each side

Let X∈RpX\in\mathbb{R}^p and Y∈RqY\in\mathbb{R}^q be centred random vectors with finite second moments. Write their covariance matrices as ΣXX\Sigma_{XX} and ΣYY\Sigma_{YY}, and the cross-covariance matrix as ΣXY=Cov(X,Y)\Sigma_{XY}=\text{Cov}(X,Y). Assume the two within-block matrices are positive definite for the inverse-based construction below.

For weights aa and bb, the scores are U=a⊤XU=a^\top X and V=b⊤YV=b^\top Y. Their correlation is
Corr(U,V)=a⊤ΣXYba⊤ΣXXab⊤ΣYYb.\text{Corr}(U,V)= \frac{a^\top\Sigma_{XY}b} {\sqrt{a^\top\Sigma_{XX}a}\sqrt{b^\top\Sigma_{YY}b}}.

Multiplying a score by a positive constant does not change correlation. To fix that arbitrary scale, CCA imposes unit variances:

ρ1=max⁡a,ba⊤ΣXYb,a⊤ΣXXa=1,b⊤ΣYYb=1.\rho_1=\max_{a,b}a^\top\Sigma_{XY}b, \qquad a^\top\Sigma_{XX}a=1,\quad b^\top\Sigma_{YY}b=1.
These constraints normalise the scores, not the Euclidean lengths of their weight vectors. The signs can be chosen so that ρ1≥0\rho_1\ge0. Reversing both score signs preserves the pair's correlation. Hotelling's original formulation and Penn State's CCA notes develop this paired optimisation.

Whitening makes the problem an SVD

Whitening transforms each centred block to have identity covariance:

X~=ΣXX−1/2X,Y~=ΣYY−1/2Y.\widetilde X=\Sigma_{XX}^{-1/2}X, \qquad \widetilde Y=\Sigma_{YY}^{-1/2}Y.

Here the inverse square roots are symmetric. Whitening removes within-block correlations as well as rescaling variances; dividing every column by its own standard deviation is sufficient only when its block is already uncorrelated.

Take the singular value decomposition of the whitened cross-covariance:

K=ΣXX−1/2ΣXYΣYY−1/2=PDQ⊤.K=\Sigma_{XX}^{-1/2}\Sigma_{XY}\Sigma_{YY}^{-1/2} =P D Q^\top.

The diagonal entries of DD, ordered largest first, are the canonical correlations 1≥ρ1≥⋯≥ρm≥01\ge\rho_1\ge\cdots\ge\rho_m\ge0, with m=min⁡(p,q)m=\min(p,q). If pip_i and qiq_i are the corresponding left and right singular vectors, the weights in the original coordinates are

ai=ΣXX−1/2pi,bi=ΣYY−1/2qi.a_i=\Sigma_{XX}^{-1/2}p_i, \qquad b_i=\Sigma_{YY}^{-1/2}q_i.
Successive pairs use new directions that are uncorrelated with earlier scores within each block. In this canonical basis, cross-pair covariances also vanish:
Cov(Ui,Uj)=Cov(Vi,Vj)=0,Cov(Ui,Vj)=0(i≠j).\text{Cov}(U_i,U_j)=\text{Cov}(V_i,V_j)=0, \qquad \text{Cov}(U_i,V_j)=0\quad(i\ne j).
The orthogonality is in the covariance geometry: ai⊤ΣXXaj=0a_i^\top\Sigma_{XX}a_j=0, rather than necessarily ai⊤aj=0a_i^\top a_j=0. Uncorrelated scores need not be independent. Equal canonical correlations also leave freedom to rotate the associated directions, so individual weights need not be unique. See Uurtio and colleagues' SVD treatment.

Two macro scores, two return scores

Consider an exact fictional population, with centred macro-surprise variables X1,X2X_1,X_2 and centred sector-return scores Y1,Y2Y_1,Y_2. These are illustrative numerical units, not empirical estimates or annualised returns. Suppose
ΣXX=(4001),ΣYY=(1001),ΣXY=(1.2000.4).\Sigma_{XX}=\begin{pmatrix}4&0\\0&1\end{pmatrix}, \qquad \Sigma_{YY}=\begin{pmatrix}1&0\\0&1\end{pmatrix}, \qquad \Sigma_{XY}=\begin{pmatrix}1.2&0\\0&0.4\end{pmatrix}.

The first macro variable has standard deviation 22. Whitening divides it by 22, while leaving the other variables unchanged:

K=(1/2001)(1.2000.4)=(0.6000.4).K=\begin{pmatrix}1/2&0\\0&1\end{pmatrix} \begin{pmatrix}1.2&0\\0&0.4\end{pmatrix} =\begin{pmatrix}0.6&0\\0&0.4\end{pmatrix}.

Thus the canonical pairs are

PairMacro scoreReturn scoreCanonical correlation
FirstU1=X1/2U_1=X_1/2V1=Y1V_1=Y_10.60.6
SecondU2=X2U_2=X_2V2=Y2V_2=Y_20.40.4

For the first pair, Var(X1/2)=4/4=1\text{Var}(X_1/2)=4/4=1 and Cov(X1/2,Y1)=1.2/2=0.6\text{Cov}(X_1/2,Y_1)=1.2/2=0.6. A covariance of 1.21.2 is therefore entirely consistent with a correlation below one. In this deliberately diagonal example, the best combinations select single coordinates; generally they mix several variables.

In an exact fictional population, X1 has standard deviation 2 and X2 has standard deviation 1. Whitening gives U1=X1/2 and U2=X2, both with variance 1. Their matched Y scores have correlations 0.6 and 0.4; all cross-pair covariances are zero.
In an exact fictional population, X1 has standard deviation 2 and X2 has standard deviation 1. Whitening gives U1=X1/2 and U2=X2, both with variance 1. Their matched Y scores have correlations 0.6 and 0.4; all cross-pair covariances are zero.
Exact fictional population. Whitening converts the first cross-covariance from 1.2 to a unit-free correlation of 0.6; both canonical pairs have unit-variance scores.
The square 0.62=0.360.6^2=0.36 is the population R2R^2 from regressing this one canonical score on its paired score with an intercept. It does not mean that 36% of the variance of the entire two-variable return block is explained. CCA can find a strongly associated direction without that direction carrying much of a block's total variance.

CCA, PCA and regression answer different questions

MethodWhat is chosen?Objective
Principal component analysis (PCA)Directions in one blockCapture that block's variance, under a specified scaling
CCAOne direction in each of two blocksMaximise correlation between their scores
Linear regressionCoefficients mapping predictors to a specified responseMinimise prediction error under the chosen loss

CCA is symmetric between its blocks. Regression assigns predictor and response roles. A high-variance PCA direction can be irrelevant to the other block, while a low-variance direction can matter greatly to CCA after whitening. When one block contains only a single nonconstant response, classical CCA's first correlation equals the multiple correlation from ordinary least squares with an intercept; its square is that regression's R2R^2.

A fitted maximum is an optimistic starting point

Sample CCA replaces population covariances with estimates. Searching over many directions creates overfitting: a large training correlation can reflect fitted noise. Collinear inputs make weights unstable, and centred sample covariance matrices have rank at most n−1n-1. They are necessarily singular if a block has at least nn columns. The ordinary inverse square root then does not exist.
Removing redundant directions or using regularisation can make estimation feasible. These choices alter the fitted problem; a pseudoinverse or ridge penalty does not establish that an apparent relationship generalises. Tuzhilina, Tozzi and Hastie describe the singular-covariance problem, regularised CCA and validation of fixed fitted weights.
For the fictional macro study, fit centring, scaling, dimension reduction and CCA weights on training dates only. Apply those fixed transformations to later held-out dates. Tune any penalty inside the training process, then evaluate on untouched data. Using future releases or fitting preprocessing on the full history introduces look-ahead bias; overlapping return windows also require care when separating observations. Report held-out score correlations and weight stability alongside the training maximum.
If the covariance foundations are unfamiliar, Expectation, Variance and Covariance is available in full with a free signed-in account. For the matrix construction, the Singular Value Decomposition lesson has a public preview; its full teaching requires membership.

Practice: which pair is strongest?

In another exact centred population, let ΣXX=diag⁡(9,1)\Sigma_{XX}=\operatorname{diag}(9,1), ΣYY=I\Sigma_{YY}=I and ΣXY=diag⁡(1.5,0.7)\Sigma_{XY}=\operatorname{diag}(1.5,0.7). Does the first canonical pair select the first coordinates because 1.5>0.71.5>0.7?

Answer. No. The X standard deviations are 33 and 11, so the whitened cross-covariance is diag⁡(0.5,0.7)\operatorname{diag}(0.5,0.7). Its ordered singular values are 0.70.7 and 0.50.5. The first pair is U1=X2U_1=X_2, V1=Y2V_1=Y_2; the second is U2=X1/3U_2=X_1/3, V2=Y1V_2=Y_1. Ranking raw covariances ignores the variance constraints.

Sources

The population examples, financial scenario, figure and practice question are original illustrations.

Last updated
  • canonical correlation
  • multivariate statistics
  • whitening
  • singular value decomposition
  • two block analysis
← Back to the glossaryBack to top ↑