sample-var ( seq -- x )
Statistics

Prev:sample-ste ( seq -- x )
Next:std-ddof ( seq n -- x )


Vocabulary
math.statistics

Inputs
seqa sequence


Outputs
xa non-negative real number


Word description
Computes the variance of seq. It's a measurement of the spread of values in a sequence.

Notes
If the number of elements in seq is 1 or less, it outputs 0.

Examples
USING: math.statistics prettyprint ; { 1 } sample-var .
0


USING: math.statistics prettyprint ; { 1 2 3 } sample-var .
1


USING: math.statistics prettyprint ; { 1 2 3 4 } sample-var .
1+2/3


See also
var-ddof, population-var

Definition