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


Class: TVector, TIntVector
Declaration: function Mode (LowElem, HighElem: integer): double; { class TVector }
function Mode (LowElem, HighElem: integer): integer; { class TIntVector }

The method Mode calculates the mode of the sample distribution given by the vector elements from LowElem to HighElem. If any of these parameters receives an invalid value, this value is automatically adjusted to the most appropriate boundary (either 1 or NrOfElem).

Please note that in the case of the method Mode the vector is not considered as a vector in its usual sense but merely as a collection of numbers.

Hint: The algorithm used in the method Mode does not allow for any density estimations. It simply determines the frequencies of all selected vector elements and returns the element which occurs most often as the mode of the sample. If there is more than one class showing the same count, the lower one is returned as the function value.

Last Update: 2023-Feb-06