Skip to main content
Module

x/simplestatistics/index.js>quantileRankSorted

simple statistics for node & browser javascript
Go to Latest
function quantileRankSorted
import { quantileRankSorted } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

This function returns the quantile in which one would find the given value in the given array. With a sorted array, leveraging binary search, we can find this information in logarithmic time.

Examples

quantileRankSorted([1, 2, 3, 4], 3); // => 0.75 quantileRankSorted([1, 2, 3, 3, 4], 3); // => 0.7 quantileRankSorted([1, 2, 3, 4], 6); // => 1 quantileRankSorted([1, 2, 3, 3, 5], 4); // => 0.8

Parameters

x

input

value