GeneralStatistics Class Reference
#include <ql/Math/generalstatistics.hpp>
Detailed Description
Statistics tool.This class accumulates a set of data and returns their statistics (e.g: mean, variance, skewness, kurtosis, error estimation, percentile, etc.) based on the empirical distribution (no gaussian assumption)
It doesn't suffer the numerical instability problem of IncrementalStatistics. The downside is that it stores all samples, thus increasing the memory requirements.
- Examples:
Public Member Functions | |
Inspectors | |
Size | samples () const |
number of samples collected | |
const std::vector< std::pair< Real, Real > > & | data () const |
collected data | |
Real | weightSum () const |
sum of data weights | |
Real | mean () const |
Real | variance () const |
Real | standardDeviation () const |
Real | errorEstimate () const |
Real | skewness () const |
Real | kurtosis () const |
Real | min () const |
Real | max () const |
template<class Func, class Predicate> | |
std::pair< Real, Size > | expectationValue (const Func &f, const Predicate &inRange) const |
Real | percentile (Real y) const |
Real | topPercentile (Real y) const |
Modifiers | |
void | add (Real value, Real weight=1.0) |
adds a datum to the set, possibly with a weight | |
template<class DataIterator> | |
void | addSequence (DataIterator begin, DataIterator end) |
adds a sequence of data to the set, with default weight | |
template<class DataIterator, class WeightIterator> | |
void | addSequence (DataIterator begin, DataIterator end, WeightIterator wbegin) |
adds a sequence of data to the set, each with its weight | |
void | reset () |
resets the data to a null set | |
void | sort () const |
sort the data set in increasing order |
Member Function Documentation
|
returns the mean, defined as
|
|
returns the variance, defined as
|
|
returns the standard deviation |
|
returns the error estimate on the mean value, defined as |
|
returns the skewness, defined as
The above evaluates to 0 for a Gaussian distribution. |
|
returns the excess kurtosis, defined as
The above evaluates to 0 for a Gaussian distribution. |
|
returns the minimum sample value |
|
returns the maximum sample value |
|
Expectation value of a function
The range is passed as a boolean function returning The function returns a pair made of the result and the number of observations in the given range. |
|
|
|
|
|
adds a datum to the set, possibly with a weight
|