Package csb :: Package statistics
[frames] | no frames]

Package statistics

source code

Statistics root package.

This package contains a number of common statistical utilities. Sub-packages provide more specialized APIs, for example csb.statistics.pdf defines the probability density object model.

Submodules

Classes
  Cumulative
Functions
 
autocorrelation(x, n)
auto-correlation of a times series
source code
 
circmean(a, axis=None)
Estimate mean of a circular variable
source code
 
circvar(a, axis=None)
Calculate circular variance of a circular variable.
source code
 
density(x, nbins, normalize=True)
Histogram of univariate input data: basically calls numpy's histogram method and does a proper normalization.
source code
 
entropy(p)
Calculate the entropy of p.
source code
 
geometric_mean(x, axis=None)
Returns: geometric mean of x
source code
 
harmonic_mean(x, axis=None)
Returns: harmonic mean of x
source code
 
histogram2D(x, nbins=100, axes=None, nbatch=1000, normalize=True)
Non-greedy two-dimensional histogram.
source code
 
histogram_nd(x, nbins=100, axes=None, nbatch=1000, normalize=True)
Non-greedy n-dimemsional histogram.
source code
 
kurtosis(x, axis=None)
Returns: Sample kurtosis of x
source code
 
principal_coordinates(D, nd=None)
Reconstruction of a multidimensional configuration that optimally reproduces the input distance matrix.
source code
 
probabilistic_and(p, axis=0)
Probabilistic version of AND
source code
 
probabilistic_or(p, axis=0)
Probabilistic version of OR
source code
 
probabilistic_xor(p, axis=0)
Probabilistic version of XOR.
source code
 
running_average(x, w, axis=None)
Calculates a running average for given window size
source code
 
skewness(x, axis=None)
Returns: Sample skewness of x
source code
 
weighted_median(x, w)
Calculates the weighted median, that is the minimizer of argmin {\sum w_i |x_i - \mu|}
source code
Variables
  __package__ = None
hash(x)
Function Details

autocorrelation(x, n)

source code 

auto-correlation of a times series

Parameters:
  • x (numpy.array) - time series
  • n (int) - Maximal lag for which to compute the auto-correlation

circmean(a, axis=None)

source code 

Estimate mean of a circular variable

Parameters:
  • a - input array
  • axis (None or integer) - axis along which mean is calculated

circvar(a, axis=None)

source code 

Calculate circular variance of a circular variable.

Parameters:
  • a - input array
  • axis (None or integer) - axis along which mean is calculated

density(x, nbins, normalize=True)

source code 

Histogram of univariate input data: basically calls numpy's histogram method and does a proper normalization.

Parameters:
  • x - input numpy array
  • nbins (integer) - number of bins
  • normalize - if true, histogram will be normalized

entropy(p)

source code 

Calculate the entropy of p.

Returns:
entropy of p

geometric_mean(x, axis=None)

source code 
Parameters:
  • x
  • axis - compute the geometric mean along this axis
Returns:
geometric mean of x

harmonic_mean(x, axis=None)

source code 
Parameters:
  • x
  • axis - compute the harmonic mean along this axis
Returns:
harmonic mean of x

histogram2D(x, nbins=100, axes=None, nbatch=1000, normalize=True)

source code 

Non-greedy two-dimensional histogram.

Parameters:
  • x (numpy array) - input array of rank two
  • nbins (integer) - number of bins
  • axes (tuple of two one-dimensional numpy arrays) - x- and y-axes used for binning the data (if provided this will be used instead of <nbins>)
  • nbatch (integer) - size of batch that is used to sort the data into the 2D grid
  • normalize (boolean) - specifies whether histogram should be normalized
Returns:
2-rank array storing histogram, tuple of x- and y-axis

histogram_nd(x, nbins=100, axes=None, nbatch=1000, normalize=True)

source code 

Non-greedy n-dimemsional histogram.

Parameters:
  • x (numpy array) - input array of rank (-1,n)
  • nbins (integer) - number of bins
  • axes (tuple of two one-dimensional numpy arrays) - axes used for binning the data (if provided this will be used instead of <nbins>)
  • nbatch (integer) - size of batch that is used to sort the data into the nD grid
  • normalize (boolean) - specifies whether histogram should be normalized
Returns:
n-rank array storing histogram, tuple of axes

kurtosis(x, axis=None)

source code 
Parameters:
  • x - random variables
  • axis - compute the kurtosis along this axis
Returns:
Sample kurtosis of x

principal_coordinates(D, nd=None)

source code 

Reconstruction of a multidimensional configuration that optimally reproduces the input distance matrix.

See: Gower, J (1966)

probabilistic_xor(p, axis=0)

source code 

Probabilistic version of XOR. Works only for axis=0.

running_average(x, w, axis=None)

source code 

Calculates a running average for given window size

Parameters:
  • x - input array
  • w (integer) - window size
  • axis - axis along which mean is calculated

skewness(x, axis=None)

source code 
Parameters:
  • x - random variables
  • axis - compute the skewness along this axis
Returns:
Sample skewness of x

weighted_median(x, w)

source code 

Calculates the weighted median, that is the minimizer of argmin {\sum w_i |x_i - \mu|}

Parameters:
  • x - input array
  • w - array of weights