yat  0.21pre
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

◆ add()

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

◆ correlation()

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} $

◆ covariance()

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} $

◆ msd()

double theplu::yat::statistics::AveragerPairWeighted::msd ( void  ) const
Returns
$ \frac{\sum w_xw_y(x-y)^2}{\sum w_xw_y} $

◆ n()

double theplu::yat::statistics::AveragerPairWeighted::n ( void  ) const
Returns
$ \frac{\left(\sum w_x w_y\right)^2}{\sum w_x^2w_y^2} $

◆ operator+=()

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

Addition assignment operator.

Returns
resulting AveragerPairWeighted
Since
New in yat 0.8

◆ sum_w()

double theplu::yat::statistics::AveragerPairWeighted::sum_w ( void  ) const
Returns
$ \sum w_xw_y $

◆ sum_xy()

double theplu::yat::statistics::AveragerPairWeighted::sum_xy ( void  ) const
Returns
$ \sum w_xw_yxy $

◆ sum_xy_centered()

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} $

◆ x_averager()

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

◆ y_averager()

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

◆ add() [1/2]

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:

◆ add() [2/2]

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 Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14