princomp function (coeff, score, latent)

64 views (last 30 days)
Dylan
Dylan on 22 Aug 2013
Commented: Asim Shahzad on 1 May 2020
I am trying to do principal component analysis (PCA) using matlab. However, some of the names are confusing.
1) I have 100-by-2595 matrix raw data of signals (EMG that measures muscle activity). When I used Matlab's princomp, it gave me different coefficients or loading factors from that of different statistical program, such as Statistica. How does Matlab calculate for coefficients?
2) 'score' is one of the commands used as part of princomp. I am guessing that this is the actual curve or sginal of one principal component. Is this true?
I am using a very simple code if true [coeff,score,latent] = princomp(zscore(a)); % a= raw data end

Answers (1)

Shashank Prasanna
Shashank Prasanna on 23 Aug 2013
Edited: Shashank Prasanna on 23 Aug 2013
PRINCOMP assumes rows are the observations. Which means if a is 100x2595 you'd have to use the transpose:
>> [COEFF,SCORE,latent,tsquare] = princomp(zscore(a'))
MATLAB computes pca using svd, same as most software I assume. If you want to compute pca using a precomputed covariance matrix then use PCACOV
If your results are different, make sure if the the other software is centering and scaling as well.
SCORE is the projection of your original data onto the principle component space. For example SCORE(:,1) would be the projection of your data onto the first pc and so on.
  1 Comment
Asim Shahzad
Asim Shahzad on 1 May 2020
Your answer saved me. Thank you.
I wonder why this isn't the first thing they mentioned in the docs though.

Sign in to comment.

Categories

Find more on Biological and Health Sciences in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!