Overload List
| # | Signature | Description |
|---|---|---|
| 1 | void Histogram(TVec Data, TVec Bins, TVec results) | Histogram. |
| 2 | void Histogram(TVec Data, Int32 NumBins, TVec results, TVec Bins, Boolean CenterBins) | Divide the Data vector elements into NumBins equal intervals. |
| 3 | void Histogram(TVec Data, Int32 NumBins, TVec results, TVec Bins, Boolean CenterBins, Double Max, Double Min) | Same as above, but here only values between Min and Max parameters will be counted. |
| 4 | void Histogram(TVec Data, Int32 NumBins, TVecInt results, TVec Bins, Boolean CenterBins) | Divide the Data vector elements into NumBins equal intervals. |
| 5 | void Histogram(TVec Data, Int32 NumBins, TVecInt results, TVec Bins, Boolean CenterBins, Double Max, Double Min) | Same as above, but here only values between Min and Max parameters will be counted. |
Overload 1: void Histogram(TVec Data, TVec Bins, TVec results)
Histogram.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Data | TVec | source TVec |
| 2 | Bins | TVec | source TVec |
| 3 | results | TVec | source TVec |
Result: stored in self (calling object)
Divide the Data vector elements into intervals, specified by the Bins vector. The Bins elements define the center points for the intervals. The Bins elements must be sorted in ascending order. The number of elements falling in each interval is counted and the result for each interval (frequency distribution) 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.
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 freq = new Vector(0);
data.SetIt(false, new double[] {1,2,3,4,5,6,7,8,9,10});
// Centerpoints, note that values are sorted!
bins.SetIt(false, new double[] {1.5, 2.0, 6.0, 9.0});
Statistics.Histogram(data,bins,freq);
// Freq holds the count of elements in each bin
}
}
Overload 2: void Histogram(TVec Data, Int32 NumBins, TVec results, TVec Bins, Boolean CenterBins)
Divide the Data vector elements into NumBins equal intervals.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Data | TVec | source TVec |
| 2 | NumBins | Int32 | |
| 3 | results | TVec | source TVec |
| 4 | Bins | TVec | source TVec |
| 5 | CenterBins | Boolean |
Result: stored in self (calling object)
The number of elements falling in each interval is counted and the result for each interval (frequency distribution) 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 histogram.
using Dew.Math;
using Dew.Stats;
using Dew.Stats.Units;
namespace Dew.Examples
{
private void Example()
{
Vector Data = new Vector(1000);
Vector Bins = new Vector(0);
Vector Freq = new Vector(0);
StatRandom.RandomNormal(-3,0.2,Data,-1); // generate some normaly distributed data
// Now, divide the data into 15 equal intervals
Statistics.Histogram(Data,15,Freq,Bins,true);
// Bins holds the 15 intervals centerpoints
// and Freq holds the count of elements in each bin
}
}
Overload 3: void Histogram(TVec Data, Int32 NumBins, TVec results, TVec Bins, Boolean CenterBins, Double Max, Double Min)
Same as above, but here only values between Min and Max parameters will be counted.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Data | TVec | source TVec |
| 2 | NumBins | Int32 | |
| 3 | results | TVec | source TVec |
| 4 | Bins | TVec | source TVec |
| 5 | CenterBins | Boolean | |
| 6 | Max | Double | scalar |
| 7 | Min | Double | scalar |
Result: stored in self (calling object)
Overload 4: void Histogram(TVec Data, Int32 NumBins, TVecInt results, TVec Bins, Boolean CenterBins)
Divide the Data vector elements into NumBins equal intervals.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Data | TVec | source TVec |
| 2 | NumBins | Int32 | |
| 3 | results | TVecInt | source TVecInt |
| 4 | Bins | TVec | source TVec |
| 5 | CenterBins | Boolean |
Result: stored in self (calling object)
The number of elements falling in each interval is counted and the result for each interval (frequency distribution) 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.
Overload 5: void Histogram(TVec Data, Int32 NumBins, TVecInt results, TVec Bins, Boolean CenterBins, Double Max, Double Min)
Same as above, but here only values between Min and Max parameters will be counted.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Data | TVec | source TVec |
| 2 | NumBins | Int32 | |
| 3 | results | TVecInt | source TVecInt |
| 4 | Bins | TVec | source TVec |
| 5 | CenterBins | Boolean | |
| 6 | Max | Double | scalar |
| 7 | Min | Double | scalar |
Result: stored in self (calling object)