# Module Vz.Stat

`module Stat: `sig` .. `end``
Data statistics.

`Stat` summarizes data with statistics.

# Statistics

`type `('a, 'b)` t = `('a, 'b) Vz.stat` `
The type for a statistic of type `'b` on data of type `'a`.
`val add : `('a, 'b) Vz.stat -> 'a -> ('a, 'b) Vz.stat``
`add s v` is the statistic `s` with value `v` added to the data.
`val add_flip : `'a -> ('a, 'b) Vz.stat -> ('a, 'b) Vz.stat``
`add_flip v s` is `add s v`.
`val value : `('a, 'b) Vz.stat -> 'b``
`value s` is the value of statistic `s`.

# Primitive statistics combinators

`val count : `('a, float) Vz.stat``
`count s` is the integral number of values in the data.
`val min : `('a -> float) -> ('a, float) Vz.stat``
`min f` is the minimum value of `f` on the data.
`val max : `('a -> float) -> ('a, float) Vz.stat``
`max f` is the maximum value of `f` on the data.
`val range : `('a -> float) -> ('a, float * float) Vz.stat``
`range f` is the range of `f` on the data, equivalent to `t2 (min f) (max f)`.
`val range_d : `?cmp:('b -> 'b -> int) -> ('a -> 'b) -> ('a, 'b list) Vz.stat``
`range_d cmp f` is the discrete range of `f`, the set of values returned by `f` on the data. `cmp` is used to compare the values (defaults to `Pervasives.compare`).
`val sum : `?nan:bool -> ('a -> float) -> ('a, float) Vz.stat``
`sum nan f` is the sum of the values returned by `f` on the data. If `nan` is `false` (default), `nan` values are ignored.
`val mean : `?nan:bool -> ('a -> float) -> ('a, float) Vz.stat``
`mean nan f` is the mean of the values returned by `f` on the data. If `nan` is `false` (default), `nan` values are ignored.
`val mean_var : `?nan:bool -> ?pop:bool -> ('a -> float) -> ('a, float * float) Vz.stat``
`mean_var nan pop f` is the mean and unbiased sample variance of the values returned by `f` on the sample data. If `pop` is `true` (defaults to `false`), the population variance (biased sample variance) is computed. If `nan` is `false` (default), `nan` values are ignored.
`val fold : `('b -> 'a -> 'b) -> 'b -> ('a, 'b) Vz.stat``
`fold f acc` is `f` folded on the the data starting with `acc`.

# Higher-order statistic combinators

`val list : `('a, 'b) Vz.stat list -> ('a, 'b list) t``
`list l` is the combined statistics of `l` on the data.
`val t2 : `('a, 'b) Vz.stat -> ('a, 'c) Vz.stat -> ('a, 'b * 'c) Vz.stat``
`t2 s1 s2` is the combined statistics of `s1` and `s2` on the data.
`val t3 : `('a, 'b) Vz.stat ->       ('a, 'c) Vz.stat -> ('a, 'd) Vz.stat -> ('a, 'b * 'c * 'd) Vz.stat``
`t3 s1 s2 s3` is the combined statistics of `s1`, `s2` and `s3` on the data.
`val t4 : `('a, 'b) Vz.stat ->       ('a, 'c) Vz.stat ->       ('a, 'd) Vz.stat -> ('a, 'e) Vz.stat -> ('a, 'b * 'c * 'd * 'e) Vz.stat``
`t4 s1 s2 s3 s4` is the combined statistics of `s1`, `s2`, `s3` and `s4` on the data.
`val t5 : `('a, 'b) Vz.stat ->       ('a, 'c) Vz.stat ->       ('a, 'd) Vz.stat ->       ('a, 'e) Vz.stat -> ('a, 'f) Vz.stat -> ('a, 'b * 'c * 'd * 'e * 'f) Vz.stat``
`t5 s1 s2 s3 s4 s5` is the combined statistics of `s1`, `s2`, `s3`, `s4` and `s5` on the data.