statsmodels.robust.scale.qn_scale

statsmodels.robust.scale.qn_scale(a, c=2.219144465985076, axis=0)[source]

Computes the Qn robust estimator of scale

The Qn scale estimator is a more efficient alternative to the MAD. The Qn scale estimator of an array a of length n is defined as c * {abs(a[i] - a[j]): i<j}_(k), for k equal to [n/2] + 1 choose 2. Thus, the Qn estimator is the k-th order statistic of the absolute differences of the array. The optional constant is used to normalize the estimate as explained below. The implementation follows the algorithm described in Croux and Rousseeuw (1992).

Parameters
aarray_like

Input array.

cfloat, optional

The normalization constant. The default value is used to get consistent estimates of the standard deviation at the normal distribution.

axisint, optional

The default is 0.

Returns
{float, ndarray}

The Qn robust estimator of scale