#include <bdlsta_moment.h>
This class provides efficient and accurate online algorithms for calculating mean, variance, skew, and kurtosis. The class provides template specializations, so that no unnecessary data members will be kept or unnecessary calculations done. The online algorithms used are Welford for variance, and the stable M3 and M4 are taken from: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Higher-order_statistics
The formula for sample skewness is taken from: http://www.macroption.com/skewness-formula/
The formula for sample excess kurtosis is taken from: http://www.macroption.com/kurtosis-formula/
See bdlsta_moment
◆ anonymous enum
Enumerator |
---|
e_SUCCESS | |
e_INADEQUATE_DATA | |
◆ add() [1/5]
◆ add() [2/5]
◆ add() [3/5]
◆ add() [4/5]
◆ add() [5/5]
◆ count()
◆ kurtosis() [1/2]
Return the kurtosis of the data set. The behavior is undefined unless 4 <= count
and the variance is not zero.
◆ kurtosis() [2/2]
◆ kurtosisIfValid() [1/2]
Load into the specified result
, the kurtosis of the data set. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA
is returned if 4 > count
or the variance is zero.
◆ kurtosisIfValid() [2/2]
◆ mean()
Return the mean of the data set. The behavior is undefined unless 1 <= count
.
◆ meanIfValid()
Load into the specified result
, the mean of the data set. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA
is returned if 1 > count
.
◆ skew()
Return skew of the data set. The behavior is undefined unless 3 <= count
or the variance is zero.
◆ skewIfValid()
Load into the specified result
, the skew of the data set. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA
is returned if 3 > count
or the variance is zero.
◆ variance()
Return the variance of the data set. The behavior is undefined unless 2 <= count
.
◆ varianceIfValid()
Load into the specified result
, the variance of the data set. Return 0 on success, and a non-zero value otherwise. Specifically, e_INADEQUATE_DATA
is returned if 2 > count
.
The documentation for this class was generated from the following file: