15
$\begingroup$

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
$\endgroup$
4
$\begingroup$

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".

$\endgroup$
9
$\begingroup$

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:

http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1358533

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

$\endgroup$
1
$\begingroup$

I don't think you need have a N>P problem here. Your only problem with 1000 stocks and 250 daily returns would be trying to pull out >250 risk factors versus the classic 1-3 risk factors. If your PC1, PC2 and PC3 have non-zero correlation, then that suggests a problem with methodology and implementation more than with PCA.

[I've spent the last decade running a 65d=3m PCA on 50 markets globally, and seen many data weirdnesses. But no mermaids ;-) And never encountered a non-zero correlation problem in the first 5 PCs].

If you say just looked at PC1, then you're simply measuring the 1000 stocks' beta over the last year. That's perfectly kosher. Look at PC2; and you'll get some kind of tech-vs-commodities or foreign-vs-domestic FX-exposure metric (depending on your choice of sample). That too would be perfectly kosher, given your sample.

It's impossible to answer your follow-up question without knowing more. Are you PCA'ing correlations or covariances? I'm guessing the latter, which probably isn't a problem if your inputs are all stocks of roughly similar volatility profiles. So then if your stock loadings to each PC are the eigenvectors, your risk factor vol should be roughly proportional to the eigenvalues (but not perfectly so)?

In truth, it doesn't really matter: you have a choice to make. You can either have a volatile PC1 with diminishing volatility for each subsequent PC but with stable stock betas to these. Or you can normalise each PC, and then regress each stock against these for the price impact of each PC. Mathematically, there is no difference between the two. They just look presentationally very different, even if both end up with the same answers (for risk exposure).

The usual rule of thumb: which is more intuitive for the boss/client ;-)

$\endgroup$
  • $\begingroup$ How do you know that PC1 is the beta? How do you know that PC2 is FX or CMDTY? How do you go with validating it? Where can I read more about your approach? Thanks! $\endgroup$ – AK88 Nov 13 at 1:22
0
$\begingroup$

PCA is generally a good method when you have a large number of assets $N$ (and in that case, you will rarely have a correspondingly long look-back window $T$). While applying PCA to obtain an equity risk model, you may take note of several points (the first two probably provide the solution your problem):

1. Curse of dimensionality

The covariance/correlation estimates from $N$ time series of length $T<N$ have rank $T$. When you use $K=N$ principal components, the last $N-T$ eigenvalues will be zero and you cannot rely on on them since the eigenvectors associated with them are just noise. If you check, you will see that the eigenvalues associated with the correlated eigenvectors will be zero (or close to zero up to a numerical error).

2. Big data blessing

The number of principal components $K$ you want to keep is almost always much smaller than the number of assets $N$, unless you have very few relatively well-diversified assets (for example, see Lohre et al. 2014 and the decomposition in Table II). Usually, you will only use the $K$ eigenvectors which correspond to the $K$ highest eigenvalues (variances explained) of the covariance/correlation matrix. This will also solve your "curse of dimensionality" issue, since PCA is known to be a consistent estimator of the real underlying factors for large $N$ (known as the "big data blessing" - see Bai et al. 2017).

3. Sensitivity of PCA to individual variances

Finally, you should also check whether your method standardizes the data - principal components are sensitive to individual variances, especially if some assets have a much higher volatility than others. You may not have this issue now, but if you plan to use PCA as a basis for an equity risk model, check the individual asset volatilities and see whether a standardized version (i.e. eigendecomposition of the correlation rather than covariance matrix) might perform better.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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