Module Vz.Stat

Data statistics.

Stat summarizes data with statistics.

Statistics

type ('a, 'b) t = ('a, 'b) stat

The type for a statistic of type 'b on data of type 'a.

val add : ('a, 'b) stat -> 'a -> ('a, 'b) stat

add s v is the statistic s with value v added to the data.

val add_flip : 'a -> ('a, 'b) stat -> ('a, 'b) stat

add_flip v s is add s v.

val value : ('a, 'b) stat -> 'b

value s is the value of statistic s.

Primitive statistics combinators

val count : ('a, float) stat

count s is the integral number of values in the data.

val min : ('a -> float) -> ('a, float) stat

min f is the minimum value of f on the data.

val max : ('a -> float) -> ('a, float) stat

max f is the maximum value of f on the data.

val range : ('a -> float) -> ('a, float * float) 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) 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) 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) 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) 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) stat

fold f acc is f folded on the the data starting with acc.

Higher-order statistic combinators

val list : ('a, 'b) stat list -> ('a, 'b list) t

list l is the combined statistics of l on the data.

val t2 : ('a, 'b) stat -> ('a, 'c) stat -> ('a, 'b * 'c) stat

t2 s1 s2 is the combined statistics of s1 and s2 on the data.

val t3 : ('a, 'b) stat -> ('a, 'c) stat -> ('a, 'd) stat -> ('a, 'b * 'c * 'd) stat

t3 s1 s2 s3 is the combined statistics of s1, s2 and s3 on the data.

val t4 : ('a, 'b) stat -> ('a, 'c) stat -> ('a, 'd) stat -> ('a, 'e) stat -> ('a, 'b * 'c * 'd * 'e) stat

t4 s1 s2 s3 s4 is the combined statistics of s1, s2, s3 and s4 on the data.

val t5 : ('a, 'b) stat -> ('a, 'c) stat -> ('a, 'd) stat -> ('a, 'e) stat -> ('a, 'f) stat -> ('a, 'b * 'c * 'd * 'e * 'f) stat

t5 s1 s2 s3 s4 s5 is the combined statistics of s1, s2, s3, s4 and s5 on the data.