matician - v2.0.0
    Preparing search index...

    Function percentile

    • Returns the value at the given percentile in a dataset using linear interpolation.

      Parameters

      • values: number[]

        An array of numeric values.

      • p: number

        Percentile (0 to 100).

      Returns number

      The value at the specified percentile.

      If the array is empty.

      If the percentile is out of range.

      percentile([1, 2, 3, 4, 5], 50); // returns 3 (median)
      percentile([10, 20, 30], 25); // returns 15