biweight_location¶

astropy.stats.
biweight_location
(a, c=6.0, M=None, axis=None)[source] [edit on github]¶ Compute the biweight location.
The biweight location is a robust statistic for determining the central location of a distribution. It is given by:
\[\begin{split}C_{bl}= M+\frac{\Sigma_{\u_i\<1} (x_iM)(1u_i^2)^2} {\Sigma_{\u_i\<1} (1u_i^2)^2}\end{split}\]where \(M\) is the sample median (or the input initial guess) and \(u_i\) is given by:
\[u_{i} = \frac{(x_iM)}{c\ MAD}\]where \(c\) is the tuning constant and \(MAD\) is the median absolute deviation.
For more details, see Beers, Flynn, and Gebhardt (1990); AJ 100, 32.
Parameters: a : arraylike
Input array or object that can be converted to an array.
c : float, optional
Tuning constant for the biweight estimator. Default value is 6.0.
M : float or arraylike, optional
Initial guess for the biweight location. An array can be input when using the
axis
keyword.axis : int, optional
Axis along which the biweight locations are computed. The default (
None
) is to compute the biweight location of the flattened array.Returns: biweight_location : float or
ndarray
See also
Examples
Generate random variates from a Gaussian distribution and return the biweight location of the distribution:
>>> import numpy as np >>> from astropy.stats import biweight_location >>> rand = np.random.RandomState(12345) >>> from numpy.random import randn >>> loc = biweight_location(rand.randn(1000)) >>> print(loc) 0.0175741540445