Principle Component Analysis (PCA) bi-plot vector magnitude

1 view (last 30 days)
Hi,
I am trying to project data from five dimensions onto two dimensions in order to help with visualization. I am able to successfully create a 2D PCA plot using the pca command. Moreover, I am able to capture a good chunk of the variance (~90%) with two components.
However, I noticed that the coefficient matrix generated when using the pca function (or princomp) yields a matrix of coefficients (p by n where p is the number of variables and n is the number of principle components of interest) with values that are all between -1 and 1.
With this in mind, I was wondering how best to graphically project each variable [vector in higher dimension] onto the 2D PCA space? or is this simply what a bi-plot of PCA coefficients does? If so, how do I obtain PCA coefficients which are not restricted to between -1 and 1 (i.e. not scaled, but show their true magnitudes).
JTC

Accepted Answer

Ahmet Cecen
Ahmet Cecen on 8 Aug 2014
Edited: Ahmet Cecen on 8 Aug 2014
I am not sure how princomp works, but here is a quick way to do this.
1) mean center your data, meaning subtract the mean across all data points across each dimension from each dimension.
2) [U,S,V]=svd(Data,0);
3) Assuming your dimensions are across columns (meaning your data point are row vectors), PCA weights are U*S, your variance vector is diag(S^2), your PCA vectors are S*V'.
Your results wont be normalized in any way, but they will be centered, and that is desirable in most cases.
  2 Comments
James
James on 8 Aug 2014
Edited: James on 8 Aug 2014
Thanks! I've accepted your answer. After reviewing the algebra, it occurred to me that the PCA vectors should actually be V*S'. Let me know if you agree or disagree.
Ahmet Cecen
Ahmet Cecen on 8 Aug 2014
Nope, actually it is just V'. S is a diagonal scaling matrix and redundant in finding the PCA vectors, my bad. Check this for a some of the easier explanations I have seen. Go down to the "relation to principal component analysis" section.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!