Main Page | Modules | Data Structures | File List | Globals | Related Pages

stats.h File Reference


Detailed Description

Some statistical functions.

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.

Wish List:
The StatTracker would track more interesting things.

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.


Typedef Documentation

typedef struct _StatTracker_ * StatTracker
 

Holds simple summary statistics of a sample.

See stats.h for more detail.

typedef struct _StatTracker_ StatTrackerStruct
 

Holds simple summary statistics of a sample.

See stats.h for more detail.


Function Documentation

double StatGetNormalBound double  variance,
long  n,
double  delta
 

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).

double StatHoeffdingBoundOne double  range,
double  delta,
long  n
 

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.

double StatHoeffdingBoundTwo double  range,
double  delta,
long  n
 

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.

float StatLogGamma float  xx  ) 
 

Returns the log of the gamma function of xx.

This function is lifted from Numerical Recipes in C.

void StatTrackerAddSample StatTracker  st,
double  x
 

Records the sample in the tracker.

void StatTrackerFree StatTracker  st  ) 
 

Frees the memory associated with the StatTracker.

double StatTrackerGetMean StatTracker  st  ) 
 

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.

double StatTrackerGetNormalBound StatTracker  st,
double  delta
 

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.

long StatTrackerGetNumSamples StatTracker  st  ) 
 

Returns the number of samples shown to the stat tracker.

double StatTrackerGetStdev StatTracker  st  ) 
 

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.

double StatTrackerGetVariance StatTracker  st  ) 
 

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.

StatTracker StatTrackerNew void   ) 
 

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


Generated for VFML by doxygen hosted by SourceForge.net Logo