yat  0.14.5pre
Public Member Functions | Related Functions | List of all members
theplu::yat::statistics::AveragerPairWeighted Class Reference

Class for taking care of mean and covariance of two variables in a weighted manner. More...

#include <yat/statistics/AveragerPairWeighted.h>

Public Member Functions

 AveragerPairWeighted (void)
 The default constructor.
 
void add (const double x, const double y, const double wx, const double wy)
 
double correlation (void) const
 Pearson correlation coefficient. More...
 
double covariance (void) const
 
double msd (void) const
 
double n (void) const
 
void reset (void)
 Reset everything to zero.
 
double sum_w (void) const
 
double sum_xy (void) const
 
double sum_xy_centered (void) const
 
const AveragerWeightedx_averager (void) const
 
const AveragerWeightedy_averager (void) const
 
const AveragerPairWeightedoperator+= (const AveragerPairWeighted &)
 Addition assignment operator. More...
 

Related Functions

(Note that these are not member functions.)

template<class InputIterator1 , class InputIterator2 >
void add (AveragerPairWeighted &ap, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
 adding a ranges of values to AveragerPairWeighted ap More...
 
template<typename InputIterator1 , typename InputIterator2 , typename InputIterator3 , typename InputIterator4 >
void add (AveragerPairWeighted &ap, InputIterator1 x, InputIterator1 xlast, InputIterator2 y, InputIterator3 wx, InputIterator4 wy)
 adding four ranges of values to AveragerPairWeighted ap More...
 

Detailed Description

Class for taking care of mean and covariance of two variables in a weighted manner.

See Also
Weighted Statistics

If nothing else stated, each function fulfills the following:

See Also
Averager AveragerWeighted AveragerPair

Member Function Documentation

void theplu::yat::statistics::AveragerPairWeighted::add ( const double  x,
const double  y,
const double  wx,
const double  wy 
)

Adding a pair of data points with value x and y, and their weights. If either of the weights are zero the addition is ignored

double theplu::yat::statistics::AveragerPairWeighted::correlation ( void  ) const

Pearson correlation coefficient.

Returns
$ \frac{\sum w_xw_y (x-m_x)(y-m_y)}{\sqrt{\sum w_xw_y (y-m_y)^2\sum w_xw_y (y-m_y)^2}} $ where m is calculated as $ m_x = \frac {\sum w_xw_yx}{\sum w} $
double theplu::yat::statistics::AveragerPairWeighted::covariance ( void  ) const

$ \frac{\sum w_xw_y (x-m_x)(y-m_y)}{\sum w_xw_y} $ where m is calculated as $ m_x = \frac {\sum w_xw_yx}{\sum w} $

double theplu::yat::statistics::AveragerPairWeighted::msd ( void  ) const
Returns
$ \frac{\sum w_xw_y(x-y)^2}{\sum w_xw_y} $
double theplu::yat::statistics::AveragerPairWeighted::n ( void  ) const
Returns
$ \frac{\left(\sum w_x w_y\right)^2}{\sum w_x^2w_y^2} $
const AveragerPairWeighted& theplu::yat::statistics::AveragerPairWeighted::operator+= ( const AveragerPairWeighted )

Addition assignment operator.

Returns
resulting AveragerPairWeighted
Since
New in yat 0.8
double theplu::yat::statistics::AveragerPairWeighted::sum_w ( void  ) const
Returns
$ \sum w_xw_y $
double theplu::yat::statistics::AveragerPairWeighted::sum_xy ( void  ) const
Returns
$ \sum w_xw_yxy $
double theplu::yat::statistics::AveragerPairWeighted::sum_xy_centered ( void  ) const
Returns
$ \sum w_xw_y (x-m_x)(y-m_y) $ where m is calculated as $ m_x = \frac {\sum w_xw_yx}{\sum w} $
const AveragerWeighted& theplu::yat::statistics::AveragerPairWeighted::x_averager ( void  ) const
Note
the weights are calculated as $ w = w_x * w_y $
Returns
AveragerWeighted for x
const AveragerWeighted& theplu::yat::statistics::AveragerPairWeighted::y_averager ( void  ) const
Note
the weights are calculated as $ w = w_x * w_y $
Returns
AveragerWeighted for y

Friends And Related Function Documentation

template<class InputIterator1 , class InputIterator2 >
void add ( AveragerPairWeighted ap,
InputIterator1  first1,
InputIterator1  last1,
InputIterator2  first2 
)
related

adding a ranges of values to AveragerPairWeighted ap

Type Requirement:

template<typename InputIterator1 , typename InputIterator2 , typename InputIterator3 , typename InputIterator4 >
void add ( AveragerPairWeighted ap,
InputIterator1  x,
InputIterator1  xlast,
InputIterator2  y,
InputIterator3  wx,
InputIterator4  wy 
)
related

adding four ranges of values to AveragerPairWeighted ap

Iterators must be unweighted.

Type Requirement:


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

Generated on Tue Sep 26 2017 02:33:30 for yat by  doxygen 1.8.5