stats — Statistics functions module.

This module contains utility functions used for statistics in ADMIT.

admit.util.stats.mystats(data)[source]

return raw and robust statistics for a distribution

Parameters:

data : array

The data array for which the statistics is returned.

Returns:

returns: N, mean, std for the raw and robust resp.

admit.util.stats.reducedchisquared(data, model, numpar, noise=None)[source]

Method to compute the reduced chi squared of a fit to data.

Parameters:

data : array like

The raw data the fit is based on, acceptable data types are numpy array, masked array, and list

model : array like

The fit to the data, acceptable data types are numpy array, masked array, and list. Must be of the same length as data, no error checking is done

dof : int

Number of free parameters (degrees of freedom) in the model

noise : float

The noise/uncertainty of the data

Returns:

Float containing the reduced chi squared value, the closer to 1.0

the better

admit.util.stats.rejecto1(data, f=1.5)[source]

reject outliers from a distribution using a hinges-fences style rejection, using a mean.

Parameters:

data : array

f : float

The factor f, such that only data is retained between mean - f*std and mean + f*std

Returns:

returns: an array with only data between

mean - f*std and mean + f*std

admit.util.stats.rejecto2(data, f=1.5)[source]
reject outliers from a distribution
using a hinges-fences style rejection, using a median.
Parameters:

data : array

f : float

The factor f, such that only data is retained between median - f*std and median + f*std

Returns:

returns: an array with only data between

median - f*std and median + f*std

admit.util.stats.robust(data, f=1.5)[source]

return a subset of the data with outliers robustly removed data - can be masked