PCA more efficient



S=xsn;
Hi, I have this code to calcule the first components from the PCA.
Anyone, can help me to writte down it more efficently.

Specifically to obtain the vector Ex:
I have consider the sum of components (ax) reach the 65% of the total contribution of the components,
but there are other form more efficiently to write dow it?.

FT=cov(S);
[evecs,evals]=eig(FT);
[sev,I]=sort(diag(evals))
nsa=length(sev);

ax=0;
Ex=[];
for i=nsa:-1:1

ax= ax+sev(i)/sum(sev);
Ex=[Ex evecs(:,i)];

if ax>0.85 % The sum of components have to account for 65% of the data variation.
break % We do not have account the rest of components.
end
end


cheers,
Jose.
.



Relevant Pages

  • Re: PCA more efficient
    ... I have this code to calcule the first components from the PCA. ... can help me to writte down it more efficently. ... Ex is growing inside a loop, which is not efficient at all. ...
    (comp.soft-sys.matlab)
  • Re: PCA allowing bias
    ... information on the first components? ... But I needed more explanation to see, ... Well PCA don't loose any information. ... information on the first axis, ...
    (sci.math)
  • Re: PCA allowing bias
    ... information on the first components? ... Well PCA don't loose any information. ... to maximize variance on the first factor and minimize variance on last factor. ... Gottfried Helms, Kassel ...
    (sci.math)
  • Re: PCA allowing bias
    ... information on the first components? ... But I needed more explanation to see, ... Well PCA don't loose any information. ... But is it possible to have more information on the first axis, ...
    (sci.math)
  • Re: PCA allowing bias
    ... information on the first components? ... I have a somehow sophisticated procedure for modifications ... of PCA. ... But I needed more explanation to see, ...
    (sci.math)