DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....

## MultiClassLDA

 Declaration: MultiClassLDA (InData: TDouble2DArray; ClassVec: TIntArray; var NClasses: integer; var ClCnt: TIntArray; var ClMeans, ClVars, DiscrimDirs: TDouble2DArray; var EigenVals: TDoubleArray): integer; The function MultiClassLDA performs a multi-class linear discriminant analysis (LDA). The parameter InData contains the data to be analyzed (rows are objects, columns are variables) and the parameter ClassVec contains the corresponding class numbers. On return, the variable parameter NClasses contains the number of found classes. The variable arrays ClCnt, ClMeans and ClVars contain the number of members of each class, the class means and the class variances, respectively. The first index of the arrays ClMeans and ClVars designates the corresponding variable, the second index addresses the class number (zero-based indices!). For example, the element ClVars[3,0] contains the variance of the fourth variable for the first class. The optimum discrimination directions (=eigenvectors) are returned in the variable parameter DiscrimDirs, the corresponding eigenvalues (=information content) is returned in the array EigenVals. The eigenvectors are stored rowwise in the DiscrimDirs array and are sorted in decreasing eigenvalue order. The function returns the following error codes:  0 ... everything is OK -1 ... lengths of InData and ClassVec do not match -2 ... the class vector contains invalid class numbers -3 ... the class vector does not contain contiguous class numbers (1..NClasses) -4 ... class matrix is not invertible -5 ... cannot perform eigenanalysis (singular system)

 Hint: Discrimination directions with very low eigenvalues (< 10-8) should not be interpreted at all as these vectors are mostly resulting from roundoff errors. Further, the number of valid eigenvectors is min(NClasses-1,length(InData)), even if length(InData) eigenvalues are calculated for formal reasons.