8#if __has_include("defs.h")
23 void add (
double val);
25 void add (std::vector<double> v);
37 std::deque<double> values;
40 double sum, adev, var, sdev, skew, kurt;
46 if (nmax && values.size () == nmax)
48 sum -= values.front ();
51 values.push_back (val);
59 for (
int i = 0; i <
count; i++)
74 return sum / values.size ();
122 return (
int)values.size ();
Calculator for statistical parameters of a distribution.
Definition statpars.h:18
void clear()
Calculator reset.
Definition statpars.h:126
double variance()
Return distribution's variance (2nd order moment)
Definition statpars.h:80
double average()
Return distribution's average (first order moment)
Definition statpars.h:71
double skewness()
Return skewness (3rd order moment)
Definition statpars.h:104
double mad()
Return average absolute deviation also called "mean absolute deviation" (MAD)
Definition statpars.h:96
void add(double val)
Add a value to the calculator.
Definition statpars.h:44
double stdev()
Return standard deviation (square root of variance)
Definition statpars.h:88
int count()
Return number of samples.
Definition statpars.h:120
double kurtosis()
Return kurtosis (4th order moment)
Definition statpars.h:112