28#ifndef quantlib_incremental_statistics_hpp
29#define quantlib_incremental_statistics_hpp
33#include <boost/accumulators/accumulators.hpp>
34#include <boost/accumulators/statistics/stats.hpp>
35#include <boost/accumulators/statistics/count.hpp>
36#include <boost/accumulators/statistics/sum.hpp>
37#include <boost/accumulators/statistics/min.hpp>
38#include <boost/accumulators/statistics/max.hpp>
39#include <boost/accumulators/statistics/weighted_mean.hpp>
40#include <boost/accumulators/statistics/weighted_variance.hpp>
41#include <boost/accumulators/statistics/weighted_skewness.hpp>
42#include <boost/accumulators/statistics/weighted_kurtosis.hpp>
43#include <boost/accumulators/statistics/weighted_moment.hpp>
135 template <
class DataIterator>
137 for (;begin!=end;++begin)
142 template <
class DataIterator,
class WeightIterator>
144 WeightIterator wbegin) {
145 for (;begin!=end;++begin,++wbegin)
146 add(*begin, *wbegin);
152 typedef boost::accumulators::accumulator_set<
154 boost::accumulators::stats<
155 boost::accumulators::tag::count, boost::accumulators::tag::min,
156 boost::accumulators::tag::max,
157 boost::accumulators::tag::weighted_mean,
158 boost::accumulators::tag::weighted_variance,
159 boost::accumulators::tag::weighted_skewness,
160 boost::accumulators::tag::weighted_kurtosis,
161 boost::accumulators::tag::sum_of_weights>,
164 typedef boost::accumulators::accumulator_set<
165 Real, boost::accumulators::stats<
166 boost::accumulators::tag::count,
167 boost::accumulators::tag::weighted_moment<2>,
168 boost::accumulators::tag::sum_of_weights>,
Statistics tool based on incremental accumulation.
Size samples() const
number of samples collected
Size downsideSamples() const
number of negative samples collected
Real downsideVariance() const
Real weightSum() const
sum of data weights
downside_accumulator_set downsideAcc_
void add(Real value, Real weight=1.0)
adds a datum to the set, possibly with a weight
Real downsideDeviation() const
boost::accumulators::accumulator_set< Real, boost::accumulators::stats< boost::accumulators::tag::count, boost::accumulators::tag::weighted_moment< 2 >, boost::accumulators::tag::sum_of_weights >, Real > downside_accumulator_set
boost::accumulators::accumulator_set< Real, boost::accumulators::stats< boost::accumulators::tag::count, boost::accumulators::tag::min, boost::accumulators::tag::max, boost::accumulators::tag::weighted_mean, boost::accumulators::tag::weighted_variance, boost::accumulators::tag::weighted_skewness, boost::accumulators::tag::weighted_kurtosis, boost::accumulators::tag::sum_of_weights >, Real > accumulator_set
void addSequence(DataIterator begin, DataIterator end)
adds a sequence of data to the set, with default weight
Real errorEstimate() const
Real standardDeviation() const
Real downsideWeightSum() const
sum of data weights for negative samples
void addSequence(DataIterator begin, DataIterator end, WeightIterator wbegin)
adds a sequence of data to the set, each with its weight
void reset()
resets the data to a null set
Classes and functions for error handling.
std::size_t Size
size of a container