theplu::yat::statistics::Averager Class Reference

Class to calculate simple (first and second moments) averages. More...

#include <yat/statistics/Averager.h>

List of all members.

Public Member Functions

 Averager (void)
 Averager (double x, double xx, long n)
 Averager (const Averager &a)
void add (double d, long n=1)
double cv (void) const
 Coeffient of variation.
double mean (void) const
long n (void) const
void rescale (double a)
 Rescales the object.
double standard_error (void) const
double std (void) const
 The standard deviation is defined as the square root of the variance.
double std (double m) const
 The standard deviation is defined as the square root of the variance.
double sum_x (void) const
double sum_xx (void) const
double sum_xx_centered (void) const
double variance (double m) const
 The variance with know mean.
double variance (void) const
 The estimated variance.
double variance_unbiased (void) const
void reset (void)
 Reset everything to zero.
const Averageroperator= (const Averager &)
 The assignment operator.
const Averageroperator+= (const Averager &)

Related Functions

(Note that these are not member functions.)

template<typename InputIterator >
void add (Averager &a, InputIterator first, InputIterator last)
 adding a range of values to Averager a


Detailed Description

Class to calculate simple (first and second moments) averages.

See also:
AveragerWeighted AveragerPair AveragerPairWeighted

Constructor & Destructor Documentation

theplu::yat::statistics::Averager::Averager ( void   ) 

Default constructor

theplu::yat::statistics::Averager::Averager ( double  x,
double  xx,
long  n 
)

Constructor taking sum of x, sum of squared x, xx, and number of samples n.

theplu::yat::statistics::Averager::Averager ( const Averager a  ) 

Copy constructor


Member Function Documentation

void theplu::yat::statistics::Averager::add ( double  d,
long  n = 1 
)

Adding n (default=1) number of data point(s) with value d.

double theplu::yat::statistics::Averager::cv ( void   )  const

Coeffient of variation.

Coeffient of variation (cv) is defined as ratio between the standard deviation and the mean: $ \frac{\sigma}{\mu} $.

Returns:
standard deviation divided by mean.

double theplu::yat::statistics::Averager::mean ( void   )  const

Returns:
Mean of presented data, $ \frac{1}{n}\sum x_i $

long theplu::yat::statistics::Averager::n ( void   )  const

Returns:
Number of data points

const Averager& theplu::yat::statistics::Averager::operator+= ( const Averager  ) 

Operator to add another Averager

void theplu::yat::statistics::Averager::rescale ( double  a  ) 

Rescales the object.

$ \forall x_i \rightarrow a*x_i $,

double theplu::yat::statistics::Averager::standard_error ( void   )  const

Returns:
Standard error, i.e. standard deviation of the mean $ \sqrt{variance()/n} $

double theplu::yat::statistics::Averager::std ( double  m  )  const

The standard deviation is defined as the square root of the variance.

Returns:
Standard deviation around m, root of the variance(m).

double theplu::yat::statistics::Averager::std ( void   )  const

The standard deviation is defined as the square root of the variance.

Returns:
The standard deviation, root of the variance().

double theplu::yat::statistics::Averager::sum_x ( void   )  const

Returns:
The sum of x

double theplu::yat::statistics::Averager::sum_xx ( void   )  const

Returns:
The sum of squares

double theplu::yat::statistics::Averager::sum_xx_centered ( void   )  const

Returns:
$ \sum_i (x_i-m)^2 $

double theplu::yat::statistics::Averager::variance ( void   )  const

The estimated variance.

The variance is calculated as $ \frac{1}{N}\sum_i (x_i-m)^2 $, where $ m $ is the mean.

Returns:
Estimation of variance

double theplu::yat::statistics::Averager::variance ( double  m  )  const

The variance with know mean.

The variance is calculated as $ \frac{1}{n}\sum (x_i-m)^2 $.

Returns:
Variance when the mean is known to be m.

double theplu::yat::statistics::Averager::variance_unbiased ( void   )  const

The variance is calculated using the $ (n-1) $ correction, which means it is the best unbiased estimator of the variance $ \frac{1}{N-1}\sum_i (x_i-m)^2 $, where $ m $ is the mean.

Returns:
unbiased estimation of variance


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

Generated on Mon Nov 7 02:25:52 2011 for yat by  doxygen 1.5.9