View Source Tim.Stats (Tim v0.2.0)

Aggregates stats.

Link to this section Summary

Functions

Return a map of statistical aggregates for a list of numbers.

Compute the maximum value of a list of numbers. This aliases Enum.max.

Compute the mean value of a list of numbers.

Compute the median value of a list of numbers. This function always returns an element of the list.

Compute the minimum value of a list of numbers. This aliases Enum.min.

Link to this section Functions

@spec collect([number(), ...], number()) :: %{required(atom()) => number()}

Return a map of statistical aggregates for a list of numbers.

@spec max([number(), ...]) :: number()

Compute the maximum value of a list of numbers. This aliases Enum.max.

@spec mean([number(), ...]) :: number()

Compute the mean value of a list of numbers.

exmaples

Exmaples

iex> Tim.Stats.mean([1])
1.0
iex> Tim.Stats.mean([1, 2, 3, 4])
2.5
@spec median([number(), ...]) :: number()

Compute the median value of a list of numbers. This function always returns an element of the list.

exmaples

Exmaples

iex> Tim.Stats.median([1])
1
iex> Tim.Stats.median([1, 2, 3])
2
iex> Tim.Stats.median([1, 2, 3, 4])
3
@spec min([number(), ...]) :: number()

Compute the minimum value of a list of numbers. This aliases Enum.min.