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!