Package lib :: Module statistics
[hide private]
[frames] | no frames]

Module statistics

source code

Module for calculating simple statistics.

Functions [hide private]
list of lists of float
bucket(values=None, lower=0.0, upper=200.0, inc=100, verbose=False)
Generate a discrete probability distribution for the given values.
source code
float
gaussian(x=None, mu=0.0, sigma=1.0)
Calculate the probability for a Gaussian probability distribution for a given x value.
source code
float
std(values=None, skip=None, dof=1)
Calculate the standard deviation of the given values, skipping values if asked.
source code
Variables [hide private]
  __package__ = 'lib'

Imports: exp, pi, sqrt


Function Details [hide private]

bucket(values=None, lower=0.0, upper=200.0, inc=100, verbose=False)

source code 

Generate a discrete probability distribution for the given values.

Parameters:
  • values (list of float) - The list of values to convert.
  • lower (float) - The lower bound of the distribution.
  • upper (float) - The upper bound of the distribution.
  • inc (int) - The number of discrete increments for the distribution between the lower and upper bounds.
  • verbose (bool) - A flag which if True will enable printouts.
Returns: list of lists of float
The discrete probability distribution.

gaussian(x=None, mu=0.0, sigma=1.0)

source code 

Calculate the probability for a Gaussian probability distribution for a given x value.

Parameters:
  • x (float) - The x value to calculate the probability for.
  • mu (float) - The mean of the distribution.
  • sigma (float) - The standard deviation of the distribution.
Returns: float
The probability corresponding to x.

std(values=None, skip=None, dof=1)

source code 

Calculate the standard deviation of the given values, skipping values if asked.

Parameters:
  • values (list of float) - The list of values to calculate the standard deviation of.
  • skip (list of bool or None.) - An optional list of booleans specifying if a value should be skipped. The length of this list must match the values. An element of True will cause the corresponding value to not be included in the calculation.
  • dof (int) - The degrees of freedom, whereby the standard deviation is multipled by 1/(N - dof).
Returns: float
The standard deviation.