Sequential conventional statistics for one sample; gives results identical to class Stats except there is no scaling. This class maintains a current average and variance with each Add(); thus it is more efficient when results at each step are accessed - use this class when stats are to be accessed often, e.g. after each Add(). Class Stats holds sum(x) and sum(x squared) and computes ave, sig etc on call. NB. class WtdStats (weighted stats) derives from this class.
#include <Stats.hpp>
Public Member Functions | |
void | Add (const T &x) |
void | Add (std::vector< T > &X) |
add a std::vector<T> of samples to the computation of statistics More... | |
void | Add (Vector< T > &X) |
add a gnsstk::Vector<T> of samples to the computation of statistics More... | |
std::string | asShortString (std::string msg=std::string(), int w=0, int p=3) const |
Write SeqStats N,ave,sig to a short single-line string. More... | |
std::string | asString (std::string msg=std::string(), int w=7, int p=4) const |
Write SeqStats to a single-line string. More... | |
T | Average (void) const |
return computed average More... | |
void | Dump (std::vector< unsigned int > &vuint, std::vector< T > &vT) |
void | Load (const std::vector< unsigned int > &vuint, const std::vector< T > &vT) |
T | Maximum (void) const |
return maximum value More... | |
T | Minimum (void) const |
return minimum value More... | |
unsigned int | N (void) const |
return the sample size More... | |
SeqStats< T > & | operator+= (const SeqStats< T > &S) |
combine two SeqStats (assumed taken from the same or equivalent ensembles); More... | |
SeqStats< T > & | operator-= (const SeqStats< T > &S) |
void | Reset (void) |
reset, i.e. ignore earlier data and restart sampling More... | |
SeqStats () | |
constructor More... | |
SeqStats (Vector< T > &X) | |
constructor given a gnsstk::Vector<T> of data More... | |
T | StdDev (void) const |
return computed standard deviation More... | |
void | Subtract (const T x) |
void | Subtract (std::vector< T > &X) |
void | Subtract (Vector< T > &X) |
T | Variance (void) const |
return computed variance More... | |
Protected Attributes | |
T | ave |
Average value. More... | |
T | max |
Maximum value. More... | |
T | min |
Minimum value. More... | |
unsigned int | n |
number of samples added to the statistics More... | |
T | var |
Variance (square of the standard deviation) More... | |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Define SeqStats private members directly; useful in continuing with an object that was earlier saved (e.g. to a file) using Dump().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |