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....



CalcHatMatrix


Unit: SDL_matrix
Class: TMatrix
Declaration: function CalcHatMatrix (var HatMat: TMatrix): integer;

The function CalcHatMatrix calculates the hat matrix and stores the result in matrix HatMat:

HatMat := X(XTX)-1XT

The function returns the following error codes:
 0 ... everything is OK
-1 ... the source matrix has zero size
-2 ... not enough memory on heap
-3 ... LU decomposition was not possible (singular covariance matrix)

 

Hint: Please note that the calculation of the hat matrix can consume considerable amounts of memory. The memory requirement (including the original matrix and HatMat) amounts to 8*((p+n)2 + pn) bytes, with p being the number of columns of the data matrix and n being the number of rows.



Last Update: 2023-Feb-06