scicpp::stats::percentile, nanpercentile

Defined in header <scicpp/core.hpp>

Compute the p-th percentile.

Interpolation method to use when the desired percentile lies between two data points i < j:

enum class QuantileInterp : int {
    LOWER,    // i
    HIGHER,   // j
    NEAREST,  // i or j, whichever is nearest.
    MIDPOINT, // (i + j) / 2.
    LINEAR    // i + (j - i) * fraction, where fraction is the fractional part of the index surrounded by i and j.
};

template<QuantileInterp interpolation = QuantileInterp::LINEAR, class InputIt, class Predicate, typename T>
auto percentile(InputIt first, InputIt last, T q, Predicate filter)

Compute the p-th percentile of data defined by a pair of iterators first, last satisfying the predicate filter.


template<QuantileInterp interpolation = QuantileInterp::LINEAR, class Array, class Predicate, typename T>
auto percentile(const Array &f, T q, Predicate filter)

Compute the p-th percentile of data in the array f satisfying the predicate filter.


template<QuantileInterp interpolation = QuantileInterp::LINEAR, class Array, typename T>
auto percentile(Array &&f, T q)

Compute the p-th percentile of data in the array f.


template<QuantileInterp interpolation = QuantileInterp::LINEAR, class Array, typename T>
auto nanpercentile(const Array &f, T q)

Compute the p-th percentile of data in the array f excluding NaN’s.


See also
Scipy documentation