Inviwo  0.9.10.1
Inviwo documentation
inviwo::statsutil Namespace Reference

Classes

struct  RegresionResult
 

Functions

IVW_MODULE_PLOTTING_API RegresionResult linearRegresion (const BufferBase &X, const BufferBase &Y)
 
template<class Elem , class Traits >
std::basic_ostream< Elem, Traits > & operator<< (std::basic_ostream< Elem, Traits > &os, RegresionResult res)
 
template<typename T , typename std::enable_if<!util::is_floating_point< T >::value, int >::type = 0>
std::vector< T > percentiles (std::vector< T > data, const std::vector< double > &percentiles)
 Compute value below a percentage of observations in the data. Uses the nearest rank method, i.e. ceil(percentile * N), where N = number of elements in data. More...
 

Detailed Description

statsutil

Function Documentation

◆ percentiles()

template<typename T , typename std::enable_if<!util::is_floating_point< T >::value, int >::type = 0>
std::vector< T > inviwo::statsutil::percentiles ( std::vector< T >  data,
const std::vector< double > &  percentiles 
)

Compute value below a percentage of observations in the data. Uses the nearest rank method, i.e. ceil(percentile * N), where N = number of elements in data.

NaNs (Not a Numbers) are excluded from the computation. The following example will return {1,2}

auto percentiles = utilstats::percentiles({1, 0, 3, 2}, {0.25, 0.75});

See also https://en.wikipedia.org/wiki/Percentile

Parameters
datato compute percentiles on
percentilesin the range [0 1]
Returns
values below the percentage given by the percentiles.
Exceptions
Exceptionif any percentile is less than 0 or larger than 1