Statistics::mode Function

Overload List

#SignatureDescription
1double mode(TVec *Src);Mode of all Src vector elements.
2double mode(TVec *Src, int SrcIndex, int Len);Mode of Src vector elements [SrcIndex..SrcIndex+Len].

Overload 1: double mode(TVec *Src);

Mode of all Src vector elements.

#NameTypeDescription
1SrcTVec *
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
#include "MtxExpr.h"
#include "Units.Statistics.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Stats;
using namespace Dew::Stats::Units::Statistics;

void Example()
{
    Vector a(0);
    a.SetIt(false, DewArray<double>{1,5,2,11,5,3});
    double md = mode(a); // md = 5
}
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 2: double mode(TVec *Src, int SrcIndex, int Len);

Mode of Src vector elements [SrcIndex..SrcIndex+Len].

#NameTypeDescription
1SrcTVec *
2SrcIndexint
3Lenint
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler