Robust Statistics¶
Changed in version 0.4.0: Function names have been changed in this module and new function added. See the below for more details.
Small collection of robust statistical estimators based on functions from Henry Freudenriech (Hughes STX) statistics library (called ROBLIB) that have been incorporated into the AstroIDL User’s Library. Function included are:
biweight_mean - biweighted mean estimator
mean - robust estimator of the mean of a data set
- mode - robust estimate of the mode of a data set using the half-sample
method
std - robust estimator of the standard deviation of a data set
- checkfit - return the standard deviation and biweights for a fit in order
to determine its quality
linefit - outlier resistant fit of a line to data
polyfit - outlier resistant fit of a polynomial to data
For the fitting routines, the coefficients are returned in the same order as numpy.polyfit, i.e., with the coefficient of the highest power listed first.
For additional information about the original IDL routines, see: http://idlastro.gsfc.nasa.gov/contents.html#C17
- lsl.statistics.robust.biweight_mean(inputData, axis=None, dtype=None)¶
Calculate the mean of a data set using bisquare weighting.
Based on the biweight_mean routine from the AstroIDL User’s Library.
Changed in version 1.0.3: Added the ‘axis’ and ‘dtype’ keywords to make this function more compatible with numpy.mean()
- lsl.statistics.robust.checkfit(inputData, inputFit, epsilon, delta, bisquare_limit=6.0)¶
Determine the quality of a fit and biweights. Returns a tuple with elements:
Status
Robust standard deviation analog
Fractional median absolute deviation of the residuals
Number of input points given non-zero weight in the calculation
Bisquare weights of the input points
Residual values scaled by sigma
This function is based on the rob_checkfit routine from the AstroIDL User’s Library.
- lsl.statistics.robust.linefit(inputX, inputY, max_iter=25, bisector=False, bisquare_limit=6.0, close_factor=0.03)¶
Outlier resistance two-variable linear regression function.
Based on the robust_linefit routine in the AstroIDL User’s Library.
- lsl.statistics.robust.mean(inputData, cut=3.0, axis=None, dtype=None)¶
Robust estimator of the mean of a data set. Based on the resistant_mean function from the AstroIDL User’s Library.
Changed in version 1.2.1: Added a ValueError if the distriubtion is too strange
Changed in version 1.0.3: Added the ‘axis’ and ‘dtype’ keywords to make this function more compatible with numpy.mean()
- lsl.statistics.robust.mode(inputData, axis=None, dtype=None)¶
Robust estimator of the mode of a data set using the half-sample mode.
- lsl.statistics.robust.polyfit(inputX, inputY, order, max_iter=25)¶
Outlier resistance two-variable polynomial function fitter.
Based on the robust_poly_fit routine in the AstroIDL User’s Library.
- lsl.statistics.robust.std(inputData, zero=False, axis=None, dtype=None)¶
Robust estimator of the standard deviation of a data set.
Based on the robust_sigma function from the AstroIDL User’s Library.
Changed in version 1.2.1: Added a ValueError if the distriubtion is too strange
Changed in version 1.0.3: Added the ‘axis’ and ‘dtype’ keywords to make this function more compatible with numpy.std()
Statistical Tests¶
New in version 0.4.0.
Collection of statistical tests not found in any of the common python libraries.
- lsl.statistics.stattests.wald_wolfowitz(inputData)¶
Wald-Wolfowitz test of randomness. Given a numpy array of values compute the probability that the values are mutially independent.