MLIB
|
Calculator for statistical parameters of a distribution. More...
#include <statpars.h>
Public Member Functions | |
statpars (int nmax=0) | |
Constructor for calculator class. | |
statpars (std::vector< double > vec) | |
Constructor for calculator class. | |
void | add (double val) |
Add a value to the calculator. | |
void | add (double *vals, int count) |
Add multiple values to calculator. | |
void | add (std::vector< double > v) |
Add a vector of values. | |
void | clear () |
Calculator reset. | |
int | count () |
Return number of samples. | |
double | average () |
Return distribution's average (first order moment) | |
double | stdev () |
Return standard deviation (square root of variance) | |
double | mad () |
Return average absolute deviation also called "mean absolute deviation" (MAD) | |
double | variance () |
Return distribution's variance (2nd order moment) | |
double | skewness () |
Return skewness (3rd order moment) | |
double | kurtosis () |
Return kurtosis (4th order moment) | |
Calculator for statistical parameters of a distribution.
Use one of the add() functions to add new values to the calculator.
Then you can call one of the functions that return a statistical parameter (average, variance, etc.). When one of these functions is called, all the other parameters are also computed. The computation is valid until a new value is added to the calculator.
If the calculator object was constructed with a limited number of samples, only the last "n" samples are used to compute the statistical parameters.
mlib::statpars::statpars | ( | int | n = 0 | ) |
Constructor for calculator class.
n | number of samples. If not 0, only the last n samples are used for computations. |
mlib::statpars::statpars | ( | std::vector< double > | vec | ) |
Constructor for calculator class.
vec | vector of samples. |