Stats

mean : List (Num *) -> Result F64 [ListWasEmpty]

The arithmetic mean of a list x is defined as the sum of the elements of x divided by the number of elements in x.

For a version of this function that silently returns NaN when the input list is empty, see [meanUnchecked].

mean_unchecked : List (Num *) -> F64

A version of mean that silently returns NaN when the input list is empty.

variance : List (Num *) -> Result F64 [ListWasEmpty]

The unbiased sample variance of a list of numbers.

Defined as S² = ∑(x - x̄)² / (n − 1).

variance_unchecked : List (Num *) -> F64

A version of the variance function that silently returns NaN when the input list is empty.

variance_with_mean : List (Num *), F64 -> F64

A version of the variance function that uses a pre-calculated mean value for efficiency.

mean_and_variance : List (Num *) -> Result ( F64, F64 ) [ListWasEmpty]

A function that calculates both the mean and variance of a list at the same time. This is more efficient than calculating both values separately.

mean_and_variance_unchecked : List (Num *) -> ( F64, F64 )

A function that calculates both the mean and variance of a list at the same time. This is more efficient than calculating both values separately.

standard_deviation : List (Num *) -> Result F64 [ListWasEmpty]

The corrected sample standard deviation of a list of numbers.

nth_sample_moment : List (Num *), U64 -> Result F64 [ListWasEmpty]

The n-th sample moment of a list of numbers.

nth_sample_moment_unchecked : List (Num *), U64 -> F64

The n-th sample moment of a list of numbers that silently returns NaN when the input list is empty.

nth_sample_moment_with_mean : List (Num *), U64, F64 -> F64

The n-th sample moment of a list of numbers, given a pre-calculated mean.

median : List (Num *) -> Result F64 [ListWasEmpty]

The median of a list of numbers.

median_unchecked : List (Num *) -> F64

A version of the median function that silently returns NaN when the input list is empty.

range : List (Num a) -> Result (Num a) [ListWasEmpty]

The difference between the maximum and minimum values in a list.