Compute the biweight midvariance for an array.
Returns the biweight midvariance for the array elements. The biweight midvariance is a robust statistic for determining the midvariance (i.e. the standard deviation) of a distribution.
The biweight location is given by the following equation
![C_{bl}= (n')^{1/2} \frac{[\Sigma_{|u_i|<1} (x_i-M)^2(1-u_i^2)^4]^{0.5}}
{|\Sigma_{|u_i|<1} (1-u_i^2)(1-5u_i^2)|}](../_images/math/7cdc6dff278d910f2dd2f90da3e17c0ca56b8476.png)
where
is given by

where MAD is the median absolute deviation.
is the number of data for which
holds, while the
summations are over all i up to n:

This is slightly different than given in the reference below, but results in a value closer to the true midvariance.
The midvariance parameter c is typically 9.0.
For more details, see Beers, Flynn, and Gebhardt, 1990, AJ, 100, 32B
| Parameters: | a : array-like
c : float
M : float, optional
|
|---|---|
| Returns: | biweight_midvariance : float
|
See also
Examples
This will generate random variates from a Gaussian distribution and return the median absolute deviation for that distribution:
>>> from astropy.stats.funcs import biweight_midvariance
>>> from numpy.random import randn
>>> randvar = randn(10000)
>>> scl = biweight_midvariance(randvar)