Robust Location-Free Scale Estimate More Efficient than MAD
Robust Location-Free Scale Estimate More Efficient than MAD
Compute the robust scale estimator Qn, an efficient alternative to the MAD.
By default, Qn(x1,..,xn) is the k-th order statistic (a quantile) of the choose(n, 2) absolute differences abs(x[i]−x[j]), (for 1<=i<j<=n), where by default (originally only possible value) k=choose(n%/%2+1,2)
which is about the first quartile (25% quantile) of these pairwise differences. See the references for more.
constant: number by which the result is multiplied; the default achieves consistency for normally distributed data. Note that until Nov. 2010, thanks to a typo in the very first papers, a slightly wrong default constant, 2.2219, was used instead of the correct one which is equal to 1 / (sqrt(2) * qnorm(5/8)) (as mentioned already on p.1277, after (3.7) in Rousseeuw and Croux (1993)).
If you need the old slightly off version for historical reproducibility, you can use Qn.old().
Note that the relative difference is only about 1 in 1000, and that the correction should not affect the finite sample corrections for n<=9.
finite.corr: logical indicating if the finite sample bias correction factor should be applied. Defaults to TRUE unless constant is specified. Note the for non-default k, the consistency constant already depends on n leading to some finite sample correction, but no simulation-based small-n correction factors are available.
na.rm: logical specifying if missing values (NA) should be removed from x before further computation. If false as by default, and if there are NAs, i.e., if(anyNA(x)), the result will be NA.
k: integer, typically half of n, specifying the quantile , i.e., rather the order statistic that Qn() should return; for the Qn() proper, this has been hard wired to choose(n%/%2 +1, 2), i.e., floor(n/2)+1. Choosing a large k is less robust but allows to get non-zero results in case the default Qn() is zero.
warn.finite.corr: logical indicating if a warning
should be signalled when k is non-default, in which case specific small-n correction is not yet provided.
mu.too: logical indicating if the median(x) should also be returned for s_Qn().
...: potentially further arguments for s_Qn() passed to Qn().
Returns
Qn() returns a number, the Qn robust scale estimator, scaled to be consistent for σ2 and i.i.d. Gaussian observations, optionally bias corrected for finite samples.
s_Qn(x, mu.too=TRUE) returns a length-2 vector with location (μ) and scale; this is typically only useful for covOGK(*, sigmamu = s_Qn).
Details
As the (default, consistency) constant needed to be corrected, the finite sample correction has been based on a much more extensive simulation, and on a 3rd or 4th degree polynomial model in 1/n
for odd or even n, respectively.
References
Rousseeuw, P.J. and Croux, C. (1993) Alternatives to the Median Absolute Deviation, Journal of the American Statistical Association 88 , 1273--1283. tools:::Rd_expr_doi("10.2307/2291267")
Christophe Croux and Peter J. Rousseeuw (1992) A class of high-breakdown scale estimators based on subranges , Communications in Statistics - Theory and Methods 21 , 1935--1951; tools:::Rd_expr_doi("10.1080/03610929208830889")
Christophe Croux and Peter J. Rousseeuw (1992) Time-Efficient Algorithms for Two Highly Robust Estimators of Scale, Computational Statistics, Vol. 1, ed. Dodge and Whittaker, Physica-Verlag Heidelberg, 411--428; available via Springer Link.
mad for the most robust but much less efficient scale estimator; Sn for a similar faster but less efficient alternative. Finally, scaleTau2 which some consider uniformly better than Qn or competitors.