|The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....|
|Home MathPack Math2 Procedures and Functions CalcPrincComp|
|See also: RemoveEigenMatrix, GetEigenResult, CalcEigVec|
The procedure CalcPrincComp calculates the principal components (Principal Component Analysis, PCA) of the matrix Indata . The rows of the data matrix are objects, the columns are variables. The resulting principal components can be read using the routine GetEigenResult. In version  of the method, all eigenvalues are scaled to their sum equal to 1.0, in version  the user has the choice not to normalize the eigenvalues by setting the parameter NormalizeEV to FALSE. In this case, the unchanged eigenvalues are available. The eigenvectors are arranged according to decreasing eigenvalues, thus the first eigenvector corresponds to the first principal component.
The function CalcPrincComp allocates some memory for the storage of the covariance and the eigenvector matrix. The memory for the eigenvector matrix is not deallocated after finishing CalcPrincComp and must be deallocated explicitly by calling the routine RemoveEigenMatrix. If CalcPrincComp is called several times the old eigenvector matrix is released and a new one is allocated.
The parameters LoC, HiC, LoR, and HiR specify the area of the matrix which is used for the principal component analysis. This facilitates the calculation of the principal components of only parts of the input data. Usually, the PCA is applied to all the available data (LoC =1, HiC =InData.NrOfColumns, LoR =1, and HiR =InData.NrOfRows).
The parameter Scaling determines, whether the data should be before calculating the principal components:
The function CalcPrincComp returns a TRUE value, if the PCA has been completed successfully. If FALSE is returned, the calculation has been aborted (mostly due to lack of memory).