32 return boost::accumulators::extract_result<
33 boost::accumulators::tag::count>(
acc_);
37 return boost::accumulators::extract_result<
38 boost::accumulators::tag::sum_of_weights>(
acc_);
43 return boost::accumulators::extract_result<
44 boost::accumulators::tag::weighted_mean>(
acc_);
51 return n / (
n - 1.0) *
52 boost::accumulators::extract_result<
53 boost::accumulators::tag::weighted_variance>(
acc_);
68 Real r2 = (
n - 1.0) / (
n - 2.0);
69 return std::sqrt(r1 * r2) *
70 boost::accumulators::extract_result<
71 boost::accumulators::tag::weighted_skewness>(
acc_);
76 "sample number <= 3, unsufficient");
77 boost::accumulators::extract_result<
78 boost::accumulators::tag::weighted_kurtosis>(
acc_);
80 Real r1 = (
n - 1.0) / (
n - 2.0);
81 Real r2 = (
n + 1.0) / (
n - 3.0);
82 Real r3 = (
n - 1.0) / (
n - 3.0);
83 return ((3.0 + boost::accumulators::extract_result<
84 boost::accumulators::tag::weighted_kurtosis>(
acc_)) *
92 return boost::accumulators::extract_result<
93 boost::accumulators::tag::min>(
acc_);
98 return boost::accumulators::extract_result<
99 boost::accumulators::tag::max>(
acc_);
103 return boost::accumulators::extract_result<
108 return boost::accumulators::extract_result<
109 boost::accumulators::tag::sum_of_weights>(
downsideAcc_);
118 boost::accumulators::extract_result<
127 QL_REQUIRE(valueWeight >= 0.0,
"negative weight (" << valueWeight
129 acc_(value, boost::accumulators::weight = valueWeight);
131 downsideAcc_(value, boost::accumulators::weight = valueWeight);
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
Real errorEstimate() const
Real standardDeviation() const
Real downsideWeightSum() const
sum of data weights for negative samples
void reset()
resets the data to a null set
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container
statistics tool based on incremental accumulation in the meantime, this is just a wrapper to the boos...