1 #ifndef _theplu_yat_statistics_averagerpairweighted_
2 #define _theplu_yat_statistics_averagerpairweighted_
28 #include "AveragerWeighted.h"
30 #include "yat/utility/iterator_traits.h"
31 #include "yat/utility/yat_assert.h"
33 #include <boost/concept_check.hpp>
70 void add(
const double x,
const double y,
71 const double wx,
const double wy);
91 double msd(
void)
const;
106 double sum_w(
void)
const;
111 double sum_xy(
void)
const;
145 double wxy_centered_;
147 void xy_add(
double mx,
double my,
double xy_centered,
double w);
155 template <
class InputIterator1,
class InputIterator2>
157 InputIterator1 last1, InputIterator2 first2)
159 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator1>));
160 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator2>));
163 for ( ; first1 != last1; ++first1, ++first2) {
177 template <
typename InputIterator1,
typename InputIterator2
178 ,
typename InputIterator3,
typename InputIterator4>
180 InputIterator2 y, InputIterator3 wx, InputIterator4 wy)
182 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator1>));
183 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator2>));
184 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator3>));
185 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator4>));
191 ap.
add(*x, *y, *wx, *wy);
data_reference data(Iter iter) const
Definition: iterator_traits.h:440
Definition: iterator_traits.h:412
const AveragerWeighted & x_averager(void) const
double covariance(void) const
Class for taking care of mean and covariance of two variables in a weighted manner.
Definition: AveragerPairWeighted.h:56
double sum_xy_centered(void) const
const AveragerPairWeighted & operator+=(const AveragerPairWeighted &)
Addition assignment operator.
Class to calulate averages with weights.
Definition: AveragerWeighted.h:65
double correlation(void) const
Pearson correlation coefficient.
double sum_xy(void) const
void add(AveragerPairWeighted &ap, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
adding a ranges of values to AveragerPairWeighted ap
Definition: AveragerPairWeighted.h:156
const AveragerWeighted & y_averager(void) const
void check_iterator_is_unweighted(Iter iter)
check (at compile time) that iterator is unweighted.
Definition: iterator_traits.h:200
AveragerPairWeighted(void)
The default constructor.
void add(const double x, const double y, const double wx, const double wy)
weight_reference weight(Iter iter) const
Definition: iterator_traits.h:446
void add(AveragerPairWeighted &ap, InputIterator1 x, InputIterator1 xlast, InputIterator2 y, InputIterator3 wx, InputIterator4 wy)
adding four ranges of values to AveragerPairWeighted ap
Definition: AveragerPairWeighted.h:179
void reset(void)
Reset everything to zero.