Finding the directions of greatest variance
Principal component analysis asks for the single direction in which a cloud of data varies the most, then the next direction at right angles to it, and so on. For returns of assets that cloud lives in dimensions and is hard to look at, but its principal directions rank the independent sources of risk. The recipe is short: centre every column, form the covariance matrix, take its eigenvectors, sort them by eigenvalue and project the data onto the leading ones.
Here is the matrix of centred returns, the columns of are the principal directions (loadings) and the columns of are the scores, the data in the new coordinates. The scores are uncorrelated and the variance of the -th is , so the eigenvalues split the total variance exactly. The signs of the directions are arbitrary: and are the same line. Two cautions apply. Centring matters, because without it the first direction partly points at the mean. Units matter too: PCA of a covariance matrix is dominated by the most volatile variables, so when variables are on different scales you standardise them first, which means working with the correlation matrix.
- Recipe: centre, covariance, eigendecompose, sort by eigenvalue, project onto the top directions.
- Scores: uncorrelated, with variance ; the explained share is .
- Cautions: signs are arbitrary; centre the data; standardise when units differ (correlation matrix).
For the daily returns of twelve large US stocks since 2010 (4,184 days), the first principal component of the correlation matrix explains about 40% of the variance and every stock loads on it with the same sign: it is the market. The second explains about 12% and splits the stocks into groups, technology against defensive names. The remaining ten share the other 48% and are much harder to tell apart from noise, which is the subject of the next lessons.
Lab · what's graded
7 tasks · 100 pts- The PCA recipe15 pts
- The first eigenvalue15 pts
- The explained share15 pts
- A score15 pts
- When to standardise15 pts
- Facts about scores10 pts
- Why centre the data15 pts