Statistics::CumulativeHist Function

Overload List

#SignatureDescription
1void CumulativeHist(TVec *Data, TVec *Bins, TVec *results);Cumulative histogram.
2void CumulativeHist(TVec *Data, const int NumBins, TVec *results, TVec *Bins, bool CenterBins = false);Divide the Data vector elements into NumBins equal intervals.

Overload 1: void CumulativeHist(TVec *Data, TVec *Bins, TVec *results);

Cumulative histogram.

#NameTypeDescription
1DataTVec *
2BinsTVec *
3resultsTVec *
Remarks:

Divide the Data vector elements into intervals, specified by the Bins vector. The Bins elements define the center points for the individual intervals. The Bins elements must be sorted in ascending order. The number of elements falling in each interval is counted and the relative cumulative frequency for each interval is written to the Results vector. The Length and Complex properties of the Results vector are adjusted automatically.

Note
Use this version if you need non-equidistant histogram.

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 Data(0);
    Vector Bins(0);
    Vector CumRelFreq(0);
    Data.SetIt(false, DewArray<double>{1,2,3,4,5,6,7,8,9,10});
    // define centerpoints, note that values are sorted!
    Bins.SetIt(false, DewArray<double>{1.5, 2, 6, 9});
    CumulativeHist(Data,Bins, CumRelFreq);
    // CumRelFreq holds the relative cumulative count of
    // elements in each bin.
}
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler

Overload 2: void CumulativeHist(TVec *Data, const int NumBins, TVec *results, TVec *Bins, bool CenterBins = false);

Divide the Data vector elements into NumBins equal intervals.

#NameTypeDescription
1DataTVec *
2NumBinsconst int
3resultsTVec *
4BinsTVec *
5CenterBins = falsebool
Remarks:

The number of elements falling in each interval is counted and the relative cumulative frequency for each interval is written to the Results vector. if CenterBins is true then Bins will store bins center points. If CenterBins is false, Bins will store bins edges. The Length and Complex properties of the Results and Bins vectors are adjusted automatically.

Note
Use this version if you need equidistant cumulative histogram.

Examples
#include "MtxExpr.h"
#include "Units.StatRandom.h"
#include "Units.Statistics.h"

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

void Example()
{
    Vector Data(1000, false);
    Vector Bins(0);
    Vector CumRelFreq(0);
    // generate some normally distributed data
    RandomNormal(-3.0, 0.2, Data, -1);
    CumulativeHist(Data, 15, CumRelFreq, Bins, false);
    // Bins holds the 15 intervals centerpoints
    // and CumRelFreq holds the relative cumulative count of
    // elements in each bin.
}
See Also: Statistics::Histogram
Declared in Dew::Stats::Units::Statistics · Dew.Stats/Units.Statistics.h · Cross-compiler