IncrementalStatistics Class Reference#include <ql/Math/incrementalstatistics.hpp>
List of all members.
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 |
|
|
Size | samples () const |
| | number of samples collected
|
|
double | weightSum () const |
| | sum of data weights
|
| double | mean () const |
| double | variance () const |
| double | standardDeviation () const |
| double | downsideVariance () const |
| double | downsideDeviation () const |
| double | errorEstimate () const |
| double | skewness () const |
| double | kurtosis () const |
| double | min () const |
| double | max () const |
|
| void | add (double value, double 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_ |
|
double | sampleWeight_ |
|
double | downsideSampleWeight_ |
|
double | sum_ |
|
double | quadraticSum_ |
|
double | downsideQuadraticSum_ |
|
double | cubicSum_ |
|
double | fourthPowerSum_ |
|
double | min_ |
|
double | max_ |
Member Function Documentation
|
|
returns the mean, defined as
|
| double variance |
( |
|
) |
const |
|
|
|
returns the variance, defined as
|
| double standardDeviation |
( |
|
) |
const |
|
|
|
returns the standard deviation , defined as the square root of the variance. |
| double downsideVariance |
( |
|
) |
const |
|
|
|
returns the downside variance, defined as
, where = 0 if x > 0 and =1 if x <0 |
| double downsideDeviation |
( |
|
) |
const |
|
|
|
returns the downside deviation, defined as the square root of the downside variance. |
| double errorEstimate |
( |
|
) |
const |
|
|
|
returns the error estimate , defined as the square root of the ratio of the variance to the number of samples. |
| double skewness |
( |
|
) |
const |
|
|
|
returns the skewness, defined as
The above evaluates to 0 for a Gaussian distribution. |
| double kurtosis |
( |
|
) |
const |
|
|
|
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 |
| void add |
( |
double |
value, |
|
|
double |
weight = 1.0 |
|
) |
|
|
|
|
adds a datum to the set, possibly with a weight
- Precondition:
- weight must be positive or null
|
| void addSequence |
( |
DataIterator |
begin, |
|
|
DataIterator |
end, |
|
|
WeightIterator |
wbegin |
|
) |
|
|
|
|
adds a sequence of data to the set, each with its weight
- Precondition:
- weights must be positive or null
|
|