1 USING: help.markup help.syntax debugger ;
5 { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} }
6 { $description "Computes the geometric mean of all elements in " { $snippet "seq" } ". The geometric mean measures the central tendency of a data set that minimizes the effects of extreme values." }
7 { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } geometric-mean ." "1.81712059283214" } }
8 { $errors "Throws a " { $link signal-error. } " (square-root of 0) if the sequence is empty." } ;
11 { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} }
12 { $description "Computes the harmonic mean of the elements in " { $snippet "seq" } ". The harmonic mean is appropriate when the average of rates is desired." }
13 { $notes "Positive reals only." }
14 { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } harmonic-mean ." "6/11" } }
15 { $errors "Throws a " { $link signal-error. } " (divide by zero) if the sequence is empty." } ;
18 { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} }
19 { $description "Computes the arithmetic mean of all elements in " { $snippet "seq" } "." }
20 { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } mean ." "2" } }
21 { $errors "Throws a " { $link signal-error. } " (divide by zero) if the sequence is empty." } ;
24 { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} }
25 { $description "Computes the median of " { $snippet "seq" } " by sorting the sequence from lowest value to highest and outputting the middle one. If there is an even number of elements in the sequence, the median is not unique, so the mean of the two middle values is outputted." }
27 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } median ." "2" }
28 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } median ." "2+1/2" } }
29 { $errors "Throws a " { $link signal-error. } " (divide by zero) if the sequence is empty." } ;
32 { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} }
33 { $description "Computes the distance of the maximum and minimum values in " { $snippet "seq" } "." }
35 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } range ." "2" }
36 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } range ." "3" } } ;
39 { $values { "seq" "a sequence of numbers" } { "x" "a non-negative real number"} }
40 { $description "Computes the standard deviation of " { $snippet "seq" } ", which is the square root of the variance. It measures how widely spread the values in a sequence are about the mean." }
42 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } std ." "1.0" }
43 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } std ." "1.290994448735806" } } ;
46 { $values { "seq" "a sequence of numbers" } { "x" "a non-negative real number"} }
47 { $description "Computes the standard error of the mean for " { $snippet "seq" } ". It's defined as the standard deviation divided by the square root of the length of the sequence, and measures uncertainty associated with the estimate of the mean." }
49 { $example "USING: math.statistics prettyprint ;" "{ -2 2 } ste ." "2.0" }
50 { $example "USING: math.statistics prettyprint ;" "{ -2 2 2 } ste ." "1.333333333333333" } } ;
53 { $values { "seq" "a sequence of numbers" } { "x" "a non-negative real number"} }
54 { $description "Computes the variance of " { $snippet "seq" } ". It's a measurement of the spread of values in a sequence. The larger the variance, the larger the distance of values from the mean." }
55 { $notes "If the number of elements in " { $snippet "seq" } " is 1 or less, it outputs 0." }
57 { $example "USING: math.statistics prettyprint ;" "{ 1 } var ." "0" }
58 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } var ." "1" }
59 { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } var ." "1+2/3" } } ;