Set of statistics functions.
Statistics
00 Remarks
The class represents collection of simple functions used in statistics.
01 Syntax
02 Methods
03 Members
Int32())Calculate mean value.
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).
Sample usage:
// create histogram array
int[] histogram = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 };
// calculate mean value
double mean = Statistics.Mean( histogram );
// output it (5.759)
Console.WriteLine( "mean = " + mean.ToString( "F3" ) );
| Name | Type | Description |
|---|---|---|
values | Int32() | Histogram array. |
Returns mean value.
Int32())Calculate standard deviation.
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).
Sample usage:
' create histogram array
Dim histogram As Integer() = New Integer() { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 }
' calculate standard deviation value
Dim stdDev = Statistics.StdDev( histogram )
'' output it (1.999)
Console.WriteLine( "std.dev. = " & stdDev.ToString( "F3" ) )| Name | Type | Description |
|---|---|---|
values | Int32() | Histogram array. |
Returns value of standard deviation.
Int32(), Double)Calculate standard deviation.
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).
The method is an equevalent to the Statistics.StdDev() method, but it relieas on the passed mean value, which is previously calculated using Statistics.Mean() method.
| Name | Type | Description |
|---|---|---|
values | Int32() | Histogram array. |
mean | Double | Mean value of the histogram. |
Returns value of standard deviation.
Int32())Calculate median value.
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).
The median value is calculated accumulating histogram's values starting from the left point until the sum reaches 50% of histogram's sum.
Sample usage:
// create histogram array
int[] histogram = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 };
// calculate median value
int median = Statistics.Median( histogram );
// output it (6)
Console.WriteLine( "median = " + median );
| Name | Type | Description |
|---|---|---|
values | Int32() | Histogram array. |
Returns value of median.
Int32(), Double)Get range around median containing specified percentage of values.
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).
The method calculates range of stochastic variable, which summary probability comprises the specified percentage of histogram's hits.
Sample usage:
// create histogram array
int[] histogram = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 };
// get 75% range around median
IntRange range = Statistics.GetRange( histogram, 0.75 );
// output it ([4, 8])
Console.WriteLine( "range = [" + range.Min + ", " + range.Max + "]" );
| Name | Type | Description |
|---|---|---|
values | Int32() | Histogram array. |
percent | Double | Values percentage around median. |
Returns the range which containes specifies percentage of values.
Int32())Calculate mode value.
The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).
Returns the minimum mode value if the specified histogram is multimodal.
Sample usage:
// create array
int[] values = new int[] { 1, 1, 2, 3, 6, 8, 11, 12, 7, 3 };
// calculate mode value
int mode = Statistics.Mode( values );
// output it (7)
Console.WriteLine( "mode = " + mode );
| Name | Type | Description |
|---|---|---|
values | Int32() | Histogram array. |
Returns mode value of the histogram array.