Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

I would appreciate if someone could correct me if i am wrong in my suggestion.

I am using PCA to :

  • find measure of cointegration between selected assets
  • find the eigenvector and its portfolio with a market-neutral position (min variance)

Unfortunately i am not sure whether i am doing it the right way. Here is my algorithm :

  • getting the base matrix N x M : N - number of assets, M - number of history samples
  • getting simple covariance matrix : Cov = E[(X - E[X])(Y - E[Y])]
  • solving eigenproblem using Jacobi's Rotation method : [example][1]
  • finding the index of the biggest eigenvalue by module : MinVariance = Min(Abs(eigenvalue))
  • eigenvector can be found as a column in the rotation matrix by index of eigenvalue

The question is : did i miss something in this list of actions according to my initial purposes mentioned above?

I am asking because i already calculated these weights for selected currencies but they look odd to me because e.g. EURUSD and GBPUSD seem to be opposite to each other when everyone knows that they are highly correlated and moves together most of the time


Here is my implementation of PCA on a C++ similar language called MQL

http://www.mql5.com/ru/forum/16512/page3#comment_732844 (see attachment)

share|improve this question
You ask too much in one question. To answer a part: no: minimal variance is not related to the largest eigenvalue but rather too the smallest. And: inverting a matrix is not an estimator - what do you mean? Please rephrase the question. It starts with PCA and then goes to shrinkage. There is too much going on in this question –  Richard Jan 22 at 8:12
Simplified my question - it is only about correctness of PCA algorithm now –  Art Jan 22 at 10:55
And what about this answer - i presume it says that minimum eigenvalue points to minimum variance, i mean this quotation : "As a side note, you could form a eigenportfolio that has minimum variance by identifying a principal component with a low eigenvalue" –  Art Jan 22 at 11:04
@Richard: in addition i found this answer saying that biggest eigenvalue adds the most variance to the portfolio so i presume that opposite suggestion about min variance is also true - quant.stackexchange.com/questions/4607/… –  Art Jan 22 at 13:25
Yes .. as far as I rememeber you had something like "largest eigenvalue" and "small variance". If you know that large eigenvalue measn large variance and vice-versa then it is fine. –  Richard Jan 22 at 14:32

Your Answer


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

Browse other questions tagged or ask your own question.