Function skewness

  • Find the skewness of an array. Skewness describes how far to the left or right a data set distribution is distorted from a symmetrical bell curve. A distribution with a long left tail is left-skewed, or negatively-skewed. A distribution with a long right tail is right-skewed, or positively-skewed.

    Parameters

    • array: any[]

      An array of length n where n>2.

    • Optional iteratee: ((o) => number)

      The iteratee invoked on each element.

        • (o): number
        • Parameters

          • o: any

          Returns number

    Returns number

    Returns the skewness.

    Since

    0.5.1

    Example

    skewness([1, 2, 3])
    // => 0

    const objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }]
    skewness(objects, ({ n }) => n)
    // => 0