f0i / statistics / List.Statistics

Fast Statistics functions for elm

Average

avg : List Basics.Float -> Maybe Basics.Float

Calculate the mean of a list of Float

avgInt : List Basics.Int -> Maybe Basics.Int

Calculate the mean of a list of Int

mean : List Basics.Float -> Maybe Basics.Float

Alias for avg

meanInt : List Basics.Int -> Maybe Basics.Int

Alias for avgInt

median : List Basics.Float -> Maybe Basics.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. Returns Nothing if the list is empty

medianInt : List Basics.Int -> Maybe Basics.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. Returns Nothing if the list is empty

percentile : Basics.Float -> List Basics.Float -> Maybe Basics.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 : Basics.Float -> List Basics.Int -> Maybe Basics.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 Basics.Float -> List Basics.Float -> Maybe (List Basics.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 Basics.Float -> List Basics.Int -> Maybe (List Basics.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 : List number -> Maybe number

Alias for List.minimum

maximum : List number -> Maybe number

Alias for List.maximum

minmax : List number -> Maybe ( number, number )

Get minimum and maximum from list

Returns Nothing if list is empty

Distribution

occurrences : List number -> Dict number Basics.Int

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

variance : List Basics.Float -> Maybe Basics.Float

Get The variance of a population of Float

varianceInt : List Basics.Int -> Maybe Basics.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 : List Basics.Float -> Maybe Basics.Float

Get the standard deviation of a population of Float

stdDeviationInt : List Basics.Int -> Maybe Basics.Int

Get the standard deviation of a population of Int

Misc

atLeast : number -> number -> number

Alias for max, to make piped usage more intuitive

number |> atLeast 5

atMost : number -> number -> number

Alias for min, to make piped usage more intuitive

number |> atMost 5

sum : List number -> number

Alias for List.sum

product : List number -> number

Alias for List.product