The stat module has some basic statistical functions and the StatTracker type, which watches a series of samples, keeps some simple summary statistics (sum and sumSquare in the current implementation), and can report on the mean, variance, stdev, etc. of the sample.
Go to the source code of this file.
Data Structures  
struct  _StatTracker_ 
Holds simple summary statistics of a sample. More...  
Typedefs  
typedef _StatTracker_  StatTrackerStruct 
Holds simple summary statistics of a sample.  
typedef _StatTracker_ *  StatTracker 
Holds simple summary statistics of a sample.  
Functions  
StatTracker  StatTrackerNew (void) 
Creates a new stat tracker that is ready to have samples added to it.  
void  StatTrackerFree (StatTracker st) 
Frees the memory associated with the StatTracker.  
void  StatTrackerAddSample (StatTracker st, double x) 
Records the sample in the tracker.  
double  StatTrackerGetMean (StatTracker st) 
Returns the mean of the samples that have been shown to the tracker.  
double  StatTrackerGetVariance (StatTracker st) 
Returns the variance of the samples that have been shown to the tracker.  
double  StatTrackerGetStdev (StatTracker st) 
Returns the standard deviation of the samples that have been shown to the tracker.  
long  StatTrackerGetNumSamples (StatTracker st) 
Returns the number of samples shown to the stat tracker.  
double  StatTrackerGetNormalBound (StatTracker st, double delta) 
Assume Gaussian and return a high confidence bound of the sample .  
double  StatGetNormalBound (double variance, long n, double delta) 
Return a high confidence bound from the normal distribution.  
double  StatHoeffdingBoundOne (double range, double delta, long n) 
Returns the one sided Hoeffding bound.  
double  StatHoeffdingBoundTwo (double range, double delta, long n) 
Returns the two sided Hoeffding bound.  
float  StatLogGamma (float xx) 
Returns the log of the gamma function of xx. 

Holds simple summary statistics of a sample. See stats.h for more detail. 

Holds simple summary statistics of a sample. See stats.h for more detail. 

Return a high confidence bound from the normal distribution. Assumes a Gaussian distribution and returns the distance from the mean within which 1  delta of the mass lies (esentially the same function as StatTrackerGetNormalBound). 

Returns the one sided Hoeffding bound. With n observations of a variable with the specified range. That is, the true value is less than the observed mean + this function's result with probability 1  delta. 

Returns the two sided Hoeffding bound. With n observations of a variable with the specified range. That is, the true value is within this function's result of the obseved mean with probability 1  delta. 

Returns the log of the gamma function of xx. This function is lifted from Numerical Recipes in C. 

Records the sample in the tracker.


Frees the memory associated with the StatTracker.


Returns the mean of the samples that have been shown to the tracker. If you have not shown the tracker any samples this will probably crash. 

Assume Gaussian and return a high confidence bound of the sample . Assumes a Gaussian distribution and returns the distance from the mean within which 1  delta of the mass lies. This calls the GetStdev function internally and will crash if that crashes. 

Returns the number of samples shown to the stat tracker.


Returns the standard deviation of the samples that have been shown to the tracker. If you have not shown the tracker at least two samples this will probably crash. 

Returns the variance of the samples that have been shown to the tracker. If you have not shown the tracker at least two samples this will probably crash. 

Creates a new stat tracker that is ready to have samples added to it.
