Function quantile

  • Returns the p-quantile of the given iterable of numbers, where p is a number in the range [0, 1].

    An optional accessor function may be specified, which is equivalent to calling array.map(accessor) before computing the quantile.

    Parameters

    • iterable: Iterable<Numeric>
    • p: number

    Returns number | undefined

  • Returns the p-quantile of the given iterable of numbers, where p is a number in the range [0, 1].

    An optional accessor function may be specified, which is equivalent to calling array.map(accessor) before computing the quantile.

    Type Parameters

    • T

    Parameters

    • iterable: Iterable<T>
    • p: number
    • accessor: ((element, i, array) => number)
        • (element, i, array): number
        • Parameters

          • element: T
          • i: number
          • array: Iterable<T>

          Returns number

    Returns number | undefined