PIP 5.6.1
Platform-Independent Primitives
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PIStatistic< T > Class Template Reference

Template class for calculating statistical measures of a data set Calculates mean, variance, skewness and kurtosis for a numeric sample. More...

#include <pistatistic.h>

Public Member Functions

 PIStatistic ()
 Constructs an object with all accumulated values set to zero.
 
bool calculate (const PIVector< T > &val, const T &given_mean)
 Calculates all statistics using the supplied mean value. More...
 
bool calculate (const PIVector< T > &val)
 Calculates all statistics and derives the mean from the sample.
 

Static Public Member Functions

static T calculateMean (const PIVector< T > &val)
 Returns arithmetic mean of the sample, or zero for an empty vector.
 

Public Attributes

mean
 Sample mean.
 
variance
 Variance estimate accumulated for the sample.
 
skewness
 Sample skewness.
 
kurtosis
 Excess kurtosis of the sample.
 

Detailed Description

template<typename T>
class PIStatistic< T >

Template class for calculating statistical measures of a data set Calculates mean, variance, skewness and kurtosis for a numeric sample.

Member Function Documentation

◆ calculate()

template<typename T >
bool PIStatistic< T >::calculate ( const PIVector< T > &  val,
const T &  given_mean 
)
inline

Calculates all statistics using the supplied mean value.

Returns false when the sample contains fewer than two values.