MLIB
Loading...
Searching...
No Matches
mlib::statpars Class Reference

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ statpars() [1/2]

mlib::statpars::statpars ( int  n = 0)

Constructor for calculator class.

Parameters
nnumber of samples. If not 0, only the last n samples are used for computations.

◆ statpars() [2/2]

mlib::statpars::statpars ( std::vector< double >  vec)

Constructor for calculator class.

Parameters
vecvector of samples.

The documentation for this class was generated from the following files: