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);
161 template <
class InputIterator1,
class InputIterator2>
163 InputIterator1 last1, InputIterator2 first2)
166 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator1>));
168 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator2>));
172 for ( ; first1 != last1; ++first1, ++first2) {
200 template <
typename InputIterator1,
typename InputIterator2
201 ,
typename InputIterator3,
typename InputIterator4>
203 InputIterator2 y, InputIterator3 wx, InputIterator4 wy)
205 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator1>));
206 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator1>));
207 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator2>));
208 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator2>));
209 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator3>));
210 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator3>));
211 BOOST_CONCEPT_ASSERT((boost_concepts::ReadableIterator<InputIterator4>));
212 BOOST_CONCEPT_ASSERT((boost_concepts::SinglePassIterator<InputIterator4>));
219 ap.
add(*x, *y, *wx, *wy);
data_reference data(Iter iter) const
Definition: iterator_traits.h:440
Concept check for Data Iterator.
Definition: concept_check.h:228
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:66
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:162
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:202
void reset(void)
Reset everything to zero.