nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.DataMining.Framework / Statistics

Statistics

Full name Microsoft.VisualBasic.DataMining.Statistics Assembly Microsoft.VisualBasic.DataMining.Framework Members 6

Set of statistics functions.

00 Remarks

The class represents collection of simple functions used in statistics.

01 Syntax

Microsoft.VisualBasic.DataMining.Statistics

02 Methods

NameOverloadsSummary
Mean 1 Calculate mean value.
StdDev 2 Calculate standard deviation.
Median 1 Calculate median value.
GetRange 1 Get range around median containing specified percentage of values.
Mode 1 Calculate mode value.

03 Members

method Mean #
Mean(Int32())

Calculate mean value.

Remarks

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" ) );
 
Parameters
NameTypeDescription
valuesInt32()

Histogram array.

Returns

Returns mean value.

method StdDev overload 2 #
StdDev(Int32())

Calculate standard deviation.

Remarks

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" ) )
Parameters
NameTypeDescription
valuesInt32()

Histogram array.

Returns

Returns value of standard deviation.

method StdDev #
StdDev(Int32(), Double)

Calculate standard deviation.

Remarks

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.

Parameters
NameTypeDescription
valuesInt32()

Histogram array.

meanDouble

Mean value of the histogram.

Returns

Returns value of standard deviation.

method Median #
Median(Int32())

Calculate median value.

Remarks

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 );
 
Parameters
NameTypeDescription
valuesInt32()

Histogram array.

Returns

Returns value of median.

method GetRange #
GetRange(Int32(), Double)

Get range around median containing specified percentage of values.

Remarks

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 + "]" );
 
Parameters
NameTypeDescription
valuesInt32()

Histogram array.

percentDouble

Values percentage around median.

Returns

Returns the range which containes specifies percentage of values.

method Mode #
Mode(Int32())

Calculate mode value.

Remarks

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 );
 
Parameters
NameTypeDescription
valuesInt32()

Histogram array.

Returns

Returns mode value of the histogram array.