Medians

GitHub last commit crates.io crates.io docs.rs

Fast new algorithm(s) for finding 1D medians, implemented in Rust.

Introduction

Finding the medians is a common task in statistics and data analysis. At least it should be, if only it did not take so long.

We argue in rstats that using the Geometric Median is the most stable way to characterise multidimensional data.

That leaves the one dimensional case, where the medians are not used nearly enough either, due to being much slower to calculate than the arithmetic mean.

The Algorithms

Floyd-Rivest with the 'Median of Medians' approximation is currently considered to be the best algorithm. Here we explore some alternatives:

There is at least one more algorithm in the pipeline.