© 2011, American Statistical Association. All right reserved. We present two methods of calculating trimmed means without sorting the data in O(n) time. The existing method implemented in major statistical packages relies on sorting, which takes O(n log n) time. The proposed algorithm is based on the quickselect algorithm for calculating order statistics with O(n) expected running time. It is an order of magnitude faster than the existing method for large data sets.
Beliakov, G. (2015). Fast Computation of Trimmed Means. Journal of Statistical Software, 39(Code Snippet 2). https://doi.org/10.18637/jss.v039.c02