Principle Component Analysis (PCA) bi-plot vector magnitude
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Ahmet Cecen
2014-8-8
编辑:Ahmet Cecen
2014-8-8
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 个评论
Ahmet Cecen
2014-8-8
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!