scicpp::stats::quantile, nanquantile

Defined in header <scicpp/core.hpp>

Compute the q-th quantile.

Interpolation method to use when the desired quantile 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 quantile(InputIt first, InputIt last, T q, Predicate filter)

Compute the q-th quantile 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 quantile(const Array &f, T q, Predicate filter)

Compute the q-th quantile of data in the array f satisfying the predicate filter.


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

Compute the q-th quantile of data in the array f.


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

Compute the q-th quantile of data in the array f excluding NaN’s.


See also
Scipy documentation