RobWorkProject  24.5.15-
Public Member Functions | Static Public Member Functions | Friends | List of all members
Statistics< T > Class Template Reference

Class for collecting data and calculating simple statistics. More...

#include <Statistics.hpp>

Public Member Functions

mean () const
 Returns the mean of the values added. More...
 
angularMean () const
 Returns the angular mean of the values added. More...
 
median () const
 Returns the median of the values added. More...
 
variance () const
 Returns the variance of the values added The variance is computed as \( \frac{1}{n-1} \Sigma_{d\in data}(m-\mu)^2 \) where \( \mu \) is the mean of the data.
 
angularVariance () const
 Returns the angular variance of the values added The variance is computed as \( \frac{1}{n-1} \Sigma_{d\in data}\left[\cos^{-1}(\sin(d)\sin(\mu)-\cos(d)\cos(\mu))\right]^2 \) where \( \mu \) is the angular mean of the data.
 
std::pair< T, T > meanAndVariance () const
 returns the mean and the variance of the data. More...
 
std::pair< T, T > angularMeanAndVariance () const
 returns the angular mean and the variance of the data. More...
 
minValue () const
 Returns the minimum value of data added. More...
 
maxValue () const
 Returns the maximum value of data added. More...
 
std::pair< T, T > minAndMaxValue () const
 Returns pair containing the minimum and maximum value of the data added. More...
 
void add (const T &t)
 Add data to statistics.
 
void clear ()
 Clear the recorded statistics data.
 
const std::list< T > & data () const
 Provides reference to the internal data container.
 

Static Public Member Functions

template<class V >
static T mean (const V &data)
 Calculates the mean for a list of data.
 
template<class V >
static T angularMean (const V &data)
 Calculates the mean for a list of angles.
 
template<class V >
static T median (const V &data)
 Calcualtes the median for a list of data.
 
template<class V >
static T variance (const V &data, const T &mean)
 Calculates the variance for a list of data. More...
 
template<class V >
static T angularVariance (const V &data, const T &mean)
 Calculates the variance for a list of angles.
 
template<class V >
static std::pair< T, T > meanAndVariance (const V &data)
 
template<class V >
static std::pair< T, T > angularMeanAndVariance (const V &data)
 
template<class V >
static T minValue (const V &data)
 Finds the minimal value in data.
 
template<class V >
static T maxValue (const V &data)
 Finds the maximal value in data.
 
template<class V >
static std::pair< T, T > minAndMaxValue (const V &data)
 Finds the minimal and maximal value in data.
 

Friends

std::ostream & operator<< (std::ostream &os, const Statistics< T > &statistics)
 Statitics to stream. More...
 

Detailed Description

template<class T>
class rw::math::Statistics< T >

Class for collecting data and calculating simple statistics.

Member Function Documentation

◆ angularMean()

T angularMean ( ) const
inline

Returns the angular mean of the values added.

The angular mean is computed as \( \tan^{-1}\frac{\Sigma_{d\in data}\sin(d)}{\Sigma_{d\in data}\cos(d)} \)

◆ angularMeanAndVariance() [1/2]

std::pair<T, T> angularMeanAndVariance ( ) const
inline

returns the angular mean and the variance of the data.

See documentation of Statistics::angularMean() and Statistics::angularVariance() for how the mean and variane are computed.

◆ angularMeanAndVariance() [2/2]

static std::pair<T, T> angularMeanAndVariance ( const V &  data)
inlinestatic

Calculates the mean and variance of a list of angles.

◆ maxValue()

T maxValue ( ) const
inline

Returns the maximum value of data added.

If no data is added 0 is returned.

◆ mean()

T mean ( ) const
inline

Returns the mean of the values added.

The mean is computed as \( \frac{1}{n} \Sigma_{d\in data}d \)

◆ meanAndVariance() [1/2]

std::pair<T, T> meanAndVariance ( ) const
inline

returns the mean and the variance of the data.

See documentation of Statistics::mean() and Statistics::variance() for how the mean and variane are computed.

◆ meanAndVariance() [2/2]

static std::pair<T, T> meanAndVariance ( const V &  data)
inlinestatic

Calculates the mean and variance of a list of data

◆ median()

T median ( ) const
inline

Returns the median of the values added.

Given an equal number of element, the mean is calculated as the average of the two center elements.

◆ minAndMaxValue()

std::pair<T, T> minAndMaxValue ( ) const
inline

Returns pair containing the minimum and maximum value of the data added.

If no data is added 0 is returned for both values.

◆ minValue()

T minValue ( ) const
inline

Returns the minimum value of data added.

If no data is added 0 is returned.

◆ variance()

static T variance ( const V &  data,
const T &  mean 
)
inlinestatic

Calculates the variance for a list of data.

Parameters
data[in] data
mean[in] The mean value of the data
Returns
variance of data

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Statistics< T > &  statistics 
)
friend

Statitics to stream.

Parameters
os[in/out] stream to use
statistics[in] Statistics to output
Returns
the resulting stream

The documentation for this class was generated from the following files: