For more on streaming percentiles, see Calculating Percentiles on Streaming Data.
For convenience, you can also use the latest release binaries directly from a web browser:
Here's a simple example on how to use the Greenwald-Khanna streaming percentile algorithm:
var sp = ;// epsilon is allowable error. As epsilon becomes smaller, the// accuracy of the approximations improves, but the class consumes// more memory.var epsilon = 01;var gk = epsilon;for var i = 0; i < 1000; ++igk;var p50 = gk; // Approx. medianvar p95 = gk; // Approx. 95th percentile
Construct an object which implements the Greenwald-Khanna streaming percentile algorithm with allowable error epsilon.
var sp = ;var gk = 01;
Logs the observation of a value.
Compute the approximate quantile at phi. For example, the 95th percentile corresponds to phi = 0.95.
var p50 = gk;
This project is licensed under the MIT License.