IncrementalStatistics Class Reference
#include <ql/Math/incrementalstatistics.hpp>
Detailed Description
Statistics tool based on incremental accumulation.It can accumulate a set of data and return statistics (e.g: mean, variance, skewness, kurtosis, error estimation, etc.)
- Warning:
- high moments are numerically unstable for high average/standardDeviation ratios.
Public Member Functions | |
Inspectors | |
Size | samples () const |
number of samples collected | |
Real | weightSum () const |
sum of data weights | |
Real | mean () const |
Real | variance () const |
Real | standardDeviation () const |
Real | downsideVariance () const |
Real | downsideDeviation () const |
Real | errorEstimate () const |
Real | skewness () const |
Real | kurtosis () const |
Real | min () const |
Real | max () 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 | |
Protected Attributes | |
Size | sampleNumber_ |
Size | downsideSampleNumber_ |
Real | sampleWeight_ |
Real | downsideSampleWeight_ |
Real | sum_ |
Real | quadraticSum_ |
Real | downsideQuadraticSum_ |
Real | cubicSum_ |
Real | fourthPowerSum_ |
Real | min_ |
Real | max_ |
Member Function Documentation
|
returns the mean, defined as
|
|
returns the variance, defined as
|
|
returns the standard deviation |
|
returns the downside variance, defined as
, where |
|
returns the downside deviation, defined as the square root of the downside variance. |
|
returns the error estimate |
|
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 |
|
adds a datum to the set, possibly with a weight
|
|
adds a sequence of data to the set, each with its weight
|