MATLAB: Principle Component Analysis (PCA) bi-plot vector magnitude

pcaprinciple component analysisprojectionsvectors

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

Best Answer

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.
Related Question