## Principal Component Coefficients in princomp

yang yang

### yang yang (view profile)

さんによって質問されました 2012 年 2 月 7 日
Tom Lane

### Tom Lane (view profile)

さんの 回答が採用されました
Hi all, The first output of the princomp function is The Principal Component Coefficients(the normalized eigenvectors)and the second output is The Component Scores.I used this code:[_coefs,scores,variances,t2_] = princomp(sr); but the computed result of sr*coefs is not euqal to scores.Why? I am confused!How can I get the eigenvectors of the input matrix?

#### 0 件のコメント

サインイン to comment.

## 1 件の回答

### Tom Lane (view profile)

2012 年 2 月 7 日
採用された回答

The princomp function works on the centered data (variance/covariance matrix), so you need to remove the mean to reproduce the scores:
[a,b] = princomp(ingredients);
bsxfun(@minus,ingredients,mean(ingredients))*a

yang yang

### yang yang (view profile)

2012 年 2 月 8 日
I found this in Matlab Help:princomp centers X by subtracting off column means, but does not rescale the columns of X.Thus,x is preprocessed.I should use the result of preprossing of x to multiply
Principal Component Coefficients.I did it and they were equal(error less than e-12).

サインイン to comment.

Translated by