Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build a simple risk model for stocks using PCA. I've noticed that when my dimensions are larger than the number of observations (for example 1000 stocks but only 250 days of returns), then the resulting transformed return series (returns rotated by eigenvectors or factor returns) have non-zero correlation.

Intuitively, I can see why this might be, since in the pca process I am estimating a 1000x1000 covariance matrix from 250x1000 observations. So it is like an underdetermined system. But I'm not exactly sure what's going on. Can someone explain what is happening?

Also, for risk model purposes, is it better to assume a diagonal covariance matrix or use the sample covariance of the factors?

Here is some matlab code to demonstrate the problem:

% More observation than dimensions
Nstock = 10;
Nobs = 11;
obs = randn(Nobs, Nstock);
rot = princomp(obs);
rotobs = obs * rot;
corr(rotobs) % off diagonals are all zero

% More dimensions that observations
Nstock = 10;
Nobs = 9;
obs = randn(Nobs, Nstock);
rot = princomp(obs);
rotobs = obs * rot;
corr(rotobs) % some off diagonals are non-zero
share|improve this question
up vote 3 down vote accepted

Regarding the second part of your question - You are running into the classic N>T problem (N=# assets; T=# of observations). Therefore the number of parameters you must estimate grows geometrically with each N, but only arithmetically for each day of observation. Because you are estimating the diagonal portion of the covariance matrix you must estimate N*(N+1)/2 entries with only T observations.

A better approach would involve a shrinkage estimator where you assume constant correlation or constant covariance across securities. The out-of-sample performance of this approach is strong. Consider blending a covariance matrix between the diagonal and sample covariance matrix - See Ledoit and Wolf's paper: "Honey I shrunk the covariance matrix".

share|improve this answer

About a year ago I saw a presentation by Attilio Meucci in London. The twist of his work is a little bit different compared to yours but the general approach is similar and there is lot to be learned from his accompanying paper:


Here he is also using PCA for dimensionality reduction constructing what he calls principal portfolios. He also shares fully documented code in MATLAB.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.