statistics

Statistics provides procedures for computing quantitative statistics on collections.

Procedures

arithmetic_mean (lst)

Computes the arithmetic mean of a given list of numbers. This is the familiar "add up all the numbers, divide by the total" average.

  arithmetic_mean([1,2,3,4]) => 2.5

Parameters:

lst
a list (or collection iterable using !) of numbers

geometric_mean (lst)

Computes the geometric mean of a given list of numbers. The geometric mean takes the nth root of the product of the numbers, where n is the size of the data. This yields the central number within a geometric progression.

  geometric_mean([1,2,3,4,5]) => 2.6052

Parameters:

lst
a list (or collection iterable using !) of numbers

harmonic_mean (lst)

Computes the harmonic mean of a given list of numbers. The harmonic mean is the reciprocal of the arithmetic mean of the reciprocals.

  harmonic_mean([1,2,3,4,5]) => 2.1898

Parameters:

lst
a list (or collection iterable using !) of numbers

mean (lst)

Same as arithmetic_mean

Parameters:

lst
a list (or collection iterable using !) of numbers

Home