|
QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
|
Statistics tool based on incremental accumulation. More...
#include <incrementalstatistics.hpp>
Collaboration diagram for IncrementalStatistics:Public Types | |
| typedef Real | value_type |
Public Member Functions | |
| IncrementalStatistics () | |
Inspectors | |
| Size | samples () const |
| number of samples collected More... | |
| Real | weightSum () const |
| sum of data weights More... | |
| Real | mean () const |
| Real | variance () const |
| Real | standardDeviation () const |
| Real | errorEstimate () const |
| Real | skewness () const |
| Real | kurtosis () const |
| Real | min () const |
| Real | max () const |
| Size | downsideSamples () const |
| number of negative samples collected More... | |
| Real | downsideWeightSum () const |
| sum of data weights for negative samples More... | |
| Real | downsideVariance () const |
| Real | downsideDeviation () const |
Modifiers | |
| typedef boost::accumulators::accumulator_set< Real, boost::accumulators::stats< boost::accumulators::tag::count, boost::accumulators::tag::min, boost::accumulators::tag::max, boost::accumulators::tag::weighted_mean, boost::accumulators::tag::weighted_variance, boost::accumulators::tag::weighted_skewness, boost::accumulators::tag::weighted_kurtosis, boost::accumulators::tag::sum_of_weights >, Real > | accumulator_set |
| typedef boost::accumulators::accumulator_set< Real, boost::accumulators::stats< boost::accumulators::tag::count, boost::accumulators::tag::weighted_moment< 2 >, boost::accumulators::tag::sum_of_weights >, Real > | downside_accumulator_set |
| accumulator_set | acc_ |
| downside_accumulator_set | downsideAcc_ |
| void | add (Real value, Real weight=1.0) |
| adds a datum to the set, possibly with a weight More... | |
| template<class DataIterator > | |
| void | addSequence (DataIterator begin, DataIterator end) |
| adds a sequence of data to the set, with default weight More... | |
| 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 More... | |
| void | reset () |
| resets the data to a null set More... | |
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.). This class is a wrapper to the boost accumulator library.
Definition at line 53 of file incrementalstatistics.hpp.
| typedef Real value_type |
Definition at line 55 of file incrementalstatistics.hpp.
|
private |
Definition at line 162 of file incrementalstatistics.hpp.
|
private |
Definition at line 169 of file incrementalstatistics.hpp.
| Size samples | ( | ) | const |
number of samples collected
Definition at line 31 of file incrementalstatistics.cpp.
Here is the caller graph for this function:| Real weightSum | ( | ) | const |
sum of data weights
Definition at line 36 of file incrementalstatistics.cpp.
Here is the caller graph for this function:| Real mean | ( | ) | const |
returns the mean, defined as
\[ \langle x \rangle = \frac{\sum w_i x_i}{\sum w_i}. \]
Definition at line 41 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Real variance | ( | ) | const |
returns the variance, defined as
\[ \frac{N}{N-1} \left\langle \left( x-\langle x \rangle \right)^2 \right\rangle. \]
Definition at line 47 of file incrementalstatistics.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| Real standardDeviation | ( | ) | const |
returns the standard deviation \( \sigma \), defined as the square root of the variance.
Definition at line 56 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Real errorEstimate | ( | ) | const |
returns the error estimate \( \epsilon \), defined as the square root of the ratio of the variance to the number of samples.
Definition at line 60 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Real skewness | ( | ) | const |
returns the skewness, defined as
\[ \frac{N^2}{(N-1)(N-2)} \frac{\left\langle \left( x-\langle x \rangle \right)^3 \right\rangle}{\sigma^3}. \]
The above evaluates to 0 for a Gaussian distribution.
Definition at line 64 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Real kurtosis | ( | ) | const |
returns the excess kurtosis, defined as
\[ \frac{N^2(N+1)}{(N-1)(N-2)(N-3)} \frac{\left\langle \left(x-\langle x \rangle \right)^4 \right\rangle}{\sigma^4} - \frac{3(N-1)^2}{(N-2)(N-3)}. \]
The above evaluates to 0 for a Gaussian distribution.
Definition at line 74 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Real min | ( | ) | const |
returns the minimum sample value
Definition at line 90 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Real max | ( | ) | const |
returns the maximum sample value
Definition at line 96 of file incrementalstatistics.cpp.
Here is the call graph for this function:| Size downsideSamples | ( | ) | const |
number of negative samples collected
Definition at line 102 of file incrementalstatistics.cpp.
Here is the caller graph for this function:| Real downsideWeightSum | ( | ) | const |
sum of data weights for negative samples
Definition at line 107 of file incrementalstatistics.cpp.
Here is the caller graph for this function:| Real downsideVariance | ( | ) | const |
returns the downside variance, defined as
\[ \frac{N}{N-1} \times \frac{ \sum_{i=1}^{N} \theta \times x_i^{2}}{ \sum_{i=1}^{N} w_i} \]
, where \( \theta \) = 0 if x > 0 and \( \theta \) =1 if x <0
Definition at line 112 of file incrementalstatistics.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| Real downsideDeviation | ( | ) | const |
returns the downside deviation, defined as the square root of the downside variance.
Definition at line 122 of file incrementalstatistics.cpp.
Here is the call graph for this function:adds a datum to the set, possibly with a weight
Definition at line 126 of file incrementalstatistics.cpp.
Here is the caller graph for this function:| void addSequence | ( | DataIterator | begin, |
| DataIterator | end | ||
| ) |
adds a sequence of data to the set, with default weight
Definition at line 136 of file incrementalstatistics.hpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void addSequence | ( | DataIterator | begin, |
| DataIterator | end, | ||
| WeightIterator | wbegin | ||
| ) |
adds a sequence of data to the set, each with its weight
Definition at line 143 of file incrementalstatistics.hpp.
Here is the call graph for this function:| void reset | ( | ) |
resets the data to a null set
Definition at line 134 of file incrementalstatistics.cpp.
Here is the caller graph for this function:
|
private |
Definition at line 163 of file incrementalstatistics.hpp.
|
private |
Definition at line 170 of file incrementalstatistics.hpp.