Skip to content

Namespace stats

Namespace List > stats

Public Functions

Type Name
double mean (const std::vector< T > & x)
double median (const std::vector< T > & x)
double quantile (std::vector< T > x, double q)
double sd (const std::vector< T > & x)
double variance (const std::vector< T > & x)

Public Functions Documentation

function mean

template<typename  T>
inline double stats::mean (
    const std::vector< T > & x
) 

Mean of x, accumulated in double (NaN if empty).


function median

template<typename  T>
inline double stats::median (
    const std::vector< T > & x
) 

Median of x (NaN if empty).


function quantile

template<typename  T>
inline double stats::quantile (
    std::vector< T > x,
    double q
) 

Quantile q in [0, 1] of x, interpolating linearly between the order statistics (R's type 7). NaN if x is empty. The vector is taken by value and sorted.


function sd

template<typename  T>
inline double stats::sd (
    const std::vector< T > & x
) 

Sample standard deviation of x.


function variance

template<typename  T>
inline double stats::variance (
    const std::vector< T > & x
) 

Sample variance of x, with the n - 1 denominator (NaN if n < 2).



The documentation for this class was generated from the following file include/stats/stats.hpp