Principal Component Coefficients in princomp

1 Ansicht (letzte 30 Tage)
yang yang
yang yang am 7 Feb. 2012
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?
Thanks for all your kindly answering.

Akzeptierte Antwort

Tom Lane
Tom Lane am 7 Feb. 2012
The princomp function works on the centered data (variance/covariance matrix), so you need to remove the mean to reproduce the scores:
load hald
[a,b] = princomp(ingredients);
bsxfun(@minus,ingredients,mean(ingredients))*a
  1 Kommentar
yang yang
yang yang am 8 Feb. 2012
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).

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Curve Fitting Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by