Statistics.CumulativeHist Method

Overload List

#SignatureDescription
1void CumulativeHist(TVec Data, TVec Bins, TVec results)Cumulative histogram.
2void CumulativeHist(TVec Data, Int32 NumBins, TVec results, TVec Bins, Boolean CenterBins)Divide the Data vector elements into NumBins equal intervals.

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

Cumulative histogram.

#NameTypeDescription
1DataTVecsource TVec
2BinsTVecsource TVec
3resultsTVecsource TVec

Result: stored in self (calling object)

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
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
    private void Example()
    {
        Vector Data  = new Vector(0);
        Vector Bins = new Vector(0);
        Vector CumRelFreq = new Vector(0);
        Data.SetIt(false, new double[] {1,2,3,4,5,6,7,8,9,10});
        // define centerpoints, note that values are sorted!
        Bins.SetIt(false, new double[] {1.5, 2, 6, 9});
        Statistics.CumulativeHist(Data,Bins, CumRelFreq);
        // CumRelFreq holds the relative cumulative count of
        // elements in each bin.
    }
}

Overload 2: void CumulativeHist(TVec Data, Int32 NumBins, TVec results, TVec Bins, Boolean CenterBins)

Divide the Data vector elements into NumBins equal intervals.

#NameTypeDescription
1DataTVecsource TVec
2NumBinsInt32
3resultsTVecsource TVec
4BinsTVecsource TVec
5CenterBinsBoolean

Result: stored in self (calling object)

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
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
    private void Example()
    {
        Vector Data = new Vector(1000, false);
        Vector Bins = new Vector(0);
        Vector CumRelFreq = new Vector(0);
        // generate some normally distributed data
        StatRandom.RandomNormal(-3.0, 0.2, Data, -1);
        Statistics.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