#include <yat/statistics/Percentiler.h>
Public Member Functions | |
Percentiler (double perc=50, bool sorted=false) | |
template<typename RandomAccessIterator > | |
double | operator() (RandomAccessIterator first, RandomAccessIterator last) const |
theplu::yat::statistics::Percentiler::Percentiler | ( | double | perc = 50 , |
|
bool | sorted = false | |||
) |
perc | percentile to calculate [0,100]. Default value is 50, which implies class will calculate median. | |
sorted | if true class assumes that ranges are already sorted, if false the range will copied to a new range which is sorted. |
double theplu::yat::statistics::Percentiler::operator() | ( | RandomAccessIterator | first, | |
RandomAccessIterator | last | |||
) | const [inline] |
Function is a non-mutable function, i.e., first and last can be const_iterators.
The Nth percentile is defined such that, for example, when having four numbers , the Nth percentile is:
Similarily, if we have a weighted range , we calculate the accumulated normalized weight and the percentile is
Note, that data point with weight zero is completely ignored.
Requirements: RandomAccessIterator
should be a Data Iterator and Random Access Iterator