yat  0.12.3pre
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
theplu::yat::statistics::averager_base2< Derived > Class Template Referenceabstract

Base class for averagers calculating mean and variance. More...

#include <yat/statistics/averager_base.h>

Inheritance diagram for theplu::yat::statistics::averager_base2< Derived >:
theplu::yat::statistics::averager_base< Derived > theplu::yat::statistics::averager_base3< Derived > theplu::yat::statistics::averager_base4< Derived >

Public Member Functions

 averager_base2 (void)
 Constructor.
 
virtual ~averager_base2 (void)=0
 Destructor.
 
double cv (void) const
 Coeffient of variation. More...
 
double standard_error (void) const
 
double std (void) const
 The standard deviation is defined as the square root of the variance. More...
 
double std (double m) const
 The standard deviation is defined as the square root of the variance. More...
 
double sum_xx (void) const
 
double sum_xx_centered (void) const
 
double variance (double m) const
 The variance with known mean. More...
 
double variance (void) const
 The estimated variance. More...
 
double variance_unbiased (void) const
 
void add (double x, long n=1)
 add a data point More...
 
double mean (void) const
 mean More...
 
long n (void) const
 number of data points More...
 
void rescale (double a)
 Rescales the object. More...
 
void reset (void)
 Reset object. More...
 
double sum_x (void) const
 

Protected Member Functions

void add2 (double mean, double cm2, long int n)
 
void add2 (double delta)
 
double rescale2 (double x)
 
void add1 (double x, long int n)
 
void add1 (double delta)
 
double rescale1 (double x)
 

Protected Attributes

double cm2_
 
long int n_
 
double mean_
 mean
 

Detailed Description

template<class Derived>
class theplu::yat::statistics::averager_base2< Derived >

Base class for averagers calculating mean and variance.

This is an extension of averager_base and provides more functionality related to the second moment (variance).

For requirement on Derived see averager_base.

See Also
Averager which is an example derived class
Since
yat 0.9

Member Function Documentation

template<class Derived>
void theplu::yat::statistics::averager_base< Derived >::add ( double  x,
long  n = 1 
)
inlineinherited

add a data point

Adding n number of data point(s) with value x.

template<class Derived >
void theplu::yat::statistics::averager_base< Derived >::add1 ( double  x,
long int  n 
)
protectedinherited

add n data points with value x

template<class Derived >
void theplu::yat::statistics::averager_base< Derived >::add1 ( double  delta)
protectedinherited

add one data point with value delta + mean()

template<class Derived >
void theplu::yat::statistics::averager_base2< Derived >::add2 ( double  mean,
double  cm2,
long int  n 
)
protected

add a set of n data points with mean mean and centralized squaed sum cm

template<class Derived >
void theplu::yat::statistics::averager_base2< Derived >::add2 ( double  delta)
protected

add one data point with value delta + mean()

template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::cv ( void  ) const
inline

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.
template<class Derived>
double theplu::yat::statistics::averager_base< Derived >::mean ( void  ) const
inlineinherited

mean

Returns
Mean of presented data, $ \frac{1}{n}\sum x_i $
template<class Derived>
long theplu::yat::statistics::averager_base< Derived >::n ( void  ) const
inlineinherited

number of data points

Returns
Number of data points
template<class Derived>
void theplu::yat::statistics::averager_base< Derived >::rescale ( double  a)
inlineinherited

Rescales the object.

$ \forall x_i \rightarrow a*x_i $,

template<class Derived >
double theplu::yat::statistics::averager_base< Derived >::rescale1 ( double  x)
protectedinherited

rescale as $ mean \rightarrow x mean $

template<class Derived >
double theplu::yat::statistics::averager_base2< Derived >::rescale2 ( double  x)
protected

rescales $ cm2 \rightarrow x^2 cm2 $ and calles rescale1(double)

template<class Derived>
void theplu::yat::statistics::averager_base< Derived >::reset ( void  )
inlineinherited

Reset object.

Restore Averager as if data were never added

template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::standard_error ( void  ) const
inline
Returns
Standard error, i.e. standard deviation of the mean $ \sqrt{variance()/n} $
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::std ( void  ) const
inline

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

Returns
The standard deviation, root of the variance().
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::std ( double  m) const
inline

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

Returns
Standard deviation around m, root of the variance(m).
template<class Derived>
double theplu::yat::statistics::averager_base< Derived >::sum_x ( void  ) const
inlineinherited
Returns
The sum of data values
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::sum_xx ( void  ) const
inline
Returns
The sum of squares
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::sum_xx_centered ( void  ) const
inline
Returns
$ \sum_i (x_i-m)^2 $
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::variance ( double  m) const
inline

The variance with known mean.

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

Returns
Variance when the mean is known to be m.
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::variance ( void  ) const
inline

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
template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::variance_unbiased ( void  ) const
inline

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

Member Data Documentation

template<class Derived>
double theplu::yat::statistics::averager_base2< Derived >::cm2_
protected

sum of values squared values centralized $ \sum (x-m)^2 $

template<class Derived>
long int theplu::yat::statistics::averager_base< Derived >::n_
protectedinherited

number of data points


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

Generated on Mon Jun 1 2015 12:29:53 for yat by  doxygen 1.8.5