我使用boost::accumulators::tag::extended_p_square_quantile
来计算百分位数。在这里,我还需要将概率提供给累加器,所以我做了m_acc = AccumulatorType(boost::accumulators::extended_p_square_probabilities = probs);
,其中probs是包含概率的向量。
概率向量中的值为{0.5,0.3,0.9,0.7}
我为累加器提供了一些示例值。
但是当我尝试使用boost::accumulators::quantile(m_acc, boost::accumulators::quantile_probability = probs[0]);
获取百分位数时,它会返回不正确的值,有时甚至是纳米。
这里有什么问题?
答案 0 :(得分:0)
我遇到了这个问题,浪费了很多时间来解决问题,因此想要回答这个问题。
问题在于矢量。矢量应按其值的递增顺序缩短。
将矢量值更改为此{0.3,0.5,0.7,0.9}
,它将按预期工作。
因此,如果有人使用tag::extended_p_square_quantile
获取百分位数(支持多个概率),那么他需要按排序顺序给出概率(向量/数组/列表)。
tag::p_square_quantile
不是这种情况,因为我们只能给出一个值(概率)。