function mode(Src: TVec): Double;
Mode of all Src vector elements.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TVec | source TVec |
Returns: Double
Remarks:
The mode of a data sample is the element that occurs most often in the collection. For example, the mode of the sample [1, 3, 6, 6, 6, 6, 7, 7, 12, 12, 17] is 6. Given the list of data [1, 1, 2, 4, 4] the mode is not unique, unlike the arithmetic mean.
Examples
Uses MtxExpr, Statistics, Math387;
procedure Example;
var a: Vector;
Md : double;
begin
a.SetIt(false,[1,5,2,11,5,3]);
Md := Mode(a); // Md = 5
end;
Indexed: function mode(Src: TVec; SrcIndex: Integer; Len: Integer): Double;
Mode of Src vector elements [SrcIndex..SrcIndex+Len].
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Src | TVec | source TVec |
| 2 | SrcIndex | Integer | source start index |
| 3 | Len | Integer | element count |
Returns: Double