This class computes the power sums of a list of numbers and computes various statistical values based upon these sums. This is a generalization of the Stats class that supports the higher-order moments. See http://mathworld.wolfram.com/PowerSum.html for a discussion of this approach.
Definition at line 57 of file PowerSum.hpp.
#include <PowerSum.hpp>
Public Types | |
typedef std::list< double >::const_iterator | dlc_iterator |
Public Member Functions | |
void | add (dlc_iterator b, dlc_iterator e) noexcept |
Adds all value in the list to the sums. More... | |
void | add (double x) noexcept |
Add a single value to the sums. More... | |
double | average () const noexcept |
Computes the indicated value. More... | |
void | clear () noexcept |
Reset all sums. More... | |
void | dump (std::ostream &str) const noexcept |
double | kurtosis () const noexcept |
double | moment (int i) const noexcept |
Computes the ith order central moment. More... | |
PowerSum () | |
long | size () const noexcept |
Reuturn the number of points in the current sum. More... | |
double | skew () const noexcept |
void | subtract (dlc_iterator b, dlc_iterator e) noexcept |
void | subtract (double x) noexcept |
double | variance () const noexcept |
Static Public Attributes | |
const static int | order = 5 |
Private Attributes | |
long | n |
double | s [order+1] |
typedef std::list<double>::const_iterator gnsstk::PowerSum::dlc_iterator |
Definition at line 77 of file PowerSum.hpp.
|
inline |
Definition at line 60 of file PowerSum.hpp.
|
noexcept |
Adds all value in the list to the sums.
Definition at line 67 of file PowerSum.cpp.
|
noexcept |
Add a single value to the sums.
Definition at line 51 of file PowerSum.cpp.
|
noexcept |
Computes the indicated value.
Definition at line 107 of file PowerSum.cpp.
|
noexcept |
Reset all sums.
Definition at line 44 of file PowerSum.cpp.
|
noexcept |
Definition at line 137 of file PowerSum.cpp.
|
noexcept |
Definition at line 129 of file PowerSum.cpp.
|
noexcept |
Computes the ith order central moment.
See http://mathworld.wolfram.com/SampleCentralMoment.html for computing the central moments from the power sums.
Definition at line 83 of file PowerSum.cpp.
|
inlinenoexcept |
Reuturn the number of points in the current sum.
Definition at line 90 of file PowerSum.hpp.
|
noexcept |
Definition at line 122 of file PowerSum.cpp.
|
noexcept |
Removes all values in the list from the sums. See the warning with the subtract(double) method.
Definition at line 74 of file PowerSum.cpp.
|
noexcept |
Remove a single value from the sums. Note that the higher order sums can get quite large in magnitude. When removing a value that is far from the average, it is possible for numerical error to creep into the sums. One way around this is to simply recompute the sums from scratch when this happens.
Definition at line 59 of file PowerSum.cpp.
|
noexcept |
Definition at line 115 of file PowerSum.cpp.
|
private |
Definition at line 102 of file PowerSum.hpp.
|
static |
Definition at line 62 of file PowerSum.hpp.
|
private |
Definition at line 101 of file PowerSum.hpp.