1 #ifndef _theplu_yat_statistics_averagerweighted_
2 #define _theplu_yat_statistics_averagerweighted_
28 #include "yat/utility/iterator_traits.h"
30 #include <boost/concept_check.hpp>
82 void add(
const double d,
const double w=1);
89 double mean(
void)
const;
102 double n(
void)
const;
122 double std(
void)
const;
142 double sum_w(
void)
const;
147 double sum_ww(
void)
const;
154 double sum_wx(
void)
const;
172 double variance(
const double m)
const;
196 double sum_wwx(
void)
const;
201 double sum_wwxx(
void)
const;
221 template <
typename InputIterator>
224 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>));
226 for ( ; first != last; ++first)
241 template <
typename InputIterator1,
typename InputIterator2>
243 InputIterator2 first2)
245 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator1>));
246 BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator2>));
249 for ( ; first1 != last1; ++first1, ++first2)
250 a.
add(*first1, *first2);
double sum_ww(void) const
data_reference data(Iter iter) const
Definition: iterator_traits.h:440
double sum_xx_centered(void) const
Definition: iterator_traits.h:412
double mean(void) const
Calculate the weighted mean.
double standard_error(void) const
Calculates standard deviation of the mean().
void add(AveragerWeighted &a, InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
add values from two ranges to AveragerWeighted a
Definition: AveragerWeighted.h:242
Class to calulate averages with weights.
Definition: AveragerWeighted.h:65
void add(const double d, const double w=1)
double std(void) const
The standard deviation is defined as the square root of the variance().
double sum_wx(void) const
double n(void) const
Weighted version of number of data points.
void check_iterator_is_unweighted(Iter iter)
check (at compile time) that iterator is unweighted.
Definition: iterator_traits.h:200
void reset(void)
Reset everything to zero.
const AveragerWeighted & operator+=(const AveragerWeighted &)
double sum_wxx(void) const
weight_reference weight(Iter iter) const
Definition: iterator_traits.h:446
double variance(void) const
AveragerWeighted(void)
The default constructor.
void add(AveragerWeighted &a, InputIterator first, InputIterator last)
adding a range of values to AveragerWeighted a
Definition: AveragerWeighted.h:222
void rescale(double a)
Rescale object.