f0i/statistics/4.0.0

List.Nonempty.Statistics

Fast Statistics functions for elm

Average

avg : Nonempty Float -> Float

Calculate the mean of a list of Float

avgInt : Nonempty Int -> Int

Calculate the mean of a list of Int

mean : Nonempty Float -> Float

Alias for avg

meanInt : Nonempty Int -> Int

Alias for avgInt

median : Nonempty Float -> Float

Get the median of a sorted list of Float

If the length of the list is even, the retun value is the average of the two values at the middle of the list.

medianInt : Nonempty Int -> Int

Get the median of a sorted list of Int

If the length of the list is even, the retun value is the average of the two values at the middle of the list.

percentile : Float -> Nonempty Float -> Float

Get the element at a position in percent from a list

If the percentage doesn't exactly match an element the value is interpolated from the two closest elements

percentileInt : Float -> Nonempty Int -> Int

Get the element at a position in percent from a list

If the percentage doesn't exactly match an element the value is interpolated from the two closest elements

percentiles : List Float -> Nonempty Float -> List Float

Get elements at multiple positions in percent from a list

If the percentage doesn't exactly match an element the value is interpolated from the two closest elements

percentilesInt : List Float -> Nonempty Int -> List Int

Get elements at multiple positions in percent from a list

If the percentage doesn't exactly match an element the value is interpolated from the two closest elements

Minimum / maximum

minimum : Nonempty number -> number

Wrapper for List.minimum

maximum : Nonempty number -> number

Wrapper for List.maximum

minmax : Nonempty number -> ( number, number )

Get minimum and maximum from list

Distribution

occurrences : List number -> Dict number Int

Get a Dict containing the numbers from the list as keys and the number of occurrences for each number as value

variance : Nonempty Float -> Float

Get The variance of a population of Float

varianceInt : Nonempty Int -> Int

Get The variance of a population of Int This function uses mostly Int calculations wich can cause rounding errors. See function variance (which uses Float) for more precise results.

stdDeviation : Nonempty Float -> Float

Get the standard deviation of a population of Float

stdDeviationInt : Nonempty Int -> Int

Get the standard deviation of a population of Int

Misc

sum : Nonempty number -> number

Wrapper for List.sum

product : Nonempty number -> number

Wrapper for List.product