3 #ifdef ANNOTATED_QUANTILES 5 #include <boost/accumulators/statistics/p_square_quantile.hpp> 6 #include <boost/accumulators/statistics/extended_p_square_quantile.hpp> 7 using namespace boost::accumulators;
9 typedef accumulator_set<double, stats<tag::p_square_quantile> > quantile_accu_t;
10 typedef accumulator_set<double, stats<tag::extended_p_square_quantile(quadratic)> > accumulator_t_quadratic;
12 struct SpectrumLevelScoreQuantiles
14 SpectrumLevelScoreQuantiles():
15 acc_(extended_p_square_probabilities =
std::vector<
double>{ 0.0, 0.25, 0.5, 0.75, 0.9, 0.95, 0.99, 0.999, 0.9999, 0.99999, 1.00 })
18 void insert(
double v) { acc_(v); }
20 double quantileOfValue(
double v)
24 double mid = l + (
h - l) / 2.0;
25 double p_value =
quantile(acc_, quantile_probability = mid);
28 while (fabs(p_value - v) > 0.01 && iter < 100)
30 mid = l + (
h - l) / 2.0;
31 p_value =
quantile(acc_, quantile_probability = mid);
45 accumulator_t_quadratic acc_;
T1::value_type quantile(const T1 &x, double q)
Returns the value of the q th quantile (0-1) in a sorted non-empty vector x.
Definition: MathFunctions.h:389
const double h
Definition: Constants.h:167