Class StatsFunctions provides a wide variety of static functions for computing descriptive statistics, such as mean, variance, standard deviation, percentile, median, quartiles, geometric mean, harmonic mean, RMS, kurtosis, skewness, and many more.
Method overloads accept data as an array of doubles, as a DoubleVector, or as a column in a DataFrame (Chapter 2). For example:
double[] dblArray = { 1.12, -2.0, 3.88, 1.2, 15.345 };
double mean1 = StatsFunctions.Mean( dblArray );
DoubleVector v =
new DoubleVector( "1.12 -2.0 3.88 1.2 15.345" );
double mean2 = StatsFunctions.Mean( v );
DataFrame df = new DataFrame();
df.AddColumn(
new DFNumericColumn( "myData", 1.12, -2.0, 3.88, 1.2, 15.345 ) );
double mean3 = StatsFunctions.Mean( df[ "myData" ] );
// mean1 == mean2 == mean3
In this chapter, where data is used in code examples, it should be understood to be an instance of any of these three types.
Class StatsFunctions also provides some special functions, including combinatorial functions, the gamma function, and the beta function. Such special functions are described in Chapter 4.
TOC | Previous | Next | Index