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
http://c.mql5cdn.com/3/28/USDCHFM1.png
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)