OpenMS
StatisticFunctions.h File Reference
#include <vector>
#include <OpenMS/CONCEPT/Exception.h>
#include <OpenMS/CONCEPT/Macros.h>
#include <OpenMS/CONCEPT/Types.h>
#include <OpenMS/DATASTRUCTURES/String.h>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <numeric>
Include dependency graph for StatisticFunctions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AdaptiveQuantileResult
 Result of adaptiveQuantile computation. More...
 
struct  SummaryStatistics< T >
 Helper class to gather (and dump) some statistics from a e.g. vector<double>. More...
 

Namespaces

 OpenMS
 Main OpenMS namespace.
 
 OpenMS::Math
 Math namespace.
 

Functions

template<typename IteratorType >
static void checkIteratorsNotNULL (IteratorType begin, IteratorType end)
 Helper function checking if two iterators are not equal. More...
 
template<typename IteratorType >
static void checkIteratorsEqual (IteratorType begin, IteratorType end)
 Helper function checking if two iterators are equal. More...
 
template<typename IteratorType1 , typename IteratorType2 >
static void checkIteratorsAreValid (IteratorType1 begin_b, IteratorType1 end_b, IteratorType2 begin_a, IteratorType2 end_a)
 Helper function checking if an iterator and a co-iterator both have a next element. More...
 
template<typename IteratorType >
static double sum (IteratorType begin, IteratorType end)
 Calculates the sum of a range of values. More...
 
template<typename IteratorType >
static double mean (IteratorType begin, IteratorType end)
 Calculates the mean of a range of values. More...
 
template<typename IteratorType >
static double median (IteratorType begin, IteratorType end, bool sorted=false)
 Calculates the median of a range of values. More...
 
template<typename IteratorType >
double MAD (IteratorType begin, IteratorType end, double median_of_numbers)
 median absolute deviation (MAD) More...
 
template<typename IteratorType >
double MeanAbsoluteDeviation (IteratorType begin, IteratorType end, double mean_of_numbers)
 mean absolute deviation (MeanAbsoluteDeviation) More...
 
template<typename IteratorType >
static double quantile1st (IteratorType begin, IteratorType end, bool sorted=false)
 Calculates the first quantile of a range of values. More...
 
template<typename IteratorType >
static double quantile3rd (IteratorType begin, IteratorType end, bool sorted=false)
 Calculates the third quantile of a range of values. More...
 
template<typename IteratorType >
static double quantile (IteratorType begin, IteratorType end, double q)
 Calculates the q-quantile (0 <= q <= 1) of a sorted range of values. More...
 
template<typename IteratorType >
double tukeyUpperFence (IteratorType begin, IteratorType end, double k=1.5)
 Tukey upper fence (UF) for outlier detection. More...
 
template<typename IteratorType >
double tailFractionAbove (IteratorType begin, IteratorType end, double threshold)
 Fraction of values above a threshold. More...
 
template<typename IteratorType >
double winsorizedQuantile (IteratorType begin, IteratorType end, double q, double upper_fence)
 Quantile after winsorizing at an upper fence. More...
 
template<typename IteratorType >
AdaptiveQuantileResult adaptiveQuantile (IteratorType begin, IteratorType end, double q, double k=1.5, double r_sparse=0.01, double r_dense=0.10)
 Adaptive quantile that blends RAW and IQR-winsorized quantiles based on tail density beyond the Tukey upper fence. More...
 
template<typename IteratorType >
static double variance (IteratorType begin, IteratorType end, double mean=std::numeric_limits< double >::max())
 
template<typename IteratorType >
static double sd (IteratorType begin, IteratorType end, double mean=std::numeric_limits< double >::max())
 Calculates the standard deviation of a range of values. More...
 
template<typename IteratorType >
static double absdev (IteratorType begin, IteratorType end, double mean=std::numeric_limits< double >::max())
 Calculates the absolute deviation of a range of values. More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double covariance (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 Calculates the covariance of two ranges of values. More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double meanSquareError (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 Calculates the mean square error for the values in [begin_a, end_a) and [begin_b, end_b) More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double rootMeanSquareError (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 Calculates the root mean square error (RMSE) for the values in [begin_a, end_a) and [begin_b, end_b) More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double classificationRate (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 Calculates the classification rate for the values in [begin_a, end_a) and [begin_b, end_b) More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double matthewsCorrelationCoefficient (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 Calculates the Matthews correlation coefficient for the values in [begin_a, end_a) and [begin_b, end_b) More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double pearsonCorrelationCoefficient (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 Calculates the Pearson correlation coefficient for the values in [begin_a, end_a) and [begin_b, end_b) More...
 
template<typename Value >
static void computeRank (std::vector< Value > &w)
 Replaces the elements in vector w by their ranks. More...
 
template<typename IteratorType1 , typename IteratorType2 >
static double rankCorrelationCoefficient (IteratorType1 begin_a, IteratorType1 end_a, IteratorType2 begin_b, IteratorType2 end_b)
 calculates the rank correlation coefficient for the values in [begin_a, end_a) and [begin_b, end_b) More...
 

Class Documentation

◆ OpenMS::Math::AdaptiveQuantileResult

struct OpenMS::Math::AdaptiveQuantileResult

Result of adaptiveQuantile computation.

Fields:

  • blended : the final blended (adaptive) quantile
  • half_raw : raw q-quantile of values
  • half_rob : q-quantile after IQR-winsorization
  • upper_fence : Tukey upper fence (Q3 + k*IQR), +inf if undefined
  • tail_fraction : fraction of values above upper_fence
  • weight : blend weight w in [0,1] (0=robust, 1=raw)
Collaboration diagram for AdaptiveQuantileResult:
[legend]
Class Members
double blended
double half_raw
double half_rob
double tail_fraction
double upper_fence
double weight