Principal Component Analysis |
Nipals(DATA, NumPC, maxiter, "scale/noscale", Acc) Takes a matrix of multivariate DATA, and returns numPC principal components, calculated with a maximum of maxiter iterations. The fourth argument may be set to "scale" if you wish to scale the data to the standard deviation, or "noscale" if you do not. The convergence accuracy is given by Acc, typically of the order of 10-10 or smaller.
The output contains the scores, loadings, cumulative variance explained, and the principal components (eigenvalues) in nested format. These can be accessed using matrix indexing or can be extracted with the other functions mentioned on this page.
Nipals2(Nipals, numAddPC) Takes the nested matrix output of the Nipals function and the number of additional principal components to calculate. Nipals2 returns a nested matrix of the scores, loadings, eigenvalues, and cumulative variances for the original plus the additional number of principal components.
loadings(Nipals) Takes the results array from the Nipals or Nipals2 function and returns the entry corresponding to the loadings of the principal components.
PCAeigenvals(Nipals) Takes the results array from the Nipals or Nipals2 function and returns the eigenvalues of the principal components.
PCAvariance(Nipals) Takes the results array from the Nipals or Nipals2 function and returns the cumulative variance explained by each calculated principal component.
scores(Nipals) Takes the results array from the Nipals or Nipals2 function and returns the scores array.